Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creator sees moderator as a regular user after rejoining chat #4528

Open
AntonMedviediev opened this issue Nov 13, 2024 · 5 comments · May be fixed by #4487
Open

Creator sees moderator as a regular user after rejoining chat #4528

AntonMedviediev opened this issue Nov 13, 2024 · 5 comments · May be fixed by #4487
Assignees
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@AntonMedviediev
Copy link

User1 is creator of the chat. Admin role initially.
User2 & User 3 are participants. Default role initially.

Description
Incorrect behaviour with the chat rights. Creator see user with moderator rights as a regular user in case of leaving/rejoining chat withour page reload. Also reprodusable on the Element app.

Steps to reproduce:

    1. Create group chat from User1 with some name.
    1. Send requests to User2 & User3.
    1. Accepts from User2 side.
    1. User1 assign Moderator right to User2.
    1. User1 leaves the chat and does not reload the page.
    1. User2 invites back User1.
    1. User1 accepts invitation.
    1. User1 see User2 as a regular user with powerLevel 0.
    1. User2 still see himself as a Moderator with powerLevel 50.
    1. User1 reloads the page and see User2 as a Moderator as well.
@dosubot dosubot bot added the T-Defect label Nov 13, 2024
@richvdh richvdh changed the title Creator see moderator as a regular user after rejoining chat withour page reloading Creator sees moderator as a regular user after rejoining chat Nov 14, 2024
@dbkr dbkr added S-Minor Impairs non-critical functionality or suitable workarounds exist O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Nov 18, 2024
@richvdh
Copy link
Member

richvdh commented Nov 18, 2024

This sounds like it's probably a server-side issue? Have you checked the events coming down /sync?

@richvdh richvdh added the X-Needs-Info This issue is blocked awaiting information from the reporter label Nov 18, 2024
@AntonMedviediev
Copy link
Author

This sounds like it's probably a server-side issue? Have you checked the events coming down /sync?

@richvdh on what stuff should I exactly look there?
Request about powerlevel update is in place, on 'sync' should I see something related about powerlevel update as well?

@richvdh
Copy link
Member

richvdh commented Nov 25, 2024

My mistake; can confirm it's a client-side issue.

I reproduced it. On rejoin, user 1 received the following sync response:

