This commit is contained in:
j3d1 2026-09-04 15:04:13 +02:00
parent e88dc898b3
commit 78a1e0301f
20 changed files with 118 additions and 121 deletions

View file

@ -14,7 +14,7 @@
<div style="position: relative;">
<div class="image-list">
<deletable-wrapper v-for="file in only_images(item_files).filter(file => file.owner)" :key="file.id"
@delete="deleteFile(file)">
confirm-message="Delete this file? This cannot be undone." @delete="deleteFile(file)">
<authenticated-image :src="file.name" :owner="file.owner" class="img-thumbnail"/>
</deletable-wrapper>
<deletable-wrapper v-for="file in only_images(item_files).filter(file => file.data)" :key="file.id"

View file

@ -26,9 +26,17 @@ export default {
components: {
...BIcons
},
props: {
// No confirmation when omitted - e.g. removing a not-yet-saved staged file, see CombinedFileField.vue's deleteTempFile.
confirmMessage: {
type: String,
default: null
}
},
emits: ["delete"],
methods: {
triggerDelete() {
if (this.confirmMessage && !confirm(this.confirmMessage)) return;
this.$emit("delete");
}
}

View file

@ -30,7 +30,7 @@ import ShortId from '@/views/ShortId.vue';
import {
encodeShortId, serializeShortId, decodeShortId, deserializeShortId,
isDomainQualifiedShortId, decodeDomainQualifiedShortId
} from '@/short-id';
} from '@/lib/short-id';
import Account from '@/views/settings/Account.vue';
import Password from '@/views/settings/Password.vue';

View file

@ -9,7 +9,7 @@
</div>
<div class="card-body">
<span v-for="file in only_images(files)" :key="file.id">
<deletable-wrapper @delete="deleteFile(file)">
<deletable-wrapper confirm-message="Delete this file? This cannot be undone." @delete="deleteFile(file)">
<authenticated-image :src="thumbnailPathForHash(file.hash)" :owner="file.owner"
class="img-thumbnail"/>
</deletable-wrapper>

View file

@ -173,6 +173,7 @@ export default {
})
},
tryDropFriend(friend) {
if (!confirm(`Are you sure you want to remove "${friend.handle}" as a friend?`)) return
this.dropFriend(friend).then((ok) => {
if (ok) {
delete this.friends[friend.handle]

View file

@ -107,6 +107,7 @@ export default {
})
},
tryRemoveMember(member) {
if (!confirm(`Are you sure you want to remove "${member.handle}" from ${this.group.handle}?`)) return
this.removeGroupMember({groupHandle: this.group.handle, identityId: member.id})
.then(() => {
this.refresh()

View file

@ -196,6 +196,7 @@ export default {
return this.fetchFriendInventoryItems({friendHandle: this.selectedOwner})
},
tryDeleteItem(item) {
if (!confirm(`Are you sure you want to delete "${item.name}"? This cannot be undone.`)) return
this.deleteInventoryItem(item).then(() => {
this.fetchItemsForOwner()
})

View file

@ -46,7 +46,7 @@
Edit
</button>
<button type="submit" class="btn btn-danger"
@click="deleteInventoryItem(item).then(() => $router.push(ownerOverviewRoute(item)))">
@click="tryDeleteItem">
<b-icon-trash></b-icon-trash>
Delete
</button>
@ -116,6 +116,10 @@ export default {
...mapActions(["fetchItemByHandle", "deleteInventoryItem", "fetchGroupMemberships"]),
async loadItem() {
this.item = await this.fetchItemByHandle({handle: this.decodedHandle, id: this.id}) || {}
},
tryDeleteItem() {
if (!confirm(`Are you sure you want to delete "${this.item.name}"? This cannot be undone.`)) return
this.deleteInventoryItem(this.item).then(() => this.$router.push(ownerOverviewRoute(this.item)))
}
},
watch: {

View file

@ -184,6 +184,7 @@ export default {
: this.fetchGroupStorageLocations({groupHandle: this.selectedOwner})
},
tryDeleteLocation(location) {
if (!confirm(`Are you sure you want to delete "${location.name}"? This cannot be undone.`)) return
this.deleteStorageLocation(location).then(() => {
this.fetchLocationsForOwner()
})

View file

@ -39,7 +39,7 @@
Edit
</button>
<button type="submit" class="btn btn-danger"
@click="deleteStorageLocation(location).then(() => $router.push(ownerLocationOverviewRoute(location)))">
@click="tryDeleteLocation">
<b-icon-trash></b-icon-trash>
Delete
</button>
@ -103,6 +103,10 @@ export default {
...mapActions(["fetchStorageLocationByHandle", "deleteStorageLocation", "fetchGroupMemberships"]),
async loadLocation() {
this.location = await this.fetchStorageLocationByHandle({handle: this.decodedHandle, id: this.id}) || {}
},
tryDeleteLocation() {
if (!confirm(`Are you sure you want to delete "${this.location.name}"? This cannot be undone.`)) return
this.deleteStorageLocation(this.location).then(() => this.$router.push(ownerLocationOverviewRoute(this.location)))
}
},
watch: {

View file

@ -416,6 +416,8 @@ export default {
},
async abortWorkflow() {
const displayName = this.getWorkflowDisplayName || this.workflowInstance.title;
if (!confirm(`Are you sure you want to abort "${displayName}"?`)) return;
try {
this.loading = true;
await this.deleteWorkflow(this.workflowInstance.id);

View file

@ -130,6 +130,7 @@ export default {
await this.updateUserProfilePicture({file: image});
},
async removePicture() {
if (!confirm('Are you sure you want to remove your profile picture?')) return;
await this.updateUserProfilePicture({file: null});
}
},