Add support for chatbox muting

This commit is contained in:
Natsumi
2024-09-18 17:41:40 +12:00
parent 74c4f7f981
commit b514cbedd7
4 changed files with 39 additions and 17 deletions
+34 -16
View File
@@ -3911,12 +3911,11 @@ speechSynthesis.getVoices();
var userId = this.currentUser.id; var userId = this.currentUser.id;
for (var ref of this.cachedPlayerModerations.values()) { for (var ref of this.cachedPlayerModerations.values()) {
if ( if (
ref.$isDeleted === false &&
ref.type === type && ref.type === type &&
ref.targetUserId === moderated && ref.targetUserId === moderated &&
ref.sourceUserId === userId ref.sourceUserId === userId
) { ) {
ref.$isDeleted = true; this.cachedPlayerModerations.delete(ref.id);
this.$emit('PLAYER-MODERATION:@DELETE', { this.$emit('PLAYER-MODERATION:@DELETE', {
ref, ref,
params: { params: {
@@ -3940,7 +3939,6 @@ speechSynthesis.getVoices();
targetDisplayName: '', targetDisplayName: '',
created: '', created: '',
// VRCX // VRCX
$isDeleted: false,
$isExpired: false, $isExpired: false,
// //
...json ...json
@@ -3965,10 +3963,9 @@ speechSynthesis.getVoices();
API.deleteExpiredPlayerModerations = function () { API.deleteExpiredPlayerModerations = function () {
for (var ref of this.cachedPlayerModerations.values()) { for (var ref of this.cachedPlayerModerations.values()) {
if (ref.$isDeleted || ref.$isExpired === false) { if (!ref.$isExpired) {
continue; continue;
} }
ref.$isDeleted = true;
this.$emit('PLAYER-MODERATION:@DELETE', { this.$emit('PLAYER-MODERATION:@DELETE', {
ref, ref,
params: { params: {
@@ -5663,6 +5660,14 @@ speechSynthesis.getVoices();
(await configRepository.getString('lastUserLoggedIn')) !== (await configRepository.getString('lastUserLoggedIn')) !==
null null
) { ) {
var user =
this.loginForm.savedCredentials[
this.loginForm.lastUserLoggedIn
];
if (user?.loginParmas?.endpoint) {
API.endpointDomain = user.loginParmas.endpoint;
API.websocketDomain = user.loginParmas.websocket;
}
// login at startup // login at startup
this.loginForm.loading = true; this.loginForm.loading = true;
API.getConfig() API.getConfig()
@@ -15029,17 +15034,11 @@ speechSynthesis.getVoices();
var { length } = array; var { length } = array;
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
if (array[i].id === ref.id) { if (array[i].id === ref.id) {
if (ref.$isDeleted) { Vue.set(array, i, ref);
array.splice(i, 1);
} else {
Vue.set(array, i, ref);
}
return; return;
} }
} }
if (ref.$isDeleted === false) { $app.playerModerationTable.data.push(ref);
$app.playerModerationTable.data.push(ref);
}
}); });
API.$on('PLAYER-MODERATION:@DELETE', function (args) { API.$on('PLAYER-MODERATION:@DELETE', function (args) {
@@ -17446,6 +17445,7 @@ speechSynthesis.getVoices();
isHideAvatar: false, isHideAvatar: false,
isShowAvatar: false, isShowAvatar: false,
isInteractOff: false, isInteractOff: false,
isMuteChat: false,
isFavorite: false, isFavorite: false,
$location: {}, $location: {},
@@ -17657,7 +17657,6 @@ speechSynthesis.getVoices();
var D = $app.userDialog; var D = $app.userDialog;
if ( if (
D.visible === false || D.visible === false ||
ref.$isDeleted ||
(ref.targetUserId !== D.id && (ref.targetUserId !== D.id &&
ref.sourceUserId !== this.currentUser.id) ref.sourceUserId !== this.currentUser.id)
) { ) {
@@ -17671,6 +17670,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = true; D.isHideAvatar = true;
} else if (ref.type === 'interactOff') { } else if (ref.type === 'interactOff') {
D.isInteractOff = true; D.isInteractOff = true;
} else if (ref.type === 'muteChat') {
D.isMuteChat = true;
} }
$app.$message({ $app.$message({
message: 'User moderated', message: 'User moderated',
@@ -17696,6 +17697,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = false; D.isHideAvatar = false;
} else if (ref.type === 'interactOff') { } else if (ref.type === 'interactOff') {
D.isInteractOff = false; D.isInteractOff = false;
} else if (ref.type === 'muteChat') {
D.isMuteChat = false;
} }
}); });
@@ -17813,9 +17816,9 @@ speechSynthesis.getVoices();
D.isBlock = false; D.isBlock = false;
D.isMute = false; D.isMute = false;
D.isInteractOff = false; D.isInteractOff = false;
D.isMuteChat = false;
for (var ref of API.cachedPlayerModerations.values()) { for (var ref of API.cachedPlayerModerations.values()) {
if ( if (
ref.$isDeleted === false &&
ref.targetUserId === D.id && ref.targetUserId === D.id &&
ref.sourceUserId === API.currentUser.id ref.sourceUserId === API.currentUser.id
) { ) {
@@ -17827,6 +17830,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = true; D.isHideAvatar = true;
} else if (ref.type === 'interactOff') { } else if (ref.type === 'interactOff') {
D.isInteractOff = true; D.isInteractOff = true;
} else if (ref.type === 'muteChat') {
D.isMuteChat = true;
} }
} }
} }
@@ -18832,6 +18837,18 @@ speechSynthesis.getVoices();
type: 'interactOff' type: 'interactOff'
}); });
break; break;
case 'Unmute Chatbox':
API.deletePlayerModeration({
moderated: userId,
type: 'muteChat'
});
break;
case 'Mute Chatbox':
API.sendPlayerModeration({
moderated: userId,
type: 'muteChat'
});
break;
case 'Report Hacking': case 'Report Hacking':
$app.reportUserForHacking(userId); $app.reportUserForHacking(userId);
break; break;
@@ -25186,7 +25203,8 @@ speechSynthesis.getVoices();
this.userFavoriteWorlds = []; this.userFavoriteWorlds = [];
var worldLists = []; var worldLists = [];
var params = { var params = {
ownerId: userId ownerId: userId,
n: 100
}; };
var json = await API.call('favorite/groups', { var json = await API.call('favorite/groups', {
method: 'GET', method: 'GET',
+2
View File
@@ -311,6 +311,8 @@ html
el-dropdown-item(v-else icon="el-icon-circle-close" command="Block" divided :disabled="userDialog.ref.$isModerator") {{ $t('dialog.user.actions.moderation_block') }} el-dropdown-item(v-else icon="el-icon-circle-close" command="Block" divided :disabled="userDialog.ref.$isModerator") {{ $t('dialog.user.actions.moderation_block') }}
el-dropdown-item(v-if="userDialog.isMute" icon="el-icon-microphone" command="Unmute" style="color:#F56C6C") {{ $t('dialog.user.actions.moderation_unmute') }} el-dropdown-item(v-if="userDialog.isMute" icon="el-icon-microphone" command="Unmute" style="color:#F56C6C") {{ $t('dialog.user.actions.moderation_unmute') }}
el-dropdown-item(v-else icon="el-icon-turn-off-microphone" command="Mute" :disabled="userDialog.ref.$isModerator") {{ $t('dialog.user.actions.moderation_mute') }} el-dropdown-item(v-else icon="el-icon-turn-off-microphone" command="Mute" :disabled="userDialog.ref.$isModerator") {{ $t('dialog.user.actions.moderation_mute') }}
el-dropdown-item(v-if="userDialog.isMuteChat" icon="el-icon-chat-line-round" command="Unmute Chatbox" style="color:#F56C6C") {{ $t('dialog.user.actions.moderation_enable_chatbox') }}
el-dropdown-item(v-else icon="el-icon-chat-dot-round" command="Mute Chatbox") {{ $t('dialog.user.actions.moderation_disable_chatbox') }}
el-dropdown-item(icon="el-icon-user-solid" command="Show Avatar") el-dropdown-item(icon="el-icon-user-solid" command="Show Avatar")
i.el-icon-check.el-icon--left(v-if="userDialog.isShowAvatar") i.el-icon-check.el-icon--left(v-if="userDialog.isShowAvatar")
span {{ $t('dialog.user.actions.moderation_show_avatar') }} span {{ $t('dialog.user.actions.moderation_show_avatar') }}
+2
View File
@@ -588,6 +588,8 @@
"moderation_show_avatar": "Show Avatar", "moderation_show_avatar": "Show Avatar",
"moderation_enable_avatar_interaction": "Enable Avatar Interaction", "moderation_enable_avatar_interaction": "Enable Avatar Interaction",
"moderation_disable_avatar_interaction": "Disable Avatar Interaction", "moderation_disable_avatar_interaction": "Disable Avatar Interaction",
"moderation_enable_chatbox": "Unmute Chatbox",
"moderation_disable_chatbox": "Mute Chatbox",
"edit_status": "Social Status", "edit_status": "Social Status",
"edit_language": "Language", "edit_language": "Language",
"edit_bio": "Bio", "edit_bio": "Bio",
+1 -1
View File
@@ -4,7 +4,7 @@ mixin moderationTab()
template(#tool) template(#tool)
div(style="margin:0 0 10px;display:flex;align-items:center") div(style="margin:0 0 10px;display:flex;align-items:center")
el-select(v-model="playerModerationTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" :placeholder="$t('view.moderation.filter_placeholder')") el-select(v-model="playerModerationTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" :placeholder="$t('view.moderation.filter_placeholder')")
el-option(v-once v-for="type in ['block', 'unblock', 'mute', 'unmute', 'interactOn', 'interactOff']" :key="type" :label="type" :value="type") el-option(v-once v-for="type in ['block', 'unblock', 'mute', 'unmute', 'interactOn', 'interactOff', 'muteChat']" :key="type" :label="type" :value="type")
el-input(v-model="playerModerationTable.filters[1].value" :placeholder="$t('view.moderation.search_placeholder')" style="flex:none;width:150px;margin:0 10px") el-input(v-model="playerModerationTable.filters[1].value" :placeholder="$t('view.moderation.search_placeholder')" style="flex:none;width:150px;margin:0 10px")
el-tooltip(placement="bottom" :content="$t('view.moderation.refresh_tooltip')" :disabled="hideTooltips") el-tooltip(placement="bottom" :content="$t('view.moderation.refresh_tooltip')" :disabled="hideTooltips")
el-button(type="default" :loading="API.isPlayerModerationsLoading" @click="API.refreshPlayerModerations()" icon="el-icon-refresh" circle style="flex:none") el-button(type="default" :loading="API.isPlayerModerationsLoading" @click="API.refreshPlayerModerations()" icon="el-icon-refresh" circle style="flex:none")