fixed a bug with the topic visit order and another one with the anyUnread
function (it needs to ignore archived topics)
This commit is contained in:
@@ -834,16 +834,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||
conn = datapool.getConnection();
|
||||
|
||||
// Build a query. The idea here is that we want to see the topic IDs of all topics within the
|
||||
// conference which (a) are not hidden and (b) have one or more messages unread by this user.
|
||||
// The need for the user's settings for both (a) and (b) necessitates the use of the LEFT JOIN
|
||||
// to topicsettings, which in turn necessitates the IFNULL guards on references to topicsettings
|
||||
// conference which (a) are not archived, (b) are not hidden and (c) have one or more messages unread
|
||||
// by this user. The need for the user's settings for both (b) and (c) necessitates the use of the LEFT
|
||||
// JOIN to topicsettings, which in turn necessitates the IFNULL guards on references to topicsettings
|
||||
// columns in the WHERE clause (as there's only a topicsettings row if the user has read anything
|
||||
// in this topic or otherwise set it).
|
||||
Statement stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("SELECT t.topicid FROM topics t LEFT JOIN topicsettings s "
|
||||
+ "ON t.topicid = s.topicid AND s.uid = ");
|
||||
sql.append(sig.realUID()).append(" WHERE t.confid = ").append(confid);
|
||||
sql.append(" AND IFNULL(s.hidden,0) = 0 AND (t.top_message - IFNULL(s.last_message,-1)) > 0 LIMIT 1;");
|
||||
sql.append(" AND t.archived = 0 AND IFNULL(s.hidden,0) = 0 "
|
||||
+ "AND (t.top_message - IFNULL(s.last_message,-1)) > 0 LIMIT 1;");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user