From 49febe1764909428dc9c5217b25591dd4d98cf87 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Jul 2021 01:07:55 +0900 Subject: [PATCH 1/6] Resolve #7165 --- src/server/api/common/read-notification.ts | 23 +++++++++++++++++++--- src/services/note/read.ts | 5 +++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts index f686446c5c..effa61e8b5 100644 --- a/src/server/api/common/read-notification.ts +++ b/src/server/api/common/read-notification.ts @@ -4,9 +4,6 @@ import { Notification } from '../../../models/entities/notification'; import { Notifications, Users } from '../../../models'; import { In } from 'typeorm'; -/** - * Mark notifications as read - */ export async function readNotification( userId: User['id'], notificationIds: Notification['id'][] @@ -19,6 +16,26 @@ export async function readNotification( isRead: true }); + post(userId); +} + +export async function readNotificationByQuery( + userId: User['id'], + query: Record +) { + // Update documents + await Notifications.update({ + ...query, + notifieeId: userId, + isRead: false + }, { + isRead: true + }); + + post(userId); +} + +async function post(userId: User['id']) { if (!await Users.getHasUnreadNotification(userId)) { // 全ての(いままで未読だった)通知を(これで)読みましたよというイベントを発行 publishMainStream(userId, 'readAllNotifications'); diff --git a/src/services/note/read.ts b/src/services/note/read.ts index 2bdb859476..a661c0a9d0 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -7,6 +7,7 @@ import { Channel } from '../../models/entities/channel'; import { checkHitAntenna } from '@/misc/check-hit-antenna'; import { getAntennas } from '@/misc/antenna-cache'; import { PackedNote } from '../../models/repositories/note'; +import { readNotificationByQuery } from '@/server/api/common/read-notification'; /** * Mark notes as read @@ -96,6 +97,10 @@ export default async function( publishMainStream(userId, 'readAllChannels'); } }); + + readNotificationByQuery(userId, { + noteId: In([...readMentions.map(n => n.id), ...readSpecifiedNotes.map(n => n.id)]), + }); } if (readAntennaNotes.length > 0) { From 38474c731623d5e285ec19070a1ae993c4562dbf Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 9 Jul 2021 01:09:02 +0900 Subject: [PATCH 2/6] =?UTF-8?q?mfm.js=E3=81=8C=E6=9B=B4=E6=96=B0=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9F=E3=81=AE=E3=81=A7=E3=82=82=E3=81=86=E3=81=93?= =?UTF-8?q?=E3=81=AEresolutions=E3=81=AF=E3=81=84=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=84=20(#7581)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a6b0e5e663..088c3d6cd3 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "format": "gulp format" }, "resolutions": { - "mfm-js/twemoji-parser": "13.1.x", "chokidar": "^3.3.1", "lodash": "^4.17.21" }, From cb42f94d9c8187c79809e40a981094b4fb36fe52 Mon Sep 17 00:00:00 2001 From: Skehmatics Date: Fri, 9 Jul 2021 10:55:12 -0700 Subject: [PATCH 3/6] Rich welcome content (#7588) * Add rich content (polls, media) to the welcome page notes * Add a simple scrolling animation to welcome page --- src/client/components/poll.vue | 11 ++-- src/client/pages/welcome.timeline.vue | 72 ++++++++++++++++++++++----- 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/src/client/components/poll.vue b/src/client/components/poll.vue index 463ddab721..b5d430f93b 100644 --- a/src/client/components/poll.vue +++ b/src/client/components/poll.vue @@ -10,7 +10,7 @@ -

+

{{ $t('_poll.totalVotes', { n: total }) }} · {{ showResult ? $ts._poll.vote : $ts._poll.showResult }} @@ -31,6 +31,11 @@ export default defineComponent({ note: { type: Object, required: true + }, + readOnly: { + type: Boolean, + required: false, + default: false, } }, data() { @@ -65,7 +70,7 @@ export default defineComponent({ } }, created() { - this.showResult = this.isVoted; + this.showResult = this.readOnly || this.isVoted; if (this.note.poll.expiresAt) { const update = () => { @@ -83,7 +88,7 @@ export default defineComponent({ this.showResult = !this.showResult; }, vote(id) { - if (this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return; + if (this.readOnly || this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return; os.api('notes/polls/vote', { noteId: this.note.id, choice: id diff --git a/src/client/pages/welcome.timeline.vue b/src/client/pages/welcome.timeline.vue index 12c8a4d4f4..bd07ac78db 100644 --- a/src/client/pages/welcome.timeline.vue +++ b/src/client/pages/welcome.timeline.vue @@ -1,10 +1,22 @@ @@ -12,16 +24,21 @@