Skip to content

Commit

Permalink
Display archived message only to the owner
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 27, 2024
1 parent 3bcc171 commit e41293d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions client/src/components/History/CurrentHistory/HistoryMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BAlert } from "bootstrap-vue";
import { computed, ref } from "vue";
import type { HistorySummary } from "@/api";
import { type GenericUser, type HistorySummary, userOwnsHistory } from "@/api";
import localize from "@/utils/localization";
library.add(faArchive, faBurn, faTrash);
interface Props {
history: HistorySummary;
currentUser: GenericUser | null;
}
const props = defineProps<Props>();
Expand All @@ -21,10 +22,14 @@ const userOverQuota = ref(false);
const hasMessages = computed(() => {
return userOverQuota.value || props.history.deleted || props.history.archived;
});
const currentUserOwnsHistory = computed(() => {
return userOwnsHistory(props.currentUser, props.history);
});
</script>

<template>
<div v-if="hasMessages" class="mx-3 mt-2">
<div v-if="hasMessages" class="mx-3 mt-2" data-description="history messages">
<BAlert v-if="history.purged" :show="history.purged" variant="warning">
<FontAwesomeIcon :icon="faBurn" fixed-width />
{{ localize("History has been purged") }}
Expand All @@ -34,7 +39,7 @@ const hasMessages = computed(() => {
{{ localize("History has been deleted") }}
</BAlert>

<BAlert :show="history.archived" variant="warning">
<BAlert :show="history.archived && currentUserOwnsHistory" variant="warning">
<FontAwesomeIcon :icon="faArchive" fixed-width />
{{ localize("History has been archived") }}
</BAlert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ function setItemDragstart(
:summarized="isMultiViewItem"
@update:history="historyStore.updateHistory($event)" />

<HistoryMessages :history="history" />
<HistoryMessages :history="history" :current-user="currentUser" />

<HistoryCounter
:history="history"
Expand Down

0 comments on commit e41293d

Please sign in to comment.