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

View File

@@ -3911,12 +3911,11 @@ speechSynthesis.getVoices();
var userId = this.currentUser.id;
for (var ref of this.cachedPlayerModerations.values()) {
if (
ref.$isDeleted === false &&
ref.type === type &&
ref.targetUserId === moderated &&
ref.sourceUserId === userId
) {
ref.$isDeleted = true;
this.cachedPlayerModerations.delete(ref.id);
this.$emit('PLAYER-MODERATION:@DELETE', {
ref,
params: {
@@ -3940,7 +3939,6 @@ speechSynthesis.getVoices();
targetDisplayName: '',
created: '',
// VRCX
$isDeleted: false,
$isExpired: false,
//
...json
@@ -3965,10 +3963,9 @@ speechSynthesis.getVoices();
API.deleteExpiredPlayerModerations = function () {
for (var ref of this.cachedPlayerModerations.values()) {
if (ref.$isDeleted || ref.$isExpired === false) {
if (!ref.$isExpired) {
continue;
}
ref.$isDeleted = true;
this.$emit('PLAYER-MODERATION:@DELETE', {
ref,
params: {
@@ -5663,6 +5660,14 @@ speechSynthesis.getVoices();
(await configRepository.getString('lastUserLoggedIn')) !==
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
this.loginForm.loading = true;
API.getConfig()
@@ -15029,17 +15034,11 @@ speechSynthesis.getVoices();
var { length } = array;
for (var i = 0; i < length; ++i) {
if (array[i].id === ref.id) {
if (ref.$isDeleted) {
array.splice(i, 1);
} else {
Vue.set(array, i, ref);
}
Vue.set(array, i, ref);
return;
}
}
if (ref.$isDeleted === false) {
$app.playerModerationTable.data.push(ref);
}
$app.playerModerationTable.data.push(ref);
});
API.$on('PLAYER-MODERATION:@DELETE', function (args) {
@@ -17446,6 +17445,7 @@ speechSynthesis.getVoices();
isHideAvatar: false,
isShowAvatar: false,
isInteractOff: false,
isMuteChat: false,
isFavorite: false,
$location: {},
@@ -17657,7 +17657,6 @@ speechSynthesis.getVoices();
var D = $app.userDialog;
if (
D.visible === false ||
ref.$isDeleted ||
(ref.targetUserId !== D.id &&
ref.sourceUserId !== this.currentUser.id)
) {
@@ -17671,6 +17670,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = true;
} else if (ref.type === 'interactOff') {
D.isInteractOff = true;
} else if (ref.type === 'muteChat') {
D.isMuteChat = true;
}
$app.$message({
message: 'User moderated',
@@ -17696,6 +17697,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = false;
} else if (ref.type === 'interactOff') {
D.isInteractOff = false;
} else if (ref.type === 'muteChat') {
D.isMuteChat = false;
}
});
@@ -17813,9 +17816,9 @@ speechSynthesis.getVoices();
D.isBlock = false;
D.isMute = false;
D.isInteractOff = false;
D.isMuteChat = false;
for (var ref of API.cachedPlayerModerations.values()) {
if (
ref.$isDeleted === false &&
ref.targetUserId === D.id &&
ref.sourceUserId === API.currentUser.id
) {
@@ -17827,6 +17830,8 @@ speechSynthesis.getVoices();
D.isHideAvatar = true;
} else if (ref.type === 'interactOff') {
D.isInteractOff = true;
} else if (ref.type === 'muteChat') {
D.isMuteChat = true;
}
}
}
@@ -18832,6 +18837,18 @@ speechSynthesis.getVoices();
type: 'interactOff'
});
break;
case 'Unmute Chatbox':
API.deletePlayerModeration({
moderated: userId,
type: 'muteChat'
});
break;
case 'Mute Chatbox':
API.sendPlayerModeration({
moderated: userId,
type: 'muteChat'
});
break;
case 'Report Hacking':
$app.reportUserForHacking(userId);
break;
@@ -25186,7 +25203,8 @@ speechSynthesis.getVoices();
this.userFavoriteWorlds = [];
var worldLists = [];
var params = {
ownerId: userId
ownerId: userId,
n: 100
};
var json = await API.call('favorite/groups', {
method: 'GET',

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-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-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")
i.el-icon-check.el-icon--left(v-if="userDialog.isShowAvatar")
span {{ $t('dialog.user.actions.moderation_show_avatar') }}

View File

@@ -588,6 +588,8 @@
"moderation_show_avatar": "Show Avatar",
"moderation_enable_avatar_interaction": "Enable Avatar Interaction",
"moderation_disable_avatar_interaction": "Disable Avatar Interaction",
"moderation_enable_chatbox": "Unmute Chatbox",
"moderation_disable_chatbox": "Mute Chatbox",
"edit_status": "Social Status",
"edit_language": "Language",
"edit_bio": "Bio",

View File

@@ -4,7 +4,7 @@ mixin moderationTab()
template(#tool)
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-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-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")