close #72: Hide unread badge when there aren't any messages
authorunknown <ajbura@gmail.com>
Thu, 26 Aug 2021 05:06:41 +0000 (10:36 +0530)
committerunknown <ajbura@gmail.com>
Thu, 26 Aug 2021 05:06:41 +0000 (10:36 +0530)
src/app/organisms/channel/ChannelViewCmdBar.jsx
src/util/matrixUtil.js

index 35dc0acee53054da6ac76aa8c48d5ae706a941b8..394357636187defcafcd1c678afb5a6082890136 100644 (file)
@@ -312,7 +312,7 @@ function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
         else if (searchTerm.match(/^[-]?(\|)$/)) searchTerm = 'neutral_face';
         else if (searchTerm.match(/^[-]?(d|D)$/)) searchTerm = 'grin';
         else if (searchTerm.match(/^[-]?(\/)$/)) searchTerm = 'frown';
-        else if (searchTerm.match(/^[-]?(p|P)$/)) searchTerm = 'stick_out_tongue';
+        else if (searchTerm.match(/^[-]?(p|P)$/)) searchTerm = 'stuck_out_tongue';
         else if (searchTerm.match(/^'[-]?(\()$/)) searchTerm = 'cry';
         else if (searchTerm.match(/^[-]?(x|X)$/)) searchTerm = 'dizzy_face';
         else if (searchTerm.match(/^[-]?(\()$/)) searchTerm = 'pleading_face';
index 056ffef439106c9680f7357afcc2ab2027680b34..1dbd5fb14dddeabf52754225f26453ab069507e3 100644 (file)
@@ -48,6 +48,7 @@ async function isRoomAliasAvailable(alias) {
 function doesRoomHaveUnread(room) {
   const userId = initMatrix.matrixClient.getUserId();
   const readUpToId = room.getEventReadUpTo(userId);
+  const supportEvents = ['m.room.message', 'm.room.encrypted', 'm.sticker'];
 
   if (room.timeline.length
     && room.timeline[room.timeline.length - 1].sender
@@ -60,7 +61,10 @@ function doesRoomHaveUnread(room) {
     const event = room.timeline[i];
 
     if (event.getId() === readUpToId) return false;
-    return true;
+
+    if (supportEvents.includes(event.getType())) {
+      return true;
+    }
   }
   return true;
 }