Bulk unfriend

This commit is contained in:
Natsumi
2022-12-01 20:51:10 +13:00
parent b0c41c6d08
commit 9e92c3b8c7
2 changed files with 103 additions and 6 deletions

View File

@@ -9052,6 +9052,9 @@ speechSynthesis.getVoices();
};
$app.methods.photonBotCheck = function (dtNow) {
if (this.photonLobbyCurrentUser === 0) {
return;
}
var photonBots = [];
this.photonLobbyCurrent.forEach((ref, id) => {
if (this.photonLobbyJointime.has(id)) {
@@ -9337,7 +9340,11 @@ speechSynthesis.getVoices();
joinTime: Date.parse(gameLogDate),
hasInstantiated,
inVRMode: user.inVRMode,
avatarEyeHeight: user.avatarEyeHeight
avatarEyeHeight: user.avatarEyeHeight,
canModerateInstance: user.canModerateInstance,
groupOnNameplate: user.groupOnNameplate,
showGroupBadgeToOthers: user.showGroupBadgeToOthers,
showSocialRank: user.showSocialRank
});
this.photonUserJoin(id, user.avatarDict, gameLogDate);
}
@@ -9429,7 +9436,13 @@ speechSynthesis.getVoices();
joinTime: Date.parse(gameLogDate),
hasInstantiated,
inVRMode: data.Parameters[249].inVRMode,
avatarEyeHeight: data.Parameters[249].avatarEyeHeight
avatarEyeHeight: data.Parameters[249].avatarEyeHeight,
canModerateInstance:
data.Parameters[249].canModerateInstance,
groupOnNameplate: data.Parameters[249].groupOnNameplate,
showGroupBadgeToOthers:
data.Parameters[249].showGroupBadgeToOthers,
showSocialRank: data.Parameters[249].showSocialRank
});
this.photonUserJoin(
data.Parameters[254],
@@ -9900,7 +9913,6 @@ speechSynthesis.getVoices();
var ref = API.cachedUsers.get(user.id);
var photonUser = {
id: user.id,
username: user.username,
displayName: user.displayName,
developerType: user.developerType,
profilePicOverride: user.profilePicOverride,
@@ -17665,8 +17677,76 @@ speechSynthesis.getVoices();
$app.data.friendsListSearch = '';
$app.data.friendsListSearchFilterVIP = false;
$app.data.friendsListSearchFilters = [];
$app.data.friendsListSelectAllCheckbox = false;
$app.data.friendsListBulkUnfriendMode = false;
$app.methods.showBulkUnfriendSelectionConfirm = function () {
var elementsTicked = 0;
for (var ctx of this.friendsListTable.data) {
if (ctx.$selected) {
elementsTicked++;
}
}
if (elementsTicked === 0) {
return;
}
this.$confirm(
`Are you sure you want to delete ${elementsTicked} friends?
This can negatively affect your trust rank,
This action cannot be undone.`,
`Delete ${elementsTicked} friends?`,
{
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'info',
callback: (action) => {
if (action === 'confirm') {
this.bulkUnfriendSelection();
}
}
}
);
};
$app.methods.bulkUnfriendSelection = function () {
for (var ctx of this.friendsListTable.data) {
if (ctx.$selected) {
API.deleteFriend({
userId: ctx.id
});
}
}
};
// $app.methods.showBulkUnfriendAllConfirm = function () {
// this.$confirm(
// `Are you sure you want to delete all your friends?
// This can negatively affect your trust rank,
// This action cannot be undone.`,
// 'Delete all friends?',
// {
// confirmButtonText: 'Confirm',
// cancelButtonText: 'Cancel',
// type: 'info',
// callback: (action) => {
// if (action === 'confirm') {
// this.bulkUnfriendAll();
// }
// }
// }
// );
// };
// $app.methods.bulkUnfriendAll = function () {
// for (var ctx of this.friendsListTable.data) {
// API.deleteFriend({
// userId: ctx.id
// });
// }
// };
$app.methods.friendsListSearchChange = function () {
this.friendsListTable.data = [];
var filters = [...this.friendsListSearchFilters];
if (filters.length === 0) {
filters = ['Display Name', 'Rank', 'Status', 'Bio', 'Memo'];
@@ -17679,6 +17759,9 @@ speechSynthesis.getVoices();
if (typeof ctx.ref === 'undefined') {
continue;
}
if (typeof ctx.$selected === 'undefined') {
ctx.$selected = false;
}
if (this.friendsListSearchFilterVIP && !ctx.isVIP) {
continue;
}
@@ -20228,7 +20311,11 @@ speechSynthesis.getVoices();
joinTime: Date.parse(dateTime),
hasInstantiated,
inVRMode: user.inVRMode,
avatarEyeHeight: user.avatarEyeHeight
avatarEyeHeight: user.avatarEyeHeight,
canModerateInstance: user.canModerateInstance,
groupOnNameplate: user.groupOnNameplate,
showGroupBadgeToOthers: user.showGroupBadgeToOthers,
showSocialRank: user.showSocialRank
});
}
}

View File

@@ -133,8 +133,8 @@ html
span.name Created
span.extra {{ currentInstanceWorld.ref.created_at | formatDate('long') }}
div.photon-event-table(v-if="photonLoggingEnabled")
div(style="position:absolute;margin-left:195px;z-index:1")
el-select(v-model="photonEventTableTypeFilter" @change="photonEventTableFilterChange" multiple clearable collapse-tags style="flex:1;width:150px" placeholder="Filter")
div(style="position:absolute;width:600px;margin-left:195px;z-index:1")
el-select(v-model="photonEventTableTypeFilter" @change="photonEventTableFilterChange" multiple clearable collapse-tags style="flex:1;width:220px" placeholder="Filter")
el-option(v-once v-for="type in photonEventTableTypeFilterList" :key="type" :label="type" :value="type")
el-input(v-model="photonEventTableFilter" @input="photonEventTableFilterChange" placeholder="Search" clearable style="width:150px;margin-left:10px")
el-button(@click="showChatboxBlacklistDialog" style="margin-left:10px") Chatbox Blacklist
@@ -951,6 +951,12 @@ html
div.options-container(style="margin-top:0")
span.header Friends List
div(style="float:right;font-size:13px")
div(v-if="friendsListBulkUnfriendMode" style="display:inline-block;margin-right:10px")
el-button(size="small" @click="showBulkUnfriendSelectionConfirm") Bulk Unfriend Selection
//- el-button(size="small" @click="showBulkUnfriendAllConfirm" style="margin-right:5px") Bulk Unfriend All
div(style="display:inline-block;margin-right:10px")
span.name Bulk Unfriend Mode
el-switch(v-model="friendsListBulkUnfriendMode" style="margin-left:5px")
span Load missing entries
el-tooltip(placement="top" style="margin-left:5px" content="This takes a lot of API requests so use it sparingly")
i.el-icon-warning
@@ -973,6 +979,10 @@ html
el-tooltip(placement="top" content="Clear results" :disabled="hideTooltips")
el-button(type="default" @click="friendsListTable.data = []" icon="el-icon-delete" circle style="flex:none;margin-left:5px")
data-tables(v-bind="friendsListTable" @row-click="selectFriendsListRow" style="margin-top:10px;cursor:pointer")
el-table-column(v-if="friendsListBulkUnfriendMode" width="55" prop="$selected")
template(v-once #default="scope")
el-button(type="text" size="mini" @click.stop)
el-checkbox(v-model="scope.row.$selected")
el-table-column(label="No." width="70" prop="$friendNum" sortable="custom")
el-table-column(label="Avatar" width="70" prop="photo")
template(v-once #default="scope")