|
1 | 1 | <template>
|
2 | 2 | <div>
|
3 |
| - <ModalConfirm |
4 |
| - v-if="auth.user && auth.user.id === creator.id" |
| 3 | + <ConfirmModal |
| 4 | + v-if="canEdit" |
5 | 5 | ref="deleteModal"
|
6 | 6 | :title="formatMessage(messages.deleteModalTitle)"
|
7 | 7 | :description="formatMessage(messages.deleteModalDescription)"
|
@@ -387,12 +387,13 @@ import {
|
387 | 387 | Avatar,
|
388 | 388 | Button,
|
389 | 389 | commonMessages,
|
| 390 | + ConfirmModal, |
390 | 391 | } from "@modrinth/ui";
|
391 | 392 |
|
| 393 | +import { isAdmin } from "@modrinth/utils"; |
392 | 394 | import WorldIcon from "assets/images/utils/world.svg";
|
393 | 395 | import UpToDate from "assets/images/illustrations/up_to_date.svg";
|
394 | 396 | import { addNotification } from "~/composables/notifs.js";
|
395 |
| -import ModalConfirm from "~/components/ui/ModalConfirm.vue"; |
396 | 397 | import NavRow from "~/components/ui/NavRow.vue";
|
397 | 398 | import ProjectCard from "~/components/ui/ProjectCard.vue";
|
398 | 399 | import AdPlaceholder from "~/components/ui/AdPlaceholder.vue";
|
@@ -596,7 +597,7 @@ useSeoMeta({
|
596 | 597 | const canEdit = computed(
|
597 | 598 | () =>
|
598 | 599 | auth.value.user &&
|
599 |
| - auth.value.user.id === collection.value.user && |
| 600 | + (auth.value.user.id === collection.value.user || isAdmin(auth.value.user)) && |
600 | 601 | collection.value.id !== "following",
|
601 | 602 | );
|
602 | 603 |
|
@@ -685,7 +686,11 @@ async function deleteCollection() {
|
685 | 686 | method: "DELETE",
|
686 | 687 | apiVersion: 3,
|
687 | 688 | });
|
688 |
| - await navigateTo("/dashboard/collections"); |
| 689 | + if (auth.value.user.id === collection.value.user) { |
| 690 | + await navigateTo("/dashboard/collections"); |
| 691 | + } else { |
| 692 | + await navigateTo(`/user/${collection.value.user}/collections`); |
| 693 | + } |
689 | 694 | } catch (err) {
|
690 | 695 | addNotification({
|
691 | 696 | group: "main",
|
|
0 commit comments