Browse Source

hide system message "You voted on the poll ..."

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 years ago
parent
commit
c7014fd063

+ 9 - 0
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -2593,6 +2593,11 @@ class ChatController(args: Bundle) :
 
                 chatMessageIterator.remove()
             }
+
+            // delete poll system messages
+            else if (isPollVotedMessage(currentMessage)) {
+                chatMessageIterator.remove()
+            }
         }
         return chatMessageMap.values.toList()
     }
@@ -2608,6 +2613,10 @@ class ChatController(args: Bundle) :
             currentMessage.value.systemMessageType == ChatMessage.SystemMessageType.REACTION_REVOKED
     }
 
+    private fun isPollVotedMessage(currentMessage: MutableMap.MutableEntry<String, ChatMessage>): Boolean {
+        return currentMessage.value.systemMessageType == ChatMessage.SystemMessageType.POLL_VOTED
+    }
+
     private fun startACall(isVoiceOnlyCall: Boolean, callWithoutNotification: Boolean) {
         if (currentConversation?.canStartCall == false && currentConversation?.hasCall == false) {
             Toast.makeText(context, R.string.startCallForbidden, Toast.LENGTH_LONG).show()