From bd6666173a266dbcc10221a049f518443ed8f25b Mon Sep 17 00:00:00 2001 From: nenohi Date: Fri, 19 May 2023 17:12:22 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix:=E3=83=AD=E3=83=BC=E3=83=AB=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=A0=E3=83=A9=E3=82=A4=E3=83=B3=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E4=BF=AE=E6=AD=A3=20(#1084?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修正 * note visibility change * public投稿のみ * update changelog * RN非表示機能がうごかないところだった --- CHANGELOG.md | 2 ++ packages/backend/src/core/RoleService.ts | 8 ++++++++ .../backend/src/server/api/endpoints/roles/notes.ts | 1 + .../src/server/api/stream/channels/role-timeline.ts | 11 ++++++++++- .../frontend/src/ui/deck/role-timeline-column.vue | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454974ca23..4b462783de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ - AiScriptを0.13.3に更新 - Fix: URLプレビューで情報が取得できなかった際の挙動を修正 - Fix: Safari、Firefoxでの新規登録時、パスワードマネージャーにメールアドレスが登録されていた挙動を修正 +- fix:ロールタイムラインが無効でも投稿が流れてしまう問題の修正 +- fix:ロールタイムラインにて全ての投稿が流れてしまう問題の修正 ## 13.12.2 diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index 68087ccc3b..130ec5ec8c 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -306,6 +306,14 @@ export class RoleService implements OnApplicationShutdown { return user.isRoot || (await this.getUserRoles(user.id)).some(r => r.isAdministrator); } + @bindThis + public async isExplorable(role: { id: Role['id']} | null): Promise { + if (role == null) return false; + const check = await this.rolesRepository.findOneBy({ id: role.id }); + if (check == null) return false; + return check.isExplorable; + } + @bindThis public async getModeratorIds(includeAdmins = true): Promise { const roles = await this.rolesCache.fetch(() => this.rolesRepository.findBy({})); diff --git a/packages/backend/src/server/api/endpoints/roles/notes.ts b/packages/backend/src/server/api/endpoints/roles/notes.ts index 6202c740f1..42e36cb04a 100644 --- a/packages/backend/src/server/api/endpoints/roles/notes.ts +++ b/packages/backend/src/server/api/endpoints/roles/notes.ts @@ -93,6 +93,7 @@ export default class extends Endpoint { const query = this.notesRepository.createQueryBuilder('note') .where('note.id IN (:...noteIds)', { noteIds: noteIds }) + .andWhere('(note.visibility = \'public\')') .innerJoinAndSelect('note.user', 'user') .leftJoinAndSelect('note.reply', 'reply') .leftJoinAndSelect('note.renote', 'renote') diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts index 9d106c8b2f..ab9c1aa0b5 100644 --- a/packages/backend/src/server/api/stream/channels/role-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts @@ -5,15 +5,17 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; import Channel from '../channel.js'; import { StreamMessages } from '../types.js'; +import { RoleService } from '@/core/RoleService.js'; class RoleTimelineChannel extends Channel { public readonly chName = 'roleTimeline'; public static shouldShare = false; public static requireCredential = false; private roleId: string; - + constructor( private noteEntityService: NoteEntityService, + private roleservice: RoleService, id: string, connection: Channel['connection'], @@ -34,6 +36,11 @@ class RoleTimelineChannel extends Channel { if (data.type === 'note') { const note = data.body; + if (!(await this.roleservice.isExplorable({ id: this.roleId }))) { + return; + } + if (note.visibility !== 'public') return; + // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (isUserRelated(note, this.userIdsWhoMeMuting)) return; // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する @@ -61,6 +68,7 @@ export class RoleTimelineChannelService { constructor( private noteEntityService: NoteEntityService, + private roleservice: RoleService, ) { } @@ -68,6 +76,7 @@ export class RoleTimelineChannelService { public create(id: string, connection: Channel['connection']): RoleTimelineChannel { return new RoleTimelineChannel( this.noteEntityService, + this.roleservice, id, connection, ); diff --git a/packages/frontend/src/ui/deck/role-timeline-column.vue b/packages/frontend/src/ui/deck/role-timeline-column.vue index 5783b3f071..e375a5884f 100644 --- a/packages/frontend/src/ui/deck/role-timeline-column.vue +++ b/packages/frontend/src/ui/deck/role-timeline-column.vue @@ -35,7 +35,7 @@ onMounted(() => { }); async function setRole() { - const roles = await os.api('roles/list'); + const roles = (await os.api('roles/list')).filter(x => x.isExplorable); const { canceled, result: role } = await os.select({ title: i18n.ts.role, items: roles.map(x => ({ From c713af8e23eef585dc3468806d5be8acfd608d8d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 May 2023 18:16:26 +0900 Subject: [PATCH 2/5] refactor --- .../frontend/src/components/MkUserInfo.vue | 2 +- packages/frontend/src/pages/clip.vue | 45 +++++++++---------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/packages/frontend/src/components/MkUserInfo.vue b/packages/frontend/src/components/MkUserInfo.vue index f560ebcd8a..fea3842a5b 100644 --- a/packages/frontend/src/components/MkUserInfo.vue +++ b/packages/frontend/src/components/MkUserInfo.vue @@ -105,7 +105,7 @@ defineProps<{ .mfm { display: -webkit-box; -webkit-line-clamp: 3; - -webkit-box-orient: vertical; + -webkit-box-orient: vertical; overflow: hidden; } diff --git a/packages/frontend/src/pages/clip.vue b/packages/frontend/src/pages/clip.vue index 654c44ae02..d5313099da 100644 --- a/packages/frontend/src/pages/clip.vue +++ b/packages/frontend/src/pages/clip.vue @@ -2,15 +2,15 @@ -
-
-
+
+
+
- {{ clip.favoritedCount }} - {{ clip.favoritedCount }} -
- + {{ clip.favoritedCount }} + {{ clip.favoritedCount }} +
+
@@ -147,25 +147,20 @@ definePageMetadata(computed(() => clip ? { } : null)); - From 1b78c6a3095965672c684a956b7787e1d7bf8a0f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 May 2023 20:52:15 +0900 Subject: [PATCH 3/5] refactor --- packages/frontend/src/pages/admin/abuses.vue | 2 +- packages/frontend/src/pages/admin/ads.vue | 18 ++-- .../src/pages/admin/announcements.vue | 2 +- .../frontend/src/pages/admin/database.vue | 2 +- .../src/pages/admin/email-settings.vue | 8 +- .../frontend/src/pages/admin/federation.vue | 27 +++--- packages/frontend/src/pages/admin/files.vue | 4 +- packages/frontend/src/pages/admin/index.vue | 2 +- .../src/pages/admin/instance-block.vue | 2 +- .../frontend/src/pages/admin/moderation.vue | 4 +- .../src/pages/admin/object-storage.vue | 6 +- .../src/pages/admin/overview.instances.vue | 24 +++--- .../frontend/src/pages/admin/overview.vue | 2 +- .../src/pages/admin/proxy-account.vue | 2 +- .../frontend/src/pages/admin/queue.chart.vue | 84 +++++++++---------- packages/frontend/src/pages/admin/queue.vue | 2 +- packages/frontend/src/pages/admin/relays.vue | 2 +- .../frontend/src/pages/admin/roles.edit.vue | 4 +- .../frontend/src/pages/admin/roles.editor.vue | 40 ++++----- .../frontend/src/pages/admin/server-rules.vue | 4 +- packages/frontend/src/pages/admin/users.vue | 6 +- .../frontend/src/pages/flash/flash-edit.vue | 2 +- .../frontend/src/pages/flash/flash-index.vue | 2 +- packages/frontend/src/pages/flash/flash.vue | 8 +- .../frontend/src/pages/my-antennas/create.vue | 2 +- .../frontend/src/pages/my-antennas/editor.vue | 2 +- .../frontend/src/pages/my-antennas/index.vue | 26 +++--- .../frontend/src/pages/my-clips/index.vue | 2 +- .../frontend/src/pages/my-lists/index.vue | 4 +- .../pages/page-editor/page-editor.blocks.vue | 4 +- .../src/pages/page-editor/page-editor.vue | 2 +- .../src/pages/settings/2fa.qrdialog.vue | 4 +- packages/frontend/src/pages/settings/2fa.vue | 2 +- .../frontend/src/pages/settings/accounts.vue | 2 +- .../src/pages/settings/custom-css.vue | 2 +- .../frontend/src/pages/settings/drive.vue | 6 +- .../frontend/src/pages/settings/email.vue | 4 +- .../frontend/src/pages/settings/index.vue | 2 +- .../frontend/src/pages/settings/migration.vue | 10 +-- .../frontend/src/pages/settings/navbar.vue | 4 +- .../src/pages/settings/notifications.vue | 2 +- .../frontend/src/pages/settings/plugin.vue | 2 +- .../frontend/src/pages/settings/privacy.vue | 20 ++--- .../frontend/src/pages/settings/reaction.vue | 2 +- .../frontend/src/pages/settings/roles.vue | 2 +- .../frontend/src/pages/settings/security.vue | 2 +- .../src/pages/settings/sounds.sound.vue | 2 +- .../frontend/src/pages/settings/sounds.vue | 2 +- .../pages/settings/statusbar.statusbar.vue | 10 +-- .../frontend/src/pages/settings/statusbar.vue | 2 +- .../src/pages/settings/theme.manage.vue | 6 +- .../frontend/src/pages/user/achievements.vue | 4 +- packages/frontend/src/pages/user/activity.vue | 2 +- packages/frontend/src/pages/user/clips.vue | 32 ++++--- .../frontend/src/pages/user/follow-list.vue | 18 ++-- .../frontend/src/pages/user/followers.vue | 2 +- .../frontend/src/pages/user/following.vue | 2 +- packages/frontend/src/pages/user/gallery.vue | 8 +- packages/frontend/src/pages/user/home.vue | 8 +- .../src/pages/user/index.timeline.vue | 4 +- packages/frontend/src/pages/user/index.vue | 2 +- packages/frontend/src/pages/user/pages.vue | 6 +- .../frontend/src/pages/user/reactions.vue | 52 ++++++------ packages/frontend/src/ui/_common_/common.vue | 10 +-- .../src/ui/_common_/navbar-for-mobile.vue | 8 +- packages/frontend/src/ui/_common_/navbar.vue | 8 +- .../frontend/src/ui/_common_/statusbars.vue | 6 +- packages/frontend/src/ui/classic.header.vue | 8 +- packages/frontend/src/ui/classic.sidebar.vue | 8 +- packages/frontend/src/ui/classic.vue | 4 +- packages/frontend/src/ui/deck.vue | 22 ++--- .../frontend/src/ui/deck/antenna-column.vue | 2 +- .../frontend/src/ui/deck/channel-column.vue | 4 +- packages/frontend/src/ui/deck/column-core.vue | 20 ++--- .../frontend/src/ui/deck/direct-column.vue | 2 +- packages/frontend/src/ui/deck/list-column.vue | 2 +- packages/frontend/src/ui/deck/main-column.vue | 2 +- .../frontend/src/ui/deck/mentions-column.vue | 2 +- .../src/ui/deck/notifications-column.vue | 4 +- .../src/ui/deck/role-timeline-column.vue | 2 +- packages/frontend/src/ui/deck/tl-column.vue | 2 +- .../frontend/src/ui/deck/widgets-column.vue | 4 +- packages/frontend/src/ui/universal.vue | 34 ++++---- .../frontend/src/ui/universal.widgets.vue | 2 +- packages/frontend/src/ui/visitor.vue | 24 +++--- 85 files changed, 341 insertions(+), 368 deletions(-) diff --git a/packages/frontend/src/pages/admin/abuses.vue b/packages/frontend/src/pages/admin/abuses.vue index f8200570f9..3bc5ee9723 100644 --- a/packages/frontend/src/pages/admin/abuses.vue +++ b/packages/frontend/src/pages/admin/abuses.vue @@ -1,7 +1,7 @@