Bulk copy favorites

This commit is contained in:
Natsumi
2024-11-07 23:47:55 +13:00
parent 066b031f66
commit 10dae1707e
3 changed files with 170 additions and 62 deletions

View File

@@ -11713,27 +11713,51 @@ speechSynthesis.getVoices();
});
};
$app.methods.addFavoriteWorld = function (ref, group) {
$app.methods.addFavoriteWorld = function (ref, group, message) {
return API.addFavorite({
type: 'world',
favoriteId: ref.id,
tags: group.name
}).then((args) => {
if (message) {
this.$message({
message: 'World added to favorites',
type: 'success'
});
}
return args;
});
};
$app.methods.addFavoriteAvatar = function (ref, group) {
$app.methods.addFavoriteAvatar = function (ref, group, message) {
return API.addFavorite({
type: 'avatar',
favoriteId: ref.id,
tags: group.name
}).then((args) => {
if (message) {
this.$message({
message: 'Avatar added to favorites',
type: 'success'
});
}
return args;
});
};
$app.methods.addFavoriteUser = function (ref, group) {
$app.methods.addFavoriteUser = function (ref, group, message) {
return API.addFavorite({
type: 'friend',
favoriteId: ref.id,
tags: group.name
}).then((args) => {
if (message) {
this.$message({
message: 'Friend added to favorites',
type: 'success'
});
}
return args;
});
};
@@ -18737,7 +18761,8 @@ speechSynthesis.getVoices();
if (D.worldImportFavoriteGroup) {
await this.addFavoriteWorld(
ref,
D.worldImportFavoriteGroup
D.worldImportFavoriteGroup,
false
);
} else if (D.worldImportLocalFavoriteGroup) {
this.addLocalWorldFavorite(
@@ -18976,7 +19001,8 @@ speechSynthesis.getVoices();
if (D.avatarImportFavoriteGroup) {
await this.addFavoriteAvatar(
ref,
D.avatarImportFavoriteGroup
D.avatarImportFavoriteGroup,
false
);
} else if (D.avatarImportLocalFavoriteGroup) {
this.addLocalAvatarFavorite(
@@ -19205,7 +19231,11 @@ speechSynthesis.getVoices();
break;
}
var ref = data[i];
await this.addFavoriteUser(ref, D.friendImportFavoriteGroup);
await this.addFavoriteUser(
ref,
D.friendImportFavoriteGroup,
false
);
$app.removeFromArray(this.friendImportTable.data, ref);
D.userIdList.delete(ref.id);
D.importProgress++;
@@ -19505,7 +19535,7 @@ speechSynthesis.getVoices();
// #endregion
// #region | App: bulk unfavorite
$app.data.bulkUnfavoriteMode = false;
$app.data.editFavoritesMode = false;
$app.methods.showBulkUnfavoriteSelectionConfirm = function () {
var elementsTicked = [];
@@ -19551,7 +19581,65 @@ speechSynthesis.getVoices();
objectId: id
});
}
this.bulkUnfavoriteMode = false;
this.editFavoritesMode = false;
};
$app.methods.bulkCopyFavoriteSelection = function () {
var idList = '';
var type = '';
for (var ctx of this.favoriteFriends) {
if (ctx.$selected) {
idList += ctx.id + '\n';
type = 'friend';
}
}
for (var ctx of this.favoriteWorlds) {
if (ctx.$selected) {
idList += ctx.id + '\n';
type = 'world';
}
}
for (var ctx of this.favoriteAvatars) {
if (ctx.$selected) {
idList += ctx.id + '\n';
type = 'avatar';
}
}
switch (type) {
case 'friend':
this.showFriendImportDialog();
this.friendImportDialog.input = idList;
this.processFriendImportList();
break;
case 'world':
this.showWorldImportDialog();
this.worldImportDialog.input = idList;
this.processWorldImportList();
break;
case 'avatar':
this.showAvatarImportDialog();
this.avatarImportDialog.input = idList;
this.processAvatarImportList();
break;
default:
break;
}
console.log('Favorite selection\n', idList);
};
$app.methods.clearBulkFavoriteSelection = function () {
for (var ctx of this.favoriteFriends) {
ctx.$selected = false;
}
for (var ctx of this.favoriteWorlds) {
ctx.$selected = false;
}
for (var ctx of this.favoriteAvatars) {
ctx.$selected = false;
}
};
// #endregion