Skip to content

Commit

Permalink
Communication: Fix an issue with unread message count (#10245)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaRangger authored Feb 2, 2025
1 parent 923f16c commit b9c5f59
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public interface ConversationRepository extends ArtemisJpaRepository<Conversatio
FROM Conversation conv
LEFT JOIN Channel channel ON conv.id = channel.id
LEFT JOIN ConversationParticipant cp ON conv.id = cp.conversation.id AND cp.user.id = :userId
LEFT JOIN Post p ON conv.id = p.conversation.id AND (p.creationDate > cp.lastRead OR (channel.isCourseWide = TRUE AND cp.lastRead IS NULL))
LEFT JOIN Post p ON conv.id = p.conversation.id AND p.author.id <> :userId AND (p.creationDate > cp.lastRead OR (channel.isCourseWide = TRUE AND cp.lastRead IS NULL))
WHERE conv.id IN :conversationIds
AND (channel.isCourseWide = TRUE OR (conv.id = cp.conversation.id AND cp.user.id = :userId))
GROUP BY conv.id, cp.id, cp.isModerator, cp.isFavorite, cp.isHidden, cp.lastRead
Expand Down Expand Up @@ -84,6 +84,7 @@ SELECT COUNT(p.id) > 0
LEFT JOIN ConversationParticipant cp ON c.id = cp.conversation.id AND cp.user.id = :userId
LEFT JOIN Channel ch ON c.id = ch.id
WHERE c.course.id = :courseId
AND p.author.id <> :userId
AND (
p.creationDate > cp.lastRead OR
(ch.isCourseWide = TRUE AND cp.id IS NULL)
Expand Down

0 comments on commit b9c5f59

Please sign in to comment.