Skip to content

Commit

Permalink
Fix link in chats
Browse files Browse the repository at this point in the history
  • Loading branch information
Nonononoki committed Nov 15, 2020
1 parent 0792762 commit 44a8468
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/nonononoki/alovoa/html/AdminResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.nonononoki.alovoa.entity.Contact;
import com.nonononoki.alovoa.entity.User;
import com.nonononoki.alovoa.entity.UserReport;
import com.nonononoki.alovoa.model.UserDto;
import com.nonononoki.alovoa.repo.ContactRepository;
import com.nonononoki.alovoa.repo.UserReportRepository;
import com.nonononoki.alovoa.service.AuthService;
Expand Down Expand Up @@ -45,7 +46,7 @@ public ModelAndView admin() throws Exception {
List<UserReport> reports = userReportRepo.findTop20ByOrderByDateAsc();

for(UserReport r : reports) {
r.setUserToIdEnc(textEncryptor.encode(Long.toString(r.getUserTo().getId())));
r.setUserToIdEnc(UserDto.encodeId(r.getUserTo().getId(), textEncryptor));
}

List<Contact> contacts = contactRepository.findTop20ByHiddenFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@ public class RegisterResource {
@GetMapping("/register")
public ModelAndView register() {
ModelAndView mav = new ModelAndView("register");
// mav.addObject("captcha", captchaService.generate());
mav.addObject("genders", genderRepo.findAll());
mav.addObject("intentions", userIntentionRepo.findAll());
return mav;
}

public ModelAndView registerOauth(User user) throws Exception {
ModelAndView mav = new ModelAndView("register-oauth");
// mav.addObject("captcha", captchaService.generate());
mav.addObject("email", textEncryptor.encode(user.getEmail()));
mav.addObject("genders", genderRepo.findAll());
mav.addObject("intentions", userIntentionRepo.findAll());
return mav;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/nonononoki/alovoa/model/ConversationDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ public class ConversationDto {
private String lastMessage;
private String userIdEncoded;
private boolean read;
public static ConversationDto conversationToDto(Conversation c, User currentUser, TextEncryptorConverter textEncryptor)
throws Exception {

public static ConversationDto conversationToDto(Conversation c, User currentUser,
TextEncryptorConverter textEncryptor) throws Exception {
ConversationDto dto = new ConversationDto();
dto.setId(c.getId());
dto.setLastUpdated(c.getLastUpdated());
dto.setLastMessage(c.getLastMessage());
User u = c.getUserFrom();
if(u.equals(currentUser)) {
if (u.equals(currentUser)) {
u = c.getUserTo();
}
dto.setUserName(u.getFirstName());
dto.setUserProfilePicture(u.getProfilePicture());
dto.setUserIdEncoded(textEncryptor.encode(Long.toString(u.getId())));
dto.setUserIdEncoded(UserDto.encodeId(u.getId(), textEncryptor));
return dto;
}
}

0 comments on commit 44a8468

Please sign in to comment.