-
-
Notifications
You must be signed in to change notification settings - Fork 829
Don't rely on room members to query power levels #2145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm - isn't the server at fault if it hasn't sent us our own member event? If so, briefly telling you you can't send a message feels like a reasonable failure mode here, especially given this will still sometimes be wrong (eg. if you're an admin and only admins can post).
const me = room.getMember(MatrixClientPeg.get().getUserId()); | ||
if (me) { | ||
return room.currentState.maySendMessage(me.userId); | ||
} else if(room.getMyMembership() === 'join') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: consistent spacing
no, we've concluded that for LL the server is entitled not to send you your own membership event (which is after all redundant and a waste of bandwidth). |
Actually, we have all the information we need in the power levels state event. We just shouldn't rely on having a member object. My bad, I'll change it. |
as it is always are of the syncing user's membership in case of lazy loading members
49e8ce1
to
be66f98
Compare
ready for another look |
How do you know your own display name and avatar URL in that room if you don't have your own membership event? |
@dbkr With #2132 we're now waiting for the members to load before showing the own avatar in the composer. I'm unsure where we currently display the own display name. This isn't great as it is, as the layout of the composer without the avatar rendered is currently a bit broken (everything moves to the left). We could easily solve this though by reverting to I'll make a task to improve this experience, but is probably independent of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need the user's display name if they send a message in the room in order to display the local-echo event in the timeline until the member event arrives (we could fall back to their profile info but the global profile isn't necessarily the same as the profile in a given room).
Anyway, this lgtm.
Never mind, not sure about the local echo. Will check. |
Fixes element-hq/element-web#7264
Requires matrix-org/matrix-js-sdk#717