Skip to content

Commit

Permalink
change-poststatus-to-published (#330)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex <kp9k999@gmail.com>
  • Loading branch information
alexandr-bielan and Alex authored Jun 3, 2021
1 parent a81a512 commit a9b7aba
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public PostDTO saveFromUser(PostSaveFromUserDTO postDTO, UserPrincipal userPrinc
if (userEntity.getId().equals(postDTO.getAuthorId()) && userPrincipal.getAuthorities().stream()
.anyMatch(grantedAuthority -> grantedAuthority
.getAuthority().equals("SAVE_OWN_PUBLICATION"))) {
mappedEntity.setStatus(PostStatus.MODERATION_FIRST_SIGN);
mappedEntity.setStatus(PostStatus.PUBLISHED);
mappedEntity.setAuthor(userEntity);
return postMapper.toPostDTO(postRepository.save(mappedEntity));
}
Expand Down Expand Up @@ -203,7 +203,7 @@ public Boolean updatePostById(UserPrincipal userPrincipal, PostSaveFromUserDTO p
Integer authorId = mappedEntity.getAuthor().getId();

if (userId.equals(authorId) && checkAuthority(userPrincipal, "UPDATE_OWN_POST")) {
mappedEntity.setStatus(PostStatus.MODERATION_FIRST_SIGN);
mappedEntity.setStatus(PostStatus.PUBLISHED);
saveEntity(mappedEntity);
} else if (!userId.equals(authorId) && checkAuthority(userPrincipal, "UPDATE_POST")) {
mappedEntity.setStatus(PostStatus.PUBLISHED);
Expand Down

0 comments on commit a9b7aba

Please sign in to comment.