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:

  1. Alice, Bob, Charlie: create new profile
  2. Alice: create a new community “Doodles”
  3. Bob: join Doodles
  4. Bob: go offline
  5. Charlie: join Doodles
  6. Charlie: send a message A to Doodles
  7. Bob: go online. Here Bob will receive 2 things:
    • Community has a new member Charlie (not sure in what form it comes, will call it further new member)
    • Charlie’s message A

❌ 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

Most upvoted comments

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-test branch.

I’ve removed the redundant part with second message. Instead, after User-1 joins the community and sends a message, Admin-2waits for 2 messages to arrive, but message A is 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

lol, immediate punishment for initiative 🤣

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.