From a9b7aba3fd047186aa92c7b3de76242550e783cb Mon Sep 17 00:00:00 2001 From: Oleksandr Bielan <46462953+alexandr-bielan@users.noreply.github.com> Date: Thu, 3 Jun 2021 12:16:38 +0300 Subject: [PATCH] change-poststatus-to-published (#330) Co-authored-by: Alex --- .../softserveinc/dokazovi/service/impl/PostServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/softserveinc/dokazovi/service/impl/PostServiceImpl.java b/src/main/java/com/softserveinc/dokazovi/service/impl/PostServiceImpl.java index e1321f8c..a44d0f8f 100644 --- a/src/main/java/com/softserveinc/dokazovi/service/impl/PostServiceImpl.java +++ b/src/main/java/com/softserveinc/dokazovi/service/impl/PostServiceImpl.java @@ -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)); } @@ -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);