From 90201606bb485988f5a85cd578f3f5b8ecddf4db Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 26 Apr 2023 09:11:53 +0300 Subject: Expose `friendsOnly` message property over API --- src/main/java/com/juick/www/api/Messages.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/main/java/com/juick/www') diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java index ead2c076..ef55944b 100644 --- a/src/main/java/com/juick/www/api/Messages.java +++ b/src/main/java/com/juick/www/api/Messages.java @@ -21,7 +21,6 @@ import com.juick.model.Message; import com.juick.model.Tag; import com.juick.model.User; import com.juick.service.activities.UpdateEvent; -import com.juick.util.WebUtils; import com.juick.www.WebApp; import com.juick.model.CommandResult; import com.juick.util.HttpBadRequestException; @@ -43,7 +42,6 @@ import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** * @author ugnich @@ -216,7 +214,7 @@ public class Messages { public void togglePrivacy(@Parameter(hidden = true) User visitor, @RequestParam Integer mid) { if (visitor.isPremium() || userService.isAdminUser(visitor)) { var msg = messagesService.getMessage(mid).orElseThrow(HttpNotFoundException::new); - messagesService.setFriendsOnly(mid, !msg.FriendsOnly); + messagesService.setFriendsOnly(mid, !msg.isFriendsOnly()); msg = messagesService.getMessage(mid).orElseThrow(HttpNotFoundException::new); applicationEventPublisher.publishEvent( new UpdateEvent(this, visitor, msg)); -- cgit v1.2.3