Hide own joins for direct rooms
Move display options to a new "roomDisplayOptionsMixin". Rename (and invert) "showOnlyUserStatusMessages" to "showAllStatusMessages".
This commit is contained in:
parent
979e650f0d
commit
3630690b20
2 changed files with 34 additions and 20 deletions
|
|
@ -50,8 +50,10 @@ import RoomGuestAccessChanged from "./messages/RoomGuestAccessChanged.vue";
|
|||
import RoomEncrypted from "./messages/RoomEncrypted.vue";
|
||||
import RoomDeletionNotice from "./messages/RoomDeletionNotice.vue";
|
||||
import DebugEvent from "./messages/DebugEvent.vue";
|
||||
import roomDisplayOptionsMixin from "./roomDisplayOptionsMixin";
|
||||
|
||||
export default {
|
||||
mixins: [ roomDisplayOptionsMixin ],
|
||||
components: {
|
||||
ChatHeader,
|
||||
MessageIncomingText,
|
||||
|
|
@ -98,15 +100,6 @@ 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) {
|
||||
|
|
@ -144,6 +137,9 @@ export default {
|
|||
// We we already joined, so this must be a display name and/or avatar update!
|
||||
return ContactChanged;
|
||||
} else {
|
||||
if (event.getSender() == this.$matrix.currentUserId && !this.showOwnJoins) {
|
||||
return null;
|
||||
}
|
||||
return ContactJoin;
|
||||
}
|
||||
} else if (event.getContent().membership == "leave") {
|
||||
|
|
@ -152,7 +148,7 @@ export default {
|
|||
return ContactKicked;
|
||||
}
|
||||
return ContactLeave;
|
||||
} else if (!this.showOnlyUserStatusMessages()) {
|
||||
} else if (this.showAllStatusMessages) {
|
||||
if (event.getContent().membership == "invite") {
|
||||
return ContactInvited;
|
||||
} else if (event.getContent().membership == "ban") {
|
||||
|
|
@ -233,61 +229,61 @@ export default {
|
|||
}
|
||||
|
||||
case "m.room.create":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomCreated;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.canonical_alias":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomAliased;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.name":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomNameChanged;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.topic":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomTopicChanged;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.avatar":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomAvatarChanged;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.history_visibility":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomHistoryVisibility;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.join_rules":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomJoinRules;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.power_levels":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomPowerLevelsChanged;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.guest_access":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomGuestAccessChanged;
|
||||
}
|
||||
break;
|
||||
|
||||
case "m.room.encryption":
|
||||
if (!this.showOnlyUserStatusMessages()) {
|
||||
if (this.showAllStatusMessages) {
|
||||
return RoomEncrypted;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue