aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-23 14:38:54 +0300
committerGravatar Vitaly Takmazov2018-10-23 14:38:54 +0300
commit09d0533511faee6ab2da2fd6db79eb0063fd429e (patch)
tree0d2313f626ff4cdc2a4330caf9dc2020d8aa10d0 /juick-server/src/main
parent2ec703610f07225ce2f82481aa736b6dca21e2d2 (diff)
Do not use subscribed users jid
Diffstat (limited to 'juick-server/src/main')
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPConnection.java12
-rw-r--r--juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java2
-rw-r--r--juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java12
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java4
-rw-r--r--juick-server/src/main/resources/db/migration/V1.15__drop unused columns add ts for some tables.sql4
5 files changed, 9 insertions, 25 deletions
diff --git a/juick-server/src/main/java/com/juick/server/XMPPConnection.java b/juick-server/src/main/java/com/juick/server/XMPPConnection.java
index c861b757..d03251a3 100644
--- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java
+++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java
@@ -101,8 +101,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
private String password;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
- @Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
- private String imgDir;
@Inject
private MessagesService messagesService;
@@ -113,8 +111,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
@Inject
private PMQueriesService pmQueriesService;
@Inject
- private TagService tagService;
- @Inject
private BasicXmppSession session;
@Inject
private ExecutorService service;
@@ -289,12 +285,8 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
private void sendJuickMessage(com.juick.Message jmsg, List<User> users) {
List<String> jids = new ArrayList<>();
- if (jmsg.FriendsOnly) {
- jids = subscriptionService.getJIDSubscribedToUser(jmsg.getUser().getUid(), jmsg.FriendsOnly);
- } else {
- for (User user : users) {
- jids.addAll(userService.getJIDsbyUID(user.getUid()));
- }
+ for (User user : users) {
+ jids.addAll(userService.getJIDsbyUID(user.getUid()));
}
com.juick.Message fullMsg = messagesService.getMessage(jmsg.getMid());
String txt = "@" + jmsg.getUser().getName() + ":" + MessageUtils.getTagsString(fullMsg) + "\n";
diff --git a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
index 47d1870b..28e91ce7 100644
--- a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
@@ -119,7 +119,7 @@ public class CrosspostServiceImpl extends BaseJdbcService implements CrosspostSe
public boolean enableFBCrosspost(Integer uid) {
return getJdbcTemplate().update("UPDATE facebook SET crosspost=1 WHERE user_id=?", uid) > 0
&& getJdbcTemplate().update(
- "INSERT INTO subscr_users(user_id,suser_id,jid,active) VALUES (?,5863,'juick@facebook.juick.com',1)",
+ "INSERT INTO subscr_users(user_id,suser_id) VALUES (?,5863)",
uid) > 0;
}
diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index 2032576c..5ce3593b 100644
--- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -53,18 +53,6 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
@Transactional(readOnly = true)
@Override
- public List<String> getJIDSubscribedToUser(final int uid, final boolean friendsonly) {
- return getNamedParameterJdbcTemplate().queryForList(
- "SELECT jids.jid FROM subscr_users INNER JOIN jids " +
- "ON (subscr_users.user_id = :uid AND subscr_users.suser_id = jids.user_id) WHERE jids.active = 1 " +
- (friendsonly ?
- " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.user_id = :uid and jids.user_id = w.wl_user_id)" : StringUtils.EMPTY),
- new MapSqlParameterSource("uid", uid),
- String.class);
- }
-
- @Transactional(readOnly = true)
- @Override
public List<User> getSubscribedUsers(final int uid, final Message msg) {
int mid = msg.getMid();
User author = messagesService.getMessageAuthor(mid);
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index 82e9a124..ead71e2f 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -530,8 +530,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"VALUES (?,?,?,?)" +
" ON DUPLICATE KEY UPDATE access_token=?,access_token_secret=?,uname=?",
user.getUid(), accessToken, accessTokenSecret, screenName, accessToken, accessTokenSecret, screenName) > 0) {
- return getJdbcTemplate().update("INSERT INTO subscr_users(user_id,suser_id,jid) " +
- "VALUES (?,1741,'juick\\@twitter.juick.com')", user.getUid()) > 0;
+ return getJdbcTemplate().update("INSERT INTO subscr_users(user_id,suser_id) " +
+ "VALUES (?,1741)", user.getUid()) > 0;
}
return false;
diff --git a/juick-server/src/main/resources/db/migration/V1.15__drop unused columns add ts for some tables.sql b/juick-server/src/main/resources/db/migration/V1.15__drop unused columns add ts for some tables.sql
new file mode 100644
index 00000000..6b3ab388
--- /dev/null
+++ b/juick-server/src/main/resources/db/migration/V1.15__drop unused columns add ts for some tables.sql
@@ -0,0 +1,4 @@
+ALTER TABLE subscr_users DROP COLUMN `jid`;
+ALTER TABLE subscr_users DROP COLUMN `active`;
+ALTER TABLE auth ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
+ALTER TABLE mail ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file