aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/Messages.java36
1 files changed, 3 insertions, 33 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
index d50620ff..584ff3cf 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
@@ -1,9 +1,9 @@
package com.juick.api.controllers;
+import com.juick.Status;
import com.juick.Tag;
import com.juick.User;
import com.juick.api.ApiServer;
-import com.juick.Status;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpForbiddenException;
import com.juick.service.MessagesService;
@@ -16,13 +16,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-import rocks.xmpp.addr.Jid;
-import rocks.xmpp.core.stanza.model.Message;
+import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import java.util.Collections;
@@ -178,31 +172,7 @@ public class Messages {
@RequestParam(defaultValue = "0") int mid,
@RequestParam(defaultValue = "0") int popular) {
if (mid > 0) {
- boolean ret = messagesService.setMessagePopular(mid, popular);
-
- if (ret && popular == 2) {
- try {
- com.juick.Message m = messagesService.getMessage(mid);
- if (m != null) {
- Message msg = new Message();
- msg.setFrom(Jid.of("juick@juick.com"));
- msg.setTo(Jid.of("crosspost.juick.com"));
- m.setUser(userService.getUserByUID(11574).get());
- msg.addExtension(m);
-
- msg.setTo(Jid.of("twitter@crosspost.juick.com"));
- apiServer.getXmpp().send(msg);
- msg.setTo(Jid.of("fb@crosspost.juick.com"));
- apiServer.getXmpp().send(msg);
- msg.setTo(Jid.of("vk@crosspost.juick.com"));
- apiServer.getXmpp().send(msg);
- } else {
- throw new Exception("Message not found");
- }
- } catch (Exception e) {
- logger.error("SETPOPULAR ERROR", e);
- }
- }
+ messagesService.setMessagePopular(mid, popular);
return Status.OK;
}
throw new HttpBadRequestException();