From 54a6f6a3189cf613d2797feedd3ee7b3fc4ce5f8 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:02:14 +0530 Subject: [PATCH 01/10] Add power level tag spec --- proposals/0000-power-level-tag.md | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 proposals/0000-power-level-tag.md diff --git a/proposals/0000-power-level-tag.md b/proposals/0000-power-level-tag.md new file mode 100644 index 00000000000..2b77bbe320f --- /dev/null +++ b/proposals/0000-power-level-tag.md @@ -0,0 +1,86 @@ +### MSC0000 Power Level Tags + +Currently permissions in a certain room are handle via `m.room.power_levels`. A power level is an integer value, bigger the integer bigger the power. When we assign power level to a user we gave them power represented as integer value. This integer value is abstract and does not tell what kind of power it represent. Currently spec only suggest mapping abstract integer value to idea as: 0 - 49 to User, 50 - 99 to Moderator - 100 to Admin. This suggestion limits the wide range of power level integers to only three idea's. + +This MSC propose tags for power levels. A tag represent a configurable information that can be tagged to any power level integer. This configurable information will give an idea of what a power level is when presented to user in graphical user interface. This will enhance the experience of managing permission as now power level can be able to represent the wide range of idea's. As power level can be assigned to users, we can also display room member by associating idea of power in room timeline and member list. This association will enhance the experience as tag will represent responsibility's of members at glance. + +## Proposal + +### What is Tag? +A Tag have three properties: `"name"`, `"color"` and `"icon"`. +```json +{ + "name": "Admin", + "color": { + "on_light": "#023020", + "on_dark": "#90EE90" + }, + "icon": { + "url": "mxc:abc", + "info": { + "h": 152, + "mimetype": "image/webp", + "size": 30001, + "w": 152 + } + } +} +``` +* `"name"` For what a tag represent. **Required**. +* `"color"` Color of tag. To create graphical emphasis and distinction between tags. (*Optional*) + - `"on_light"` Tag color for lighter background. + - `"on_dark"` Tag color for darker background. +* `"icon"` To display graphical representation of tags name. (*Optional*) + +### Attaching Tag to Power Level +Tag can be attached to a power level by send a state event with key as `m.room.power_level_tag` and state key as value of power level. +```json +{ + "type": "m.room.power_level_tag", + "state_key": "100", + "content": { + "name": "Admin", + "color": { + "on_light": "#023020", + "on_dark": "#90EE90" + }, + "icon": { + "url": "mxc://admin_icon", + "info": { + "h": 152, + "mimetype": "image/webp", + "size": 30001, + "w": 152 + } + } + } +} +``` + +### Deleting a Tag +A tag can be deleted by clearing all content from it's state event. + +### How it fit with existing system? +If a room does not have any `m.room.power_level_tag` events client can fallback to suggest 0-49 as Default, 50-99 as Mod and 100 as Admin or alternatively create tag automatically as Default for 0, Mod for 50 and 100 for Admin. + +#### What if we have power level with undefined tag? +If a power level is not defined client can consider to display it with the lower defined power level tag. If there is no lower defined tag, client can consider displaying tag defined with `m.room.power_level_tag` state event + state key as `"state_key": ""`, if no such event find client can display it power level itself or with the way of it's own choice. + +### What else it fix? +This will also fix problem defined in [MSC3915: Owner power level](https://github.com/matrix-org/matrix-spec-proposals/blob/matthew/owner-pl/proposals/3915-owner-power-level.md). + +## Alternatives + +None? + +## Security considerations + +None? + +## Unstable prefix + +TODO + +## Dependencies + +None? From 7ad4871bd801ab0351482de8d8658d43ed3fe929 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:04:05 +0530 Subject: [PATCH 02/10] Add msc number --- proposals/{0000-power-level-tag.md => 3949-power-level-tag.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename proposals/{0000-power-level-tag.md => 3949-power-level-tag.md} (99%) diff --git a/proposals/0000-power-level-tag.md b/proposals/3949-power-level-tag.md similarity index 99% rename from proposals/0000-power-level-tag.md rename to proposals/3949-power-level-tag.md index 2b77bbe320f..282da5f2cb8 100644 --- a/proposals/0000-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -1,4 +1,4 @@ -### MSC0000 Power Level Tags +### MSC3949 Power Level Tags Currently permissions in a certain room are handle via `m.room.power_levels`. A power level is an integer value, bigger the integer bigger the power. When we assign power level to a user we gave them power represented as integer value. This integer value is abstract and does not tell what kind of power it represent. Currently spec only suggest mapping abstract integer value to idea as: 0 - 49 to User, 50 - 99 to Moderator - 100 to Admin. This suggestion limits the wide range of power level integers to only three idea's. From f72de475ceb6c78c085626a48b6d7f809d32a5a4 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:37:47 +0530 Subject: [PATCH 03/10] Wrap line to 100 characters --- proposals/3949-power-level-tag.md | 47 ++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index 282da5f2cb8..65e6ab4950f 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -1,13 +1,26 @@ ### MSC3949 Power Level Tags -Currently permissions in a certain room are handle via `m.room.power_levels`. A power level is an integer value, bigger the integer bigger the power. When we assign power level to a user we gave them power represented as integer value. This integer value is abstract and does not tell what kind of power it represent. Currently spec only suggest mapping abstract integer value to idea as: 0 - 49 to User, 50 - 99 to Moderator - 100 to Admin. This suggestion limits the wide range of power level integers to only three idea's. - -This MSC propose tags for power levels. A tag represent a configurable information that can be tagged to any power level integer. This configurable information will give an idea of what a power level is when presented to user in graphical user interface. This will enhance the experience of managing permission as now power level can be able to represent the wide range of idea's. As power level can be assigned to users, we can also display room member by associating idea of power in room timeline and member list. This association will enhance the experience as tag will represent responsibility's of members at glance. +Currently permissions in a certain room are handle via `m.room.power_levels`. A power level is an +integer value, bigger the integer bigger the power. When we assign power level to a user we gave +them power represented as integer value. This integer value is abstract and does not tell what kind +of power it represent. Currently spec only suggest mapping abstract integer value to idea as: 0 - 49 +to User, 50 - 99 to Moderator - 100 to Admin. This suggestion limits the wide range of power level +integers to only three idea's. + +This MSC propose tags for power levels. A tag represent a configurable information that can be +tagged to any power level integer. This configurable information will give an idea of what a power +level is when presented to user in graphical user interface. This will enhance the experience of +managing permission as now power level can be able to represent the wide range of idea's. As power +level can be assigned to users, we can also display room member by associating idea of power in room +timeline and member list. This association will enhance the experience as tag will represent +responsibility's of members at glance. ## Proposal ### What is Tag? + A Tag have three properties: `"name"`, `"color"` and `"icon"`. + ```json { "name": "Admin", @@ -26,14 +39,18 @@ A Tag have three properties: `"name"`, `"color"` and `"icon"`. } } ``` -* `"name"` For what a tag represent. **Required**. -* `"color"` Color of tag. To create graphical emphasis and distinction between tags. (*Optional*) + +- `"name"` For what a tag represent. **Required**. +- `"color"` Color of tag. To create graphical emphasis and distinction between tags. (_Optional_) - `"on_light"` Tag color for lighter background. - `"on_dark"` Tag color for darker background. -* `"icon"` To display graphical representation of tags name. (*Optional*) +- `"icon"` To display graphical representation of tags name. (_Optional_) ### Attaching Tag to Power Level -Tag can be attached to a power level by send a state event with key as `m.room.power_level_tag` and state key as value of power level. + +Tag can be attached to a power level by send a state event with key as `m.room.power_level_tag` and +state key as value of power level. + ```json { "type": "m.room.power_level_tag", @@ -58,16 +75,26 @@ Tag can be attached to a power level by send a state event with key as `m.room.p ``` ### Deleting a Tag + A tag can be deleted by clearing all content from it's state event. ### How it fit with existing system? -If a room does not have any `m.room.power_level_tag` events client can fallback to suggest 0-49 as Default, 50-99 as Mod and 100 as Admin or alternatively create tag automatically as Default for 0, Mod for 50 and 100 for Admin. + +If a room does not have any `m.room.power_level_tag` events client can fallback to suggest 0-49 as +Default, 50-99 as Mod and 100 as Admin or alternatively create tag automatically as Default for 0, +Mod for 50 and 100 for Admin. #### What if we have power level with undefined tag? -If a power level is not defined client can consider to display it with the lower defined power level tag. If there is no lower defined tag, client can consider displaying tag defined with `m.room.power_level_tag` state event + state key as `"state_key": ""`, if no such event find client can display it power level itself or with the way of it's own choice. + +If a power level is not defined client can consider to display it with the lower defined power level +tag. If there is no lower defined tag, client can consider displaying tag defined with +`m.room.power_level_tag` state event + state key as `"state_key": ""`, if no such event find client +can display it power level itself or with the way of it's own choice. ### What else it fix? -This will also fix problem defined in [MSC3915: Owner power level](https://github.com/matrix-org/matrix-spec-proposals/blob/matthew/owner-pl/proposals/3915-owner-power-level.md). + +This will also fix problem defined in [MSC3915: Owner power +level](https://github.com/matrix-org/matrix-spec-proposals/blob/matthew/owner-pl/proposals/3915-owner-power-level.md). ## Alternatives From a35c9d3d60fb5bca51f4d7abc6f0b003a7ab3666 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:51:14 +0530 Subject: [PATCH 04/10] move proposal text under proposal heading --- proposals/3949-power-level-tag.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index 65e6ab4950f..d36dd014006 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -4,9 +4,11 @@ Currently permissions in a certain room are handle via `m.room.power_levels`. A integer value, bigger the integer bigger the power. When we assign power level to a user we gave them power represented as integer value. This integer value is abstract and does not tell what kind of power it represent. Currently spec only suggest mapping abstract integer value to idea as: 0 - 49 -to User, 50 - 99 to Moderator - 100 to Admin. This suggestion limits the wide range of power level +to User, 50 - 99 to Moderator and 100 to Admin. This suggestion limits the wide range of power level integers to only three idea's. +## Proposal + This MSC propose tags for power levels. A tag represent a configurable information that can be tagged to any power level integer. This configurable information will give an idea of what a power level is when presented to user in graphical user interface. This will enhance the experience of @@ -15,8 +17,6 @@ level can be assigned to users, we can also display room member by associating i timeline and member list. This association will enhance the experience as tag will represent responsibility's of members at glance. -## Proposal - ### What is Tag? A Tag have three properties: `"name"`, `"color"` and `"icon"`. From 149131c6394f5591e3558f9dd48fd0c9305985b6 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:57:12 +0530 Subject: [PATCH 05/10] change color property to hex value previously it has light and dark color, removing them as per feedback and recommend client to tune color client side for accessibility purposes. --- proposals/3949-power-level-tag.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index d36dd014006..e2c5ed7f474 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -24,10 +24,7 @@ A Tag have three properties: `"name"`, `"color"` and `"icon"`. ```json { "name": "Admin", - "color": { - "on_light": "#023020", - "on_dark": "#90EE90" - }, + "color": "#000000", "icon": { "url": "mxc:abc", "info": { @@ -41,9 +38,7 @@ A Tag have three properties: `"name"`, `"color"` and `"icon"`. ``` - `"name"` For what a tag represent. **Required**. -- `"color"` Color of tag. To create graphical emphasis and distinction between tags. (_Optional_) - - `"on_light"` Tag color for lighter background. - - `"on_dark"` Tag color for darker background. +- `"color"` Color as `hex` value. To create graphical emphasis and distinction between tags. (_Optional_) - `"icon"` To display graphical representation of tags name. (_Optional_) ### Attaching Tag to Power Level @@ -57,10 +52,7 @@ state key as value of power level. "state_key": "100", "content": { "name": "Admin", - "color": { - "on_light": "#023020", - "on_dark": "#90EE90" - }, + "color": "#000000", "icon": { "url": "mxc://admin_icon", "info": { From cf0ea022c784da13cd5fc04e765138463dd7a127 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:01:37 +0530 Subject: [PATCH 06/10] change icon `url` property to `key` to accommodate it for emojis --- proposals/3949-power-level-tag.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index e2c5ed7f474..01461f8fc20 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -26,7 +26,7 @@ A Tag have three properties: `"name"`, `"color"` and `"icon"`. "name": "Admin", "color": "#000000", "icon": { - "url": "mxc:abc", + "key": "", "info": { "h": 152, "mimetype": "image/webp", @@ -40,6 +40,7 @@ A Tag have three properties: `"name"`, `"color"` and `"icon"`. - `"name"` For what a tag represent. **Required**. - `"color"` Color as `hex` value. To create graphical emphasis and distinction between tags. (_Optional_) - `"icon"` To display graphical representation of tags name. (_Optional_) + - `"key"` Key can have value as mxc or emojis. `info` object should can be considered valid if `key` is mxc. ### Attaching Tag to Power Level @@ -54,7 +55,7 @@ state key as value of power level. "name": "Admin", "color": "#000000", "icon": { - "url": "mxc://admin_icon", + "key": "mxc://admin_icon", "info": { "h": 152, "mimetype": "image/webp", From 0cd39ad8e44ea77ca53229fd64e07ff111bab079 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:18:40 +0530 Subject: [PATCH 07/10] render tag definition as table --- proposals/3949-power-level-tag.md | 35 +++++++++++++------------------ 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index 01461f8fc20..c7d3017587b 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -17,30 +17,23 @@ level can be assigned to users, we can also display room member by associating i timeline and member list. This association will enhance the experience as tag will represent responsibility's of members at glance. -### What is Tag? +### Tag Definition -A Tag have three properties: `"name"`, `"color"` and `"icon"`. +A Tag have three properties: `name`, `color` and `icon` as described in table: -```json -{ - "name": "Admin", - "color": "#000000", - "icon": { - "key": "", - "info": { - "h": 152, - "mimetype": "image/webp", - "size": 30001, - "w": 152 - } - } -} -``` +#### Tag +| Property | Type | Description | +|----------|---------|----------------------------------------------------------------------------| +| name | string | Name of the tag. **Required** | +| color | string | Color as `hex` value. For graphical emphasis and distinction between tags. | +| icon | TagIcon | Graphical representation of tags name. | + +#### TagIcon +| Property | Type | Description | +|----------|-----------|-------------------------------------------------------------------------| +| key | string | This can be emoji similar to key in `m.reaction` or an `mxc` for image. | +| info | ImageInfo | Standard `info` object for image if key is `mxc`. | -- `"name"` For what a tag represent. **Required**. -- `"color"` Color as `hex` value. To create graphical emphasis and distinction between tags. (_Optional_) -- `"icon"` To display graphical representation of tags name. (_Optional_) - - `"key"` Key can have value as mxc or emojis. `info` object should can be considered valid if `key` is mxc. ### Attaching Tag to Power Level From 4184d5155ce2a52445eeb5a69f971a936a312347 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:51:25 +0530 Subject: [PATCH 08/10] use single state event for all tags instead of per power level it is much easier to manage power level in single event as we do not have to send multiple state events. --- proposals/3949-power-level-tag.md | 56 ++++++++++++++++++------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index c7d3017587b..b1f1865eba6 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -26,7 +26,7 @@ A Tag have three properties: `name`, `color` and `icon` as described in table: |----------|---------|----------------------------------------------------------------------------| | name | string | Name of the tag. **Required** | | color | string | Color as `hex` value. For graphical emphasis and distinction between tags. | -| icon | TagIcon | Graphical representation of tags name. | +| icon | TagIcon | Graphical representation of tag. | #### TagIcon | Property | Type | Description | @@ -35,47 +35,55 @@ A Tag have three properties: `name`, `color` and `icon` as described in table: | info | ImageInfo | Standard `info` object for image if key is `mxc`. | -### Attaching Tag to Power Level +### Saving Tags -Tag can be attached to a power level by send a state event with key as `m.room.power_level_tag` and -state key as value of power level. +Tags can be saved by sending a state event of type `m.room.power_level_tags` with `state_key` as +empty string. The content will be a map of power level integer to Tag. ```json { - "type": "m.room.power_level_tag", + "type": "m.room.power_level_tags", "state_key": "100", "content": { - "name": "Admin", - "color": "#000000", - "icon": { - "key": "mxc://admin_icon", - "info": { - "h": 152, - "mimetype": "image/webp", - "size": 30001, - "w": 152 + "100": { + "name": "Admin", + "color": "#000000", + "icon": { + "key": "mxc://admin_icon", + "info": { + "h": 152, + "mimetype": "image/webp", + "size": 30001, + "w": 152 + } } + }, + "50": { + "name": "Moderator" + }, + "38": { + "name": "Bot", + "icon": { + "key": "🤖" + } + }, + "0": { + "name": "Default" } } } ``` -### Deleting a Tag - -A tag can be deleted by clearing all content from it's state event. - ### How it fit with existing system? -If a room does not have any `m.room.power_level_tag` events client can fallback to suggest 0-49 as -Default, 50-99 as Mod and 100 as Admin or alternatively create tag automatically as Default for 0, -Mod for 50 and 100 for Admin. +If a room does not have any `m.room.power_level_tags` event client can fallback to suggest 0-49 as +Default, 50-99 as Mod and 100 as Admin, alternatively client can create default content client side +by following the fallback strategy. #### What if we have power level with undefined tag? If a power level is not defined client can consider to display it with the lower defined power level -tag. If there is no lower defined tag, client can consider displaying tag defined with -`m.room.power_level_tag` state event + state key as `"state_key": ""`, if no such event find client -can display it power level itself or with the way of it's own choice. +tag. If there is no lower defined tag, client can display it with the way of it's own choice. ### What else it fix? From 3a125581f65e5e08a204e310ca4eacc40e9c9f17 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:51:41 +0530 Subject: [PATCH 09/10] add unstable prefix --- proposals/3949-power-level-tag.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index b1f1865eba6..775c13f9615 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -100,7 +100,7 @@ None? ## Unstable prefix -TODO +Implementations SHOULD refer to `m.room.power_level_tags` as `in.cinny.room.power_level_tags`. ## Dependencies From e23a96c3e43214de23005a3775f2d5ada3fd4859 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Mon, 7 Apr 2025 07:45:55 +0530 Subject: [PATCH 10/10] fix example code state key value --- proposals/3949-power-level-tag.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/3949-power-level-tag.md b/proposals/3949-power-level-tag.md index 775c13f9615..e37bf14940c 100644 --- a/proposals/3949-power-level-tag.md +++ b/proposals/3949-power-level-tag.md @@ -43,7 +43,7 @@ empty string. The content will be a map of power level integer to Tag. ```json { "type": "m.room.power_level_tags", - "state_key": "100", + "state_key": "", "content": { "100": { "name": "Admin",