summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-02-11 09:41:54 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-02-11 09:41:54 +0900
commit8bd2d6328a9122a26c6221c4c09ac0c9f9487529 (patch)
treeb2dfaa757ad52950acaae1255871c934d618de06
parentコンディショナルロールもバッジとして表示可能に (diff)
downloadmisskey-8bd2d6328a9122a26c6221c4c09ac0c9f9487529.tar.gz
misskey-8bd2d6328a9122a26c6221c4c09ac0c9f9487529.tar.bz2
misskey-8bd2d6328a9122a26c6221c4c09ac0c9f9487529.zip
enhance(client): 一度見たノートのRenoteは省略して表示するように
Resolve #1792
-rw-r--r--CHANGELOG.md1
-rw-r--r--packages/frontend/src/components/MkNote.vue55
-rw-r--r--packages/frontend/src/components/MkNoteHeader.vue2
-rw-r--r--packages/frontend/src/components/MkNotification.vue4
-rw-r--r--packages/frontend/src/os.ts6
5 files changed, 59 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bfd64a94b5..984061f238 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ You should also include the user name that made the change.
### Improvements
- コンディショナルロールもバッジとして表示可能に
+- enhance(client): 一度見たノートのRenoteは省略して表示するように
### Bugfixes
-
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue
index 7edcaf1324..e4729eb1f4 100644
--- a/packages/frontend/src/components/MkNote.vue
+++ b/packages/frontend/src/components/MkNote.vue
@@ -12,7 +12,7 @@
<!--<div v-if="appearNote._prId_" class="tip"><i class="fas fa-bullhorn"></i> {{ i18n.ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ i18n.ts.hideThisNote }} <i class="ti ti-x"></i></button></div>-->
<!--<div v-if="appearNote._featuredId_" class="tip"><i class="ti ti-bolt"></i> {{ i18n.ts.featured }}</div>-->
<div v-if="isRenote" :class="$style.renote">
- <MkAvatar v-once :class="$style.renoteAvatar" :user="note.user" link preview/>
+ <MkAvatar :class="$style.renoteAvatar" :user="note.user" link preview/>
<i class="ti ti-repeat" style="margin-right: 4px;"></i>
<I18n :src="i18n.ts.renotedBy" tag="span" :class="$style.renoteText">
<template #user>
@@ -34,8 +34,12 @@
<span v-if="note.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['localOnly']"><i class="ti ti-world-off"></i></span>
</div>
</div>
- <article :class="$style.article" @contextmenu.stop="onContextmenu">
- <MkAvatar v-once :class="$style.avatar" :user="appearNote.user" link preview/>
+ <div v-if="renoteCollapsed" :class="$style.collapsedRenoteTarget">
+ <MkAvatar :class="$style.collapsedRenoteTargetAvatar" :user="appearNote.user" link preview/>
+ <Mfm :text="getNoteSummary(appearNote)" :plain="true" :nowrap="true" :author="appearNote.user" :class="$style.collapsedRenoteTargetText" @click="renoteCollapsed = false"/>
+ </div>
+ <article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
+ <MkAvatar :class="$style.avatar" :user="appearNote.user" link preview/>
<div :class="$style.main">
<MkNoteHeader :class="$style.header" :note="appearNote" :mini="true"/>
<MkInstanceTicker v-if="showTicker" :class="$style.ticker" :instance="appearNote.user.instance"/>
@@ -60,7 +64,7 @@
<div v-if="appearNote.files.length > 0" :class="$style.files">
<MkMediaList :media-list="appearNote.files"/>
</div>
- <MkPoll v-if="appearNote.poll" ref="pollViewer" :note="appearNote" :class="$style.poll"/>
+ <MkPoll v-if="appearNote.poll" :note="appearNote" :class="$style.poll"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
@@ -73,7 +77,7 @@
<MkA v-if="appearNote.channel && !inChannel" :class="$style.channel" :to="`/channels/${appearNote.channel.id}`"><i class="ti ti-device-tv"></i> {{ appearNote.channel.name }}</MkA>
</div>
<footer :class="$style.footer">
- <MkReactionsViewer ref="reactionsViewer" :note="appearNote"/>
+ <MkReactionsViewer :note="appearNote"/>
<button :class="$style.footerButton" class="_button" @click="reply()">
<i class="ti ti-arrow-back-up"></i>
<p v-if="appearNote.repliesCount > 0" :class="$style.footerButtonCount">{{ appearNote.repliesCount }}</p>
@@ -144,6 +148,8 @@ import { useNoteCapture } from '@/scripts/use-note-capture';
import { deepClone } from '@/scripts/clone';
import { useTooltip } from '@/scripts/use-tooltip';
import { claimAchievement } from '@/scripts/achievements';
+import { getNoteSummary } from '@/scripts/get-note-summary';
+import { shownNoteIds } from '@/os';
const props = defineProps<{
note: misskey.entities.Note;
@@ -192,6 +198,9 @@ const translating = ref(false);
const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null;
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || appearNote.userId === $i.id);
+let renoteCollapsed = $ref(isRenote && (($i && ($i.id === note.userId)) || shownNoteIds.has(appearNote.id)));
+
+shownNoteIds.add(appearNote.id);
const keymap = {
'r': () => reply(true),
@@ -433,7 +442,6 @@ function readPromo() {
width: 28px;
height: 28px;
margin: 0 8px 0 0;
- border-radius: 6px;
}
.renoteText {
@@ -461,6 +469,36 @@ function readPromo() {
margin-right: 4px;
}
+.collapsedRenoteTarget {
+ display: flex;
+ align-items: center;
+ line-height: 28px;
+ white-space: pre;
+ padding: 0 32px 18px;
+}
+
+.collapsedRenoteTargetAvatar {
+ flex-shrink: 0;
+ display: inline-block;
+ width: 28px;
+ height: 28px;
+ margin: 0 8px 0 0;
+}
+
+.collapsedRenoteTargetText {
+ overflow: hidden;
+ flex-shrink: 1;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: 90%;
+ opacity: 0.7;
+ cursor: pointer;
+
+ &:hover {
+ text-decoration: underline;
+ }
+}
+
.article {
display: flex;
padding: 28px 32px 18px;
@@ -614,6 +652,11 @@ function readPromo() {
padding: 8px 16px 0 16px;
}
+ .collapsedRenoteTarget {
+ padding: 0 16px 9px;
+ margin-top: 4px;
+ }
+
.article {
padding: 14px 16px 9px;
}
diff --git a/packages/frontend/src/components/MkNoteHeader.vue b/packages/frontend/src/components/MkNoteHeader.vue
index 6b43f14665..f5c57afa78 100644
--- a/packages/frontend/src/components/MkNoteHeader.vue
+++ b/packages/frontend/src/components/MkNoteHeader.vue
@@ -1,6 +1,6 @@
<template>
<header :class="$style.root">
- <MkA v-once v-user-preview="note.user.id" :class="$style.name" :to="userPage(note.user)">
+ <MkA v-user-preview="note.user.id" :class="$style.name" :to="userPage(note.user)">
<MkUserName :user="note.user"/>
</MkA>
<div v-if="note.user.isBot" :class="$style.isBot">bot</div>
diff --git a/packages/frontend/src/components/MkNotification.vue b/packages/frontend/src/components/MkNotification.vue
index 8c7114eac1..0d42e8ffbf 100644
--- a/packages/frontend/src/components/MkNotification.vue
+++ b/packages/frontend/src/components/MkNotification.vue
@@ -1,6 +1,6 @@
<template>
<div ref="elRef" :class="$style.root">
- <div v-once :class="$style.head">
+ <div :class="$style.head">
<MkAvatar v-if="notification.type === 'pollEnded'" :class="$style.icon" :user="notification.note.user" link preview/>
<MkAvatar v-else-if="notification.type === 'achievementEarned'" :class="$style.icon" :user="$i" link preview/>
<MkAvatar v-else-if="notification.user" :class="$style.icon" :user="notification.user" link preview/>
@@ -35,7 +35,7 @@
<span v-else>{{ notification.header }}</span>
<MkTime v-if="withTime" :time="notification.createdAt" :class="$style.headerTime"/>
</header>
- <div v-once :class="$style.content">
+ <div :class="$style.content">
<MkA v-if="notification.type === 'reaction'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note)">
<i class="ti ti-quote" :class="$style.quote"></i>
<Mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="true" :author="notification.note.user"/>
diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts
index e21a21ef76..4997030669 100644
--- a/packages/frontend/src/os.ts
+++ b/packages/frontend/src/os.ts
@@ -540,3 +540,9 @@ export function checkExistence(fileData: ArrayBuffer): Promise<any> {
});
});
}*/
+
+export const shownNoteIds = new Set();
+
+window.setInterval(() => {
+ shownNoteIds.clear();
+}, 1000 * 60 * 5);