{
    "!FqyBUTxYXmnzHlgDGt:xps9320.sw1v.org": {
        "timeline": {
            "events": [
                {
                    "type": "m.room.history_visibility",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "history_visibility": "shared"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998985,
                    "unsigned": {
                        "membership": "join",
                        "age": 84887
                    },
                    "event_id": "$tZ-K5NAK1jK0Cq3Fo5JJMBCOVOlzi2hNYh_fToYcBNY"
                },
                {
                    "type": "m.room.guest_access",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "guest_access": "can_join"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998986,
                    "unsigned": {
                        "membership": "join",
                        "age": 84886
                    },
                    "event_id": "$fP_uk42It3BfeKjmPEIqU42Vyarwte2AXgD-V3w3GpY"
                },
                {
                    "type": "m.room.encryption",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "algorithm": "m.megolm.v1.aes-sha2"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998987,
                    "unsigned": {
                        "membership": "join",
                        "age": 84885
                    },
                    "event_id": "$Xaj_LKCeR1GG27NQr_73xHHfgzEMC8pkXpoPXEhBDtk"
                },
                {
                    "type": "m.room.name",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "name": "4528test"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998988,
                    "unsigned": {
                        "membership": "join",
                        "age": 84884
                    },
                    "event_id": "$_LUbuj4akGU5lOK6vV3eNk2p8xmWi2TUrSD1THdKZwg"
                },
                {
                    "type": "m.room.member",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "displayname": "t",
                        "membership": "invite"
                    },
                    "state_key": "@t:xps9320.sw1v.org",
                    "origin_server_ts": 1732542006781,
                    "unsigned": {
                        "membership": "join",
                        "age": 77091
                    },
                    "event_id": "$NhZLaAuFgfNaLw55uvrMplz3uLZVjbwwwGORVRlZFnY"
                },
                {
                    "type": "m.room.member",
                    "sender": "@t:xps9320.sw1v.org",
                    "content": {
                        "displayname": "t",
                        "membership": "join"
                    },
                    "state_key": "@t:xps9320.sw1v.org",
                    "origin_server_ts": 1732542033895,
                    "unsigned": {
                        "replaces_state": "$NhZLaAuFgfNaLw55uvrMplz3uLZVjbwwwGORVRlZFnY",
                        "prev_content": {
                            "displayname": "t",
                            "membership": "invite"
                        },
                        "prev_sender": "@a:xps9320.sw1v.org",
                        "membership": "join",
                        "age": 49977
                    },
                    "event_id": "$nS3DLK27BeY3Ij3_RopYIiOuI_4TYKpEuIivPiPV3IU"
                },
                {
                    "type": "m.room.power_levels",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "users": {
                            "@a:xps9320.sw1v.org": 100,
                            "@t:xps9320.sw1v.org": 50
                        },
                        "users_default": 0,
                        "events": {
                            "m.room.name": 50,
                            "m.room.power_levels": 100,
                            "m.room.history_visibility": 100,
                            "m.room.canonical_alias": 50,
                            "m.room.avatar": 50,
                            "m.room.tombstone": 100,
                            "m.room.server_acl": 100,
                            "m.room.encryption": 100
                        },
                        "events_default": 0,
                        "state_default": 50,
                        "ban": 50,
                        "kick": 50,
                        "redact": 50,
                        "invite": 0,
                        "historical": 100
                    },
                    "state_key": "",
                    "origin_server_ts": 1732542042356,
                    "unsigned": {
                        "replaces_state": "$RovtugkLGtVZoryQZcWg47yd8S7LFQ9raYJTPCSvyVg",
                        "prev_content": {
                            "users": {
                                "@a:xps9320.sw1v.org": 100
                            },
                            "users_default": 0,
                            "events": {
                                "m.room.name": 50,
                                "m.room.power_levels": 100,
                                "m.room.history_visibility": 100,
                                "m.room.canonical_alias": 50,
                                "m.room.avatar": 50,
                                "m.room.tombstone": 100,
                                "m.room.server_acl": 100,
                                "m.room.encryption": 100
                            },
                            "events_default": 0,
                            "state_default": 50,
                            "ban": 50,
                            "kick": 50,
                            "redact": 50,
                            "invite": 0,
                            "historical": 100
                        },
                        "prev_sender": "@a:xps9320.sw1v.org",
                        "membership": "join",
                        "age": 41516
                    },
                    "event_id": "$DT1St7Up-zkK7lUzlI2qi1TerO2Ap_D4E96HwwN4YZM"
                },
                {
                    "type": "m.room.member",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "membership": "leave"
                    },
                    "state_key": "@a:xps9320.sw1v.org",
                    "origin_server_ts": 1732542059677,
                    "unsigned": {
                        "replaces_state": "$fKN7aqfnKb3RNepIg8vYDLYMqD0oUa6PxsHNssEAH38",
                        "prev_content": {
                            "displayname": "a",
                            "membership": "join"
                        },
                        "prev_sender": "@a:xps9320.sw1v.org",
                        "membership": "leave",
                        "age": 24195
                    },
                    "event_id": "$a4uakRF_VxR6scBaAoLghSGB3pQJsG-wrTDDQ4cRFD4"
                },
                {
                    "type": "m.room.member",
                    "sender": "@t:xps9320.sw1v.org",
                    "content": {
                        "displayname": "a",
                        "membership": "invite"
                    },
                    "state_key": "@a:xps9320.sw1v.org",
                    "origin_server_ts": 1732542077314,
                    "unsigned": {
                        "replaces_state": "$a4uakRF_VxR6scBaAoLghSGB3pQJsG-wrTDDQ4cRFD4",
                        "prev_content": {
                            "membership": "leave"
                        },
                        "prev_sender": "@a:xps9320.sw1v.org",
                        "membership": "invite",
                        "age": 6558
                    },
                    "event_id": "$8B1VQcS0_i0MmaJfi6Jd1BRBj2gOk1L9LHRAh7cmTCs"
                },
                {
                    "type": "m.room.member",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "displayname": "a",
                        "membership": "join"
                    },
                    "state_key": "@a:xps9320.sw1v.org",
                    "origin_server_ts": 1732542083719,
                    "unsigned": {
                        "replaces_state": "$8B1VQcS0_i0MmaJfi6Jd1BRBj2gOk1L9LHRAh7cmTCs",
                        "prev_content": {
                            "displayname": "a",
                            "membership": "invite"
                        },
                        "prev_sender": "@t:xps9320.sw1v.org",
                        "membership": "join",
                        "age": 153
                    },
                    "event_id": "$D5aMM2tDWogmPnHOvYzwA8wTe6Iv8lywSvNrYlcggvc"
                }
            ],
            "prev_batch": "s1116_138958_0_726_2365_1_1623_1804_0_1",
            "limited": true
        },
        "state": {
            "events": [
                {
                    "type": "m.room.member",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "displayname": "a",
                        "membership": "join"
                    },
                    "state_key": "@a:xps9320.sw1v.org",
                    "origin_server_ts": 1732541998850,
                    "unsigned": {
                        "age": 85022
                    },
                    "event_id": "$fKN7aqfnKb3RNepIg8vYDLYMqD0oUa6PxsHNssEAH38"
                },
                {
                    "type": "m.room.power_levels",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "users": {
                            "@a:xps9320.sw1v.org": 100
                        },
                        "users_default": 0,
                        "events": {
                            "m.room.name": 50,
                            "m.room.power_levels": 100,
                            "m.room.history_visibility": 100,
                            "m.room.canonical_alias": 50,
                            "m.room.avatar": 50,
                            "m.room.tombstone": 100,
                            "m.room.server_acl": 100,
                            "m.room.encryption": 100
                        },
                        "events_default": 0,
                        "state_default": 50,
                        "ban": 50,
                        "kick": 50,
                        "redact": 50,
                        "invite": 0,
                        "historical": 100
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998944,
                    "unsigned": {
                        "age": 84928
                    },
                    "event_id": "$RovtugkLGtVZoryQZcWg47yd8S7LFQ9raYJTPCSvyVg"
                },
                {
                    "type": "m.room.join_rules",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "join_rule": "invite"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998984,
                    "unsigned": {
                        "age": 84888
                    },
                    "event_id": "$GQsh6pV0MOgWLsfHTsILlr2-GJeFy3X9__rzGnG9Obo"
                },
                {
                    "type": "m.room.create",
                    "sender": "@a:xps9320.sw1v.org",
                    "content": {
                        "room_version": "10",
                        "creator": "@a:xps9320.sw1v.org"
                    },
                    "state_key": "",
                    "origin_server_ts": 1732541998725,
                    "unsigned": {
                        "age": 85147
                    },
                    "event_id": "$dUEgKbp9lBUwfoLtao-5yYk8z-oTBFrE66iYqdzD14M"
                }
            ]
        },
        "account_data": {
            "events": []
        },
        "ephemeral": {
            "events": []
        },
        "unread_notifications": {
            "notification_count": 0,
            "highlight_count": 0
        },
        "summary": {
            "m.joined_member_count": 2,
            "m.invited_member_count": 0
        }
    }
}

Note the two power_levels events in the response; the later one is (correctly) in timeline.

@richvdh richvdh added S-Major Severely degrades major functionality or product features, with no satisfactory workaround and removed X-Needs-Info This issue is blocked awaiting information from the reporter S-Minor Impairs non-critical functionality or suitable workarounds exist labels Nov 25, 2024
@richvdh
Copy link
Member

richvdh commented Nov 25, 2024

Also filed as element-hq/element-web#28536 since it affects Element-web

@t3chguy
Copy link
Member

t3chguy commented Nov 25, 2024

Looks like this issue was well-known by yourself @richvdh 8 years ago :D

https://github.com/matrix-org/matrix-js-sdk/blame/a99c1e96d69277226c197865d71d2f5d4ff2d03d/src/sync.js#L1215-L1220

Affects leave->rejoin due to limited timeline

Found matching logs 2024-11-25T13:41:23.885Z D Already have event $a4uakRF_VxR6scBaAoLghSGB3pQJsG-wrTDDQ4cRFD4 in limited sync - not resetting from the ones you submitted in the EW issue.

Will be fixed by MSC4222 work

@t3chguy t3chguy linked a pull request Nov 25, 2024 that will close this issue
4 tasks
@t3chguy t3chguy self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants