From 06e906f95e4bf1502d45516cb78251265e6aa1b8 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Mon, 8 Apr 2024 02:19:35 +0900 Subject: [PATCH 1/3] feat: show pinned posts on individual account page --- components/status/StatusCard.vue | 14 ++++++++++++++ pages/[[server]]/@[account]/index/index.vue | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 76cd88d102..3e211c47ac 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -62,6 +62,7 @@ const timeago = useTimeAgo(() => status.value.createdAt, timeAgoOptions) const isSelfReply = computed(() => status.value.inReplyToAccountId === status.value.account.id) const collapseRebloggedBy = computed(() => rebloggedBy.value?.id === status.value.account.id) const isDM = computed(() => status.value.visibility === 'direct') +const isPinned = computed(() => status.value.pinned) const showUpperBorder = computed(() => props.newer && !directReply.value) const showReplyTo = computed(() => !replyToMain.value && !directReply.value) @@ -113,6 +114,19 @@ const forceShow = ref(false) + + +
+
+
+ Pinned post +
+
diff --git a/pages/[[server]]/@[account]/index/index.vue b/pages/[[server]]/@[account]/index/index.vue index 506f722d5c..0728dbc4e8 100644 --- a/pages/[[server]]/@[account]/index/index.vue +++ b/pages/[[server]]/@[account]/index/index.vue @@ -10,11 +10,21 @@ const { t } = useI18n() const account = await fetchAccountByHandle(handle.value) +// we need to ensure `pinned === true` on status +// because this prop is appeared only on current account's posts +function applyPinned(statuses: mastodon.v1.Status[]) { + return statuses.map((status) => { + status.pinned = true + return status + }) +} + function reorderAndFilter(items: mastodon.v1.Status[]) { return reorderedTimeline(items, 'account') } -const paginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ limit: 30, excludeReplies: true }) +const pinnedPaginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ pinned: true }) +const accountPaginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ limit: 30, excludeReplies: true }) if (account) { useHydratedHead({ @@ -26,6 +36,9 @@ if (account) { From c874b3d6c5463e3ba4e90c3c79e98ad1747ed797 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Tue, 9 Apr 2024 00:05:31 +0900 Subject: [PATCH 2/3] fix: adjust "Pinned post" position and styling --- components/status/StatusCard.vue | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 3e211c47ac..c1b9f720d5 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -76,6 +76,19 @@ const forceShow = ref(false)
+ +
+
+
+ Pinned post +
+
+