feat(post): show post visibily in PostListItem component

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-26 17:59:46 +02:00
parent 8e626dce78
commit ec7ca4ddf1
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 30 additions and 3 deletions

View file

@ -47,6 +47,24 @@
</template> </template>
</i18n-t> </i18n-t>
</p> </p>
<p
v-if="post.visibility === PostVisibility.UNLISTED"
class="flex gap-2 items-center"
>
<Link :size="16" />
{{ t("Accessible only by link") }}
</p>
<p
v-else-if="post.visibility === PostVisibility.PRIVATE"
class="flex gap-2 items-center"
>
<Lock :size="16" />
{{
t("Accessible only to members", {
group: post.attributedTo?.name,
})
}}
</p>
</div> </div>
</router-link> </router-link>
</template> </template>
@ -61,7 +79,11 @@ import { formatDateTimeString } from "@/filters/datetime";
import Tag from "vue-material-design-icons/Tag.vue"; import Tag from "vue-material-design-icons/Tag.vue";
import AccountEdit from "vue-material-design-icons/AccountEdit.vue"; import AccountEdit from "vue-material-design-icons/AccountEdit.vue";
import Clock from "vue-material-design-icons/Clock.vue"; import Clock from "vue-material-design-icons/Clock.vue";
import Lock from "vue-material-design-icons/Lock.vue";
import Link from "vue-material-design-icons/Link.vue";
import MbzTag from "@/components/TagElement.vue"; import MbzTag from "@/components/TagElement.vue";
import { PostVisibility } from "@/types/enums";
import { useI18n } from "vue-i18n";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@ -71,6 +93,7 @@ const props = withDefaults(
{ isCurrentActorMember: false } { isCurrentActorMember: false }
); );
const { t } = useI18n({ useScope: "global" });
const dateFnsLocale = inject<Locale>("dateFnsLocale"); const dateFnsLocale = inject<Locale>("dateFnsLocale");
const postTags = computed(() => (props.post.tags ?? []).slice(0, 3)); const postTags = computed(() => (props.post.tags ?? []).slice(0, 3));

View file

@ -78,13 +78,16 @@
}) })
}} }}
</span> </span>
<span v-if="post.visibility === PostVisibility.UNLISTED" class=""> <span
<o-icon icon="link" size="small" /> v-if="post.visibility === PostVisibility.UNLISTED"
class="flex gap-2 items-center"
>
<Link :size="16" />
{{ t("Accessible only by link") }} {{ t("Accessible only by link") }}
</span> </span>
<span <span
v-else-if="post.visibility === PostVisibility.PRIVATE" v-else-if="post.visibility === PostVisibility.PRIVATE"
class="" class="flex gap-2 items-center"
> >
<Lock :size="16" /> <Lock :size="16" />
{{ {{
@ -275,6 +278,7 @@ import Pencil from "vue-material-design-icons/Pencil.vue";
import Delete from "vue-material-design-icons/Delete.vue"; import Delete from "vue-material-design-icons/Delete.vue";
import Share from "vue-material-design-icons/Share.vue"; import Share from "vue-material-design-icons/Share.vue";
import Flag from "vue-material-design-icons/Flag.vue"; import Flag from "vue-material-design-icons/Flag.vue";
import Link from "vue-material-design-icons/Link.vue";
import { Dialog } from "@/plugins/dialog"; import { Dialog } from "@/plugins/dialog";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { Notifier } from "@/plugins/notifier"; import { Notifier } from "@/plugins/notifier";