Resolve "Reduce / hide the room creation status messages"

This commit is contained in:
N Pex 2023-04-26 11:04:05 +00:00
parent ce780ea3b0
commit 0905bc34c0
3 changed files with 69 additions and 17 deletions

View file

@ -38,13 +38,23 @@ npm run build
npm run lint
```
### Customize configuration
### Customize build configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
## Theming
You can do simple theming by setting values in the configuration file, see below.
# Sticker short codes - To enable sticker short codes, follow these steps:
## Configuration file
The app loads runtime configutation from the server at "./config.json" and merges that with the default values in "assets/config.json".
The following values can be set via the config file:
* **logo** - An url or base64-encoded image data url that represents the app logotype.
* **accentColor** - The accent color of the app UI.
* **show_status_messages** - Whether to show only user joins/leaves and display name updates, or the full range of room status updates. Possible values are "never" (only the above), "moderators" (moderators will see all status updates) or "always" (everyone will see all status updates). Defaults to "always".
### Sticker short codes - To enable sticker short codes, follow these steps:
* Run the "create sticker config" script using "npm run create-sticker-config <path-to-sticker-packs>"
* Insert the resulting config blob into the "shortCodeStickers" value of the config file (assets/config.json)
* Rearrange order of sticker packs by editing the config blob above.

View file

@ -44,5 +44,6 @@
}
],
"experimental_voice_mode": true,
"experimental_read_only_room": true
"experimental_read_only_room": true,
"show_status_messages": "never"
}

View file

@ -94,6 +94,15 @@ export default {
CreatePollDialog,
},
methods: {
showOnlyUserStatusMessages() {
// We say that if you can redact events, you are allowed to create polls.
// NOTE!!! This assumes that there is a property named "room" on THIS.
const me = this.room && this.room.getMember(this.$matrix.currentUserId);
let isModerator =
me && this.room.currentState && this.room.currentState.hasSufficientPowerLevelFor("redact", me.powerLevel);
const show = this.$config.show_status_messages;
return show === "never" || (show === "moderators" && !isModerator)
},
showDayMarkerBeforeEvent(event) {
const idx = this.events.indexOf(event);
if (idx <= 0) {
@ -132,10 +141,12 @@ export default {
return ContactKicked;
}
return ContactLeave;
} else if (event.getContent().membership == "invite") {
return ContactInvited;
} else if (event.getContent().membership == "ban") {
return ContactBanned;
} else if (!this.showOnlyUserStatusMessages()) {
if (event.getContent().membership == "invite") {
return ContactInvited;
} else if (event.getContent().membership == "ban") {
return ContactBanned;
}
}
break;
@ -203,34 +214,64 @@ export default {
}
case "m.room.create":
return RoomCreated;
if (!this.showOnlyUserStatusMessages()) {
return RoomCreated;
}
break;
case "m.room.canonical_alias":
return RoomAliased;
if (!this.showOnlyUserStatusMessages()) {
return RoomAliased;
}
break;
case "m.room.name":
return RoomNameChanged;
if (!this.showOnlyUserStatusMessages()) {
return RoomNameChanged;
}
break;
case "m.room.topic":
return RoomTopicChanged;
if (!this.showOnlyUserStatusMessages()) {
return RoomTopicChanged;
}
break;
case "m.room.avatar":
return RoomAvatarChanged;
if (!this.showOnlyUserStatusMessages()) {
return RoomAvatarChanged;
}
break;
case "m.room.history_visibility":
return RoomHistoryVisibility;
if (!this.showOnlyUserStatusMessages()) {
return RoomHistoryVisibility;
}
break;
case "m.room.join_rules":
return RoomJoinRules;
if (!this.showOnlyUserStatusMessages()) {
return RoomJoinRules;
}
break;
case "m.room.power_levels":
return RoomPowerLevelsChanged;
if (!this.showOnlyUserStatusMessages()) {
return RoomPowerLevelsChanged;
}
break;
case "m.room.guest_access":
return RoomGuestAccessChanged;
if (!this.showOnlyUserStatusMessages()) {
return RoomGuestAccessChanged;
}
break;
case "m.room.encryption":
return RoomEncrypted;
if (!this.showOnlyUserStatusMessages()) {
return RoomEncrypted;
}
break;
case "m.poll.start":
case "org.matrix.msc3381.poll.start":