summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHazel K <acomputerdog@gmail.com>2024-10-04 12:22:09 -0400
committerHazel K <acomputerdog@gmail.com>2024-10-07 16:20:40 -0400
commit60ec877d3cf81b7fe2326edfea414e7fc427ddf8 (patch)
tree56879e568432717ea074f1a06383e3089b872579
parentmerge: Prevent deletion or suspension of system accounts (resolves #625) (!666) (diff)
downloadsharkey-60ec877d3cf81b7fe2326edfea414e7fc427ddf8.tar.gz
sharkey-60ec877d3cf81b7fe2326edfea414e7fc427ddf8.tar.bz2
sharkey-60ec877d3cf81b7fe2326edfea414e7fc427ddf8.zip
on user profiles, move pinned notes down with the other notes
-rw-r--r--locales/en-US.yml1
-rw-r--r--locales/index.d.ts4
-rw-r--r--locales/ja-JP.yml1
-rw-r--r--packages/frontend/src/pages/user/home.vue24
4 files changed, 24 insertions, 6 deletions
diff --git a/locales/en-US.yml b/locales/en-US.yml
index 8163ca525b..22a3e5ef13 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -126,6 +126,7 @@ inChannelQuote: "Channel-only Quote"
renoteToChannel: "Renote to channel"
renoteToOtherChannel: "Renote to other channel"
pinnedNote: "Pinned note"
+pinnedOnly: "Pinned"
pinned: "Pin to profile"
you: "You"
clickToShow: "Click to show"
diff --git a/locales/index.d.ts b/locales/index.d.ts
index fcd64071af..d247be7091 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -521,6 +521,10 @@ export interface Locale extends ILocale {
*/
"pinnedNote": string;
/**
+ * Pinned
+ */
+ "pinnedOnly": string;
+ /**
* ピン留め
*/
"pinned": string;
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 7e39515c5c..2fc021011e 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -126,6 +126,7 @@ inChannelQuote: "チャンネル内引用"
renoteToChannel: "チャンネルにリノート"
renoteToOtherChannel: "他のチャンネルにリノート"
pinnedNote: "ピン留めされたノート"
+pinnedOnly: "Pinned"
pinned: "ピン留め"
you: "あなた"
clickToShow: "クリックして表示"
diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue
index e82ec0cb97..4716c980c9 100644
--- a/packages/frontend/src/pages/user/home.vue
+++ b/packages/frontend/src/pages/user/home.vue
@@ -125,10 +125,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div class="contents _gaps">
- <div v-if="user.pinnedNotes.length > 0" class="_gaps">
- <MkNote v-for="note in user.pinnedNotes" :key="note.id" class="note _panel" :note="note" :pinned="true"/>
- </div>
- <MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
+ <MkInfo v-if="user.pinnedNotes.length === 0 && $i?.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
<template v-if="narrow">
<MkLazy>
<XFiles :key="user.id" :user="user"/>
@@ -147,14 +144,27 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> -->
<MkStickyContainer>
<template #header>
+ <!-- You can't use v-if on these, as MkTab first *deletes* and replaces all children with native HTML elements. -->
+ <!-- Instead, we add a "no notes" placeholder and default to null (all notes) if there's nothing pinned. -->
+ <!-- It also converts all comments into text! -->
<MkTab v-model="noteview" :class="$style.tab">
+ <option value="pinned">{{ i18n.ts.pinnedOnly }}</option>
<option :value="null">{{ i18n.ts.notes }}</option>
<option value="all">{{ i18n.ts.all }}</option>
<option value="files">{{ i18n.ts.withFiles }}</option>
</MkTab>
</template>
<MkLazy>
- <MkNotes :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
+ <div v-if="noteview === 'pinned'" class="_gaps">
+ <div v-if="user.pinnedNotes.length < 1" class="_fullinfo">
+ <img :src="infoImageUrl" class="_ghost" aria-hidden="true" :alt="i18n.ts.noNotes"/>
+ <div>{{ i18n.ts.noNotes }}</div>
+ </div>
+ <MkDateSeparatedList v-else v-slot="{ item: note }" :items="user.pinnedNotes" :noGap="true" :ad="true" class="_panel">
+ <MkNote :key="note.id" class="note" :note="note" :pinned="true"/>
+ </MkDateSeparatedList>
+ </div>
+ <MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
</MkLazy>
</MkStickyContainer>
</div>
@@ -194,6 +204,8 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
import { useRouter } from '@/router/supplier.js';
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
+import { infoImageUrl } from "@/instance.js";
+import MkDateSeparatedList from "@/components/MkDateSeparatedList.vue";
const MkNote = defineAsyncComponent(() =>
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') :
@@ -241,7 +253,7 @@ const memoDraft = ref(props.user.memo);
const isEditingMemo = ref(false);
const moderationNote = ref(props.user.moderationNote);
const editModerationNote = ref(false);
-const noteview = ref<string | null>(null);
+const noteview = ref<string | null>(props.user.pinnedNotes.length > 0 ? 'pinned' : null);
const listenbrainzdata = ref(false);
if (props.user.listenbrainz) {