diff options
6 files changed, 4 insertions, 55 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Users.java b/juick-api/src/main/java/com/juick/api/controllers/Users.java index dc8ebc84..b221d9fe 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Users.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Users.java @@ -46,8 +46,7 @@ public class Users { @RequestMapping(value = "/users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List<User> doGetUsers( - @RequestParam(value = "uname", required = false) List<String> unames, - @RequestParam(value = "jid", required = false) List<String> jids) { + @RequestParam(value = "uname", required = false) List<String> unames) { List<com.juick.User> users = new ArrayList<>(); if (unames != null) { @@ -57,13 +56,6 @@ public class Users { users.addAll(userService.getUsersByName(unames)); } - if (jids != null) { - jids.removeIf(WebUtils::isNotJid); - - if (!jids.isEmpty() && jids.size() < 20) - users.addAll(userService.getUsersByJID(jids)); - } - if (!users.isEmpty()) return users; if (!UserUtils.getCurrentUser().isAnonymous()) { diff --git a/juick-core/src/main/java/com/juick/User.java b/juick-core/src/main/java/com/juick/User.java index ed5ac021..478c6a48 100644 --- a/juick-core/src/main/java/com/juick/User.java +++ b/juick-core/src/main/java/com/juick/User.java @@ -40,7 +40,6 @@ public class User implements Serializable { private String name; private Object avatar; private String fullName; - private String jid; private int messagesCount; private String authHash; private boolean banned; @@ -71,7 +70,6 @@ public class User implements Serializable { .append("uid", uid) .append("name", name) .append("fullName", fullName) - .append("jid", jid) .append("messagesCount", messagesCount) .append("lang", lang) .append("banned", banned) @@ -108,15 +106,6 @@ public class User implements Serializable { this.fullName = fullName; } - @JsonProperty("jid") - public String getJid() { - return jid; - } - - public void setJid(String jid) { - this.jid = jid; - } - @XmlTransient @JsonIgnore public String getAuthHash() { diff --git a/juick-server-core/src/main/java/com/juick/server/helpers/AnonymousUser.java b/juick-server-core/src/main/java/com/juick/server/helpers/AnonymousUser.java index d1e13e78..122bbe29 100644 --- a/juick-server-core/src/main/java/com/juick/server/helpers/AnonymousUser.java +++ b/juick-server-core/src/main/java/com/juick/server/helpers/AnonymousUser.java @@ -30,7 +30,6 @@ public final class AnonymousUser extends User { super.setName(getName()); super.setAvatar(getAvatar()); super.setFullName(getFullName()); - super.setJid(getJid()); super.setMessagesCount(getMessagesCount()); super.setAuthHash(getAuthHash()); super.setBanned(isBanned()); @@ -59,11 +58,6 @@ public final class AnonymousUser extends User { } @Override - public String getJid() { - return "anonym@localhost"; - } - - @Override public String getAuthHash() { return null; } @@ -116,10 +110,6 @@ public final class AnonymousUser extends User { } @Override - public void setJid(String jid) { - } - - @Override public void setAuthHash(String authHash) { } diff --git a/juick-server-core/src/main/java/com/juick/service/UserService.java b/juick-server-core/src/main/java/com/juick/service/UserService.java index 2da643d8..6ca6fb98 100644 --- a/juick-server-core/src/main/java/com/juick/service/UserService.java +++ b/juick-server-core/src/main/java/com/juick/service/UserService.java @@ -57,8 +57,6 @@ public interface UserService { List<User> getUsersByID(Collection<Integer> uids); - List<com.juick.User> getUsersByJID(Collection<String> jids); - List<String> getJIDsbyUID(int uid); int getUIDbyJID(String jid); diff --git a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java index 9aa82559..8adab346 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java @@ -238,26 +238,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional(readOnly = true) @Override - public List<com.juick.User> getUsersByJID(final Collection<String> jids) { - if (CollectionUtils.isEmpty(jids)) - return Collections.emptyList(); - - return getNamedParameterJdbcTemplate().query( - "SELECT users.id, users.nick, jids.jid FROM users " + - " INNER JOIN jids ON jids.user_id = users.id " + - " WHERE jids.jid IN (:jids)", - new MapSqlParameterSource("jids", jids), - (rs, rowNum) -> { - com.juick.User user = new com.juick.User(); - user.setUid(rs.getInt(1)); - user.setName(rs.getString(2)); - user.setJid(rs.getString(3)); - return user; - }); - } - - @Transactional(readOnly = true) - @Override public List<String> getJIDsbyUID(final int uid) { return getJdbcTemplate().queryForList("SELECT jid FROM jids WHERE user_id = ? AND active = 1", String.class, uid); } diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java index 44755174..f0bac1f4 100644 --- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java +++ b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java @@ -583,16 +583,16 @@ public class JuickBot implements StanzaListener, AutoCloseable { String retValUpdated; if (input[0].toLowerCase().equals("on")) { newStatus = UserService.ActiveStatus.Active; - retValUpdated = "Notifications are activated for " + user.getJid(); + retValUpdated = "Notifications are activated for " + from.toEscapedString(); } else { newStatus = UserService.ActiveStatus.Inactive; - retValUpdated = "Notifications are disabled for " + user.getJid(); + retValUpdated = "Notifications are disabled for " + from.toEscapedString(); } if (userService.setActiveStatusForJID(from.toEscapedString(), newStatus)) { return retValUpdated; } else { - return String.format("Subscriptions status for %s was not changed", user.getJid()); + return String.format("Subscriptions status for %s was not changed", from.toEscapedString()); } } @UserCommand(pattern = "^\\@([^\\s\\n\\+]+)(\\+?)$", |