Skip to content

Commit

Permalink
Use author_deleted_or_purged to determine how to display page author
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Jan 14, 2025
1 parent 9030721 commit 3082bb9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/src/components/Common/PublishedItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Item {
owner?: string;
username?: string;
email_hash?: string;
author_deleted_or_purged?: boolean;
tags?: string[];
title?: string;
}
Expand All @@ -37,8 +38,14 @@ const plural = computed(() => {
return `${modelTitle.value}s`;
});
const owner = computed(() => {
if (props.item?.author_deleted_or_purged) {
return "Archived author";
}
return props.item?.owner ?? props.item?.username ?? "Unavailable";
});
const gravatarSource = computed(() => `https://secure.gravatar.com/avatar/${props.item?.email_hash}?d=identicon`);
const owner = computed(() => props.item?.owner ?? props.item?.username ?? "Unavailable");
const pluralPath = computed(() => plural.value.toLowerCase());
const publishedByUser = computed(() => `/${pluralPath.value}/list_published?f-username=${owner.value}`);
const urlAll = computed(() => `/${pluralPath.value}/list_published`);
Expand Down Expand Up @@ -76,7 +83,7 @@ const urlAll = computed(() => `/${pluralPath.value}/list_published`);
<router-link :to="urlAll">All published {{ plural }}</router-link>
</div>

<div>
<div v-if="!props.item?.author_deleted_or_purged">
<router-link :to="publishedByUser"> Published {{ plural }} by {{ owner }}</router-link>
</div>
</div>
Expand Down

0 comments on commit 3082bb9

Please sign in to comment.