status-go: Community messages are ignored if sender is not known as community member
Problem
Consider a community member Bob being offline.
And another user Charlie joins the community and sends a message A.
When Bob goes online, if he receives the message A earlier than that Charlie is a community member, the message will be ignored and hidden forever.
Reproduce steps:
Alice,Bob,Charlie: create new profileAlice: create a new community “Doodles”Bob: join DoodlesBob: go offlineCharlie: join DoodlesCharlie: send a messageAto DoodlesBob: go online. Here Bob will receive 2 things:- Community has a new member
Charlie(not sure in what form it comes, will call it furthernew member) - Charlie’s message
A
- Community has a new member
❌ If Bob receives the message A earlier than new member message, it will not be processed and shown.
Implementation
We discussed 2 possible fixes for this.
Option 1. “Sign” community messages.
This is the same as we do in group chats. When one sends a message to a community, he signs is a being a community member. When a user receives a community message, even if the sender is not known as community member, we can still check the sign and show the message.
Option 2. Save original waku messages until member is received
Save all such waku messages. Check the history when a new member is known.
Acceptance Criteria
All messages of new community members are visible.
Notes
Also consider the case when a user is removed from community.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 17 (11 by maintainers)
Commits related to this issue
- test reproducing issue #3869 — committed to status-im/status-go by igor-sirotin 3 years ago
- test reproducing issue #3869 — committed to status-im/status-go by igor-sirotin 3 years ago
lol, immediate punishment for initiative 🤣
@jrainville I will unassign myself, as you told only to fix the test for now. Let me know if I should pick it up. Though I’m not sure I’m the best one to fix this 😄
@jrainville, I’ve updated the test. It fails 🙂 You can find it in
chore/issue-3869-reproduce-testbranch.I’ve removed the redundant part with second message. Instead, after
User-1joins the community and sends a message,Admin-2waits for 2 messages to arrive, butmessage Ais received earlier than community membership.NOTE: though it reproduces the bug 100% cases for me, I think it’s flaky, because we don’t force the order of received messages.
https://github.com/status-im/status-go/blob/7a90ad2598d918909b3ee867afa78e1668b609b2/protocol/communities_messenger_test.go#L2908-L2973
BTW, just recreate the test for now. No need to fix the full issue. Just do an analysis of the issue and see what would be needed to fix. Then we can determine if it’s good to work on it.
oh I see, I didn’t know that, that makes things much simpler actually on many levels.