Profile page
This commit is contained in:
parent
4f94d47a56
commit
8408eb874e
@ -74,19 +74,15 @@ public class StaticController {
|
|||||||
public String profilePage(@PathVariable("id") Long id, Model model) {
|
public String profilePage(@PathVariable("id") Long id, Model model) {
|
||||||
User self = AuthenticationUtil.authProfile(model, userService);
|
User self = AuthenticationUtil.authProfile(model, userService);
|
||||||
User u = userService.findById(id);
|
User u = userService.findById(id);
|
||||||
FriendFollowState state = FriendFollowState.NOT_FOLLOWED;
|
model.addAttribute("page_user", new ProfilePageResult("",
|
||||||
FriendStatus fs = friendService.getFollow(self.getId(), u.getId());
|
"background-image: url(\"/image/store/"+u.getAvatarId()+"\");",
|
||||||
if( fs != null ) {
|
u.getUsername(),
|
||||||
if( fs.getFirstUserId().longValue() == self.getId().longValue() ) {
|
u.getId(),
|
||||||
state = FriendFollowState.FOLLOWED;
|
u.getDisplayName(),
|
||||||
} else {
|
0,
|
||||||
state = FriendFollowState.ACCEPT;
|
0,
|
||||||
}
|
friendService.getFriendsOfUserId(u.getId()).size(),
|
||||||
}
|
friendService.getFriendState(self.getId(), u.getId())));
|
||||||
if( friendService.getFriend(self.getId(), u.getId()) != null ) {
|
|
||||||
state = FriendFollowState.FOLLOWED;
|
|
||||||
}
|
|
||||||
model.addAttribute("page_user", new ProfilePageResult("", "background-image: url(\"/image/store/"+u.getAvatarId()+"\");", u.getUsername(), u.getId(), u.getDisplayName(), 0, 0, friendService.getFriendsOfUserId(u.getId()).size(), state));
|
|
||||||
return "profile";
|
return "profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.alterdekim.game.service;
|
package com.alterdekim.game.service;
|
||||||
|
|
||||||
|
import com.alterdekim.game.dto.FriendFollowState;
|
||||||
import com.alterdekim.game.entities.FriendStatus;
|
import com.alterdekim.game.entities.FriendStatus;
|
||||||
import com.alterdekim.game.repository.FriendRepository;
|
import com.alterdekim.game.repository.FriendRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -35,4 +36,16 @@ public class FriendServiceImpl {
|
|||||||
public FriendStatus getFriend(Long userId, Long friendId) {
|
public FriendStatus getFriend(Long userId, Long friendId) {
|
||||||
return repository.getFriend(userId, friendId);
|
return repository.getFriend(userId, friendId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FriendFollowState getFriendState(Long userId, Long friendId) {
|
||||||
|
FriendStatus fs = this.getFollow(userId, friendId);
|
||||||
|
if( fs != null ) {
|
||||||
|
if( fs.getFirstUserId().longValue() == userId.longValue() ||
|
||||||
|
this.getFriend(userId, friendId) != null ) {
|
||||||
|
return FriendFollowState.FOLLOWED;
|
||||||
|
}
|
||||||
|
return FriendFollowState.ACCEPT;
|
||||||
|
}
|
||||||
|
return FriendFollowState.NOT_FOLLOWED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user