Show Admins and Mods in the Joined Room.
Categories
(Chat Core :: Matrix, enhancement)
Tracking
(Not tracked)
People
(Reporter: matrixisreal, Assigned: clokep, Mentored)
References
Details
Attachments
(1 file, 3 obsolete files)
2.39 KB,
patch
|
pmorris
:
review+
|
Details | Diff | Splinter Review |
Admins are users with Power level 100 and Moderators with 50. So we might map admins to founders and mods to ops.
Reporter | ||
Updated•7 years ago
|
Reporter | ||
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Comment on attachment 8883086 [details] [diff] [review] powers.patch Review of attachment 8883086 [details] [diff] [review]: ----------------------------------------------------------------- ::: chat/protocols/matrix/matrix.js @@ +23,5 @@ > MatrixParticipant.prototype = { > __proto__: GenericConvChatBuddyPrototype, > get alias() { return this._roomMember.name; }, > + get op() { return this._roomMember.powerLevel == 50; }, > + get founder() { return this._roomMember.powerLevel == 100; }, Is it possible to have other power level values? If so, how about using "50 <= this._roomMember.powerLevel < 100" for op and "this._roomMember.powerLevel >= 100" for founder? @@ +166,5 @@ > } > }); > + this._client.on("RoomMember.powerLevel", function(event, member) { > + // Has to be changed to > + // if (account.conversations.has(member.roomId)) I think you don't need to put this comment in the code. Just update the patch on the other bug when this one is merged.
Reporter | ||
Comment 3•7 years ago
|
||
> > Is it possible to have other power level values? If so, how about using "50 > <= this._roomMember.powerLevel < 100" for op and > "this._roomMember.powerLevel >= 100" for founder? > Hi, Here I quote a small description on Power levels from https://matrix.org/docs/spec/client_server/r0.2.0.html#id153 "By default all users have a power level of 0, other than the room creator whose power level defaults to 100. Users can grant other users increased power levels up to their own power level." So, power levels from "any negative number" to 100 are possible. Then, we better use "50 <= this._roomMember.powerLevel < 100". Yeah! But "this._roomMember.powerLevel == 100" is enough for founders. > I think you don't need to put this comment in the code. Just update the > patch on the other bug when this one is merged. Hmm.. Yeah, working with different bugs on the same code is a bit confusing :P
Assignee | ||
Comment 4•7 years ago
|
||
Comment on attachment 8883086 [details] [diff] [review] powers.patch Review of attachment 8883086 [details] [diff] [review]: ----------------------------------------------------------------- ::: chat/protocols/matrix/matrix.js @@ +23,5 @@ > MatrixParticipant.prototype = { > __proto__: GenericConvChatBuddyPrototype, > get alias() { return this._roomMember.name; }, > + get op() { return this._roomMember.powerLevel == 50; }, > + get founder() { return this._roomMember.powerLevel == 100; }, From the description it sounds like the only formal power level is founder. Did you just use the 50 arbitrarily or is there some other app that uses that? @@ +166,5 @@ > } > }); > + this._client.on("RoomMember.powerLevel", function(event, member) { > + // Has to be changed to > + // if (account.conversations.has(member.roomId)) Yeah, please don't include this here!
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
This implements ops/half-ops for Matrix.
I actually wrote this before realizing there was a patch on this bug already, but the implementation pretty much ended up being the same.
This:
- Implements op / half-op / founder using the "power level" concept in Matrix (https://matrix.org/docs/spec/client_server/r0.5.0#m-room-power-levels)
- Listens for the power level change event and refreshes the information, if necessary.
To test this you can connect to Matrix and join "#test:matrix.org".
Assignee | ||
Comment 6•5 years ago
|
||
Oops, eslint for an error I had missed when changing a normal function to an arrow function.
Assignee | ||
Comment 7•5 years ago
|
||
Sorry for the noise. I found a bug on this while working on subsequent patches.
Assignee | ||
Comment 8•5 years ago
|
||
Comment on attachment 9104123 [details] [diff] [review] Patch v3 Paul had expressed interest in taking a look at this.
Comment 9•5 years ago
|
||
Comment on attachment 9104123 [details] [diff] [review] Patch v3 Review of attachment 9104123 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. When logged in to a matrix chat account, I could see the yellow stars next to some participants in the room.
Assignee | ||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Pushed by clokep@gmail.com:
https://hg.mozilla.org/comm-central/rev/5f93ed1690ab
Show Admins and Mods in Matrix rooms. r=pmorris
Assignee | ||
Updated•5 years ago
|
Comment 11•4 years ago
|
||
Please note that nothing prevents someone having a powerlevel higher than 100. This is just the default for "founders". Some homeservers might have other values (or you can edit the DB to get a higher PL, but need to do so on every participating server).
So I'd have put return this._roomMember.powerLevelNorm >= 100;
.
But matrix permissions are more complex, so founder == max power level in the room might be even better. Or just "founder" as anyone who has the right to change the permissions in the room (this._roomMember.powerLevelNorm >= m.room.power_levels
, as seen set to 99 in the following example).
That said, the current implementation is fine for 99.5% of the rooms I am in, so feel free to ignore this to concentrate on more important stuff. I could try to submit a PR myself to flex the contribution pipeline.
{
"type": "m.room.power_levels",
"unsigned": {
"replaces_state": "$1576229797338615onFBj:matrix.org",
"prev_sender": "@mod1:mod1.org",
"age": 104,
"prev_content": {
<...>
},
"event_id": "$01001010001FHeaZ:mod2.net",
"origin_server_ts": 1576229992129,
"content": {
"ban": 50,
"invite": 0,
"events": {
"m.room.topic": 50,
"m.room.avatar": 50,
"im.vector.modular.widgets": 50,
"m.room.canonical_alias": 50,
"m.room.power_levels": 99,
"m.room.history_visibility": 100,
"m.room.name": 50,
"m.room.tombstone": 50,
"m.room.encryption": 50
},
"kick": 50,
"events_default": 0,
"users_default": 0,
"state_default": 50,
"redact": 50,
"users": {
"@mod2:mod2.net": 100,
"@mod1:mod1.org": 100
}
},
"state_key": "",
"sender": "@mod2:mod2.net",
"room_id": "!theroomID:matrix.org"
}
Assignee | ||
Comment 12•4 years ago
|
||
Hi Mayeul! Thanks for taking an interest in some of the Matrix work! It is nice to have someone more familiar with the Matrix internals taking a look at it.
My understanding was that "power levels" can go to whatever, but the JavaScript SDK has a concept of "normalized" power levels (see docs: https://matrix-org.github.io/matrix-js-sdk/2.4.1/module-models_room-member.html). Unfortunately the docs don't have much information, so I kind of took a guess that it would be right "most" of the time. Does that make sense?
I think you're probably correct that a founder should be someone who has "all" the powers (can ban, invite, kick, redact, etc.), but I think the way it is shown in Thunderbird isn't specific enough since it just gives a relative power (nothing, silver star, gold star, flag) next to the user's name.
If this doesn't work in specific cases I'd be all for fixing it (and we should probably file a separate bug for that)!
Thanks again for your thoughts. I hope the above makes sense.
Assignee | ||
Updated•4 years ago
|
Description
•