aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/MessagesServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index b3b51bcc..eee40512 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2021, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -334,8 +334,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isReadOnly(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT readonly FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -345,8 +345,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isSubscribed(final int uid, final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT 1 FROM subscr_messages WHERE suser_id = ? AND message_id = ?",
- new Object[]{uid, mid},
- Integer.class);
+ Integer.class,
+ uid, mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -356,8 +356,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public int getMessagePrivacy(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT privacy FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return list.isEmpty() ? -4 : list.get(0);
}
@@ -473,13 +473,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
List<User> list = getJdbcTemplate().query(
"SELECT messages.user_id, users.nick "
+ "FROM messages INNER JOIN users ON messages.user_id = users.id WHERE messages.message_id = ?",
- new Object[]{mid},
(rs, num) -> {
User res = new User();
res.setUid(rs.getInt(1));
res.setName(rs.getString(2));
return res;
- });
+ },
+ mid);
return list.isEmpty() ?
null : list.get(0);