From 521db37ca7356a19f923d9ef7d567df46264a34a Mon Sep 17 00:00:00 2001 From: mappi Date: Fri, 24 Nov 2023 08:36:55 +0900 Subject: [PATCH 01/10] feat 12325 (#12425) --- locales/index.d.ts | 2 ++ locales/ja-JP.yml | 2 ++ packages/frontend/src/pages/admin/roles.vue | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 3ed2706298..654b64891c 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1642,7 +1642,9 @@ export interface Locale { "assignTarget": string; "descriptionOfAssignTarget": string; "manual": string; + "manualRoles": string; "conditional": string; + "conditionalRoles": string; "condition": string; "isConditionalRole": string; "isPublic": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 9b5dfce63d..26deccd365 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1552,7 +1552,9 @@ _role: assignTarget: "アサイン" descriptionOfAssignTarget: "マニュアルは誰がこのロールに含まれるかを手動で管理します。\nコンディショナルは条件を設定し、それに合致するユーザーが自動で含まれるようになります。" manual: "マニュアル" + manualRoles: "マニュアルロール" conditional: "コンディショナル" + conditionalRoles: "コンディショナルロール" condition: "条件" isConditionalRole: "これはコンディショナルロールです。" isPublic: "公開ロール" diff --git a/packages/frontend/src/pages/admin/roles.vue b/packages/frontend/src/pages/admin/roles.vue index d3f3773564..91cd86485f 100644 --- a/packages/frontend/src/pages/admin/roles.vue +++ b/packages/frontend/src/pages/admin/roles.vue @@ -198,13 +198,13 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._role.new }}
- +
- +
From 30b443de5594ef5b93717925961cd3ae290b67c1 Mon Sep 17 00:00:00 2001 From: Camilla Ett Date: Fri, 24 Nov 2023 08:37:27 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat(frontend):=20=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AE=E6=A8=AA=E5=B9=85?= =?UTF-8?q?=E3=82=92150px=E3=81=AB=E5=88=B6=E9=99=90=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=81=8C=E9=81=B8=E3=81=B9=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=20(#12416)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(frontend): リアクションの横幅を150pxに制限するかどうかユーザーが選べるように * localesの変更をjs-JP.ymlのみに修正し、日本語をより分かりやすく * クラス名を.icon から .limitWidthに変更 --- locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + .../frontend/src/components/MkReactionsViewer.reaction.vue | 4 ++-- packages/frontend/src/pages/settings/general.vue | 3 +++ packages/frontend/src/store.ts | 4 ++++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 654b64891c..e6761641ab 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1040,6 +1040,7 @@ export interface Locale { "enableChartsForFederatedInstances": string; "showClipButtonInNoteFooter": string; "reactionsDisplaySize": string; + "limitWidthOfReaction": string; "noteIdOrUrl": string; "video": string; "videos": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 26deccd365..58e0dd0b19 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1037,6 +1037,7 @@ enableChartsForRemoteUser: "リモートユーザーのチャートを生成" enableChartsForFederatedInstances: "リモートサーバーのチャートを生成" showClipButtonInNoteFooter: "ノートのアクションにクリップを追加" reactionsDisplaySize: "リアクションの表示サイズ" +limitWidthOfReaction: "リアクションの最大横幅を制限し、縮小して表示する" noteIdOrUrl: "ノートIDまたはURL" video: "動画" videos: "動画" diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue index 2b850016c5..9a107c3674 100644 --- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue +++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue @@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only :class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle, [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]" @click="toggleReaction()" > - + {{ count }} @@ -188,7 +188,7 @@ if (!mock) { } } -.icon { +.limitWidth { max-width: 150px; } diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 06d3789829..313b5efc46 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -56,6 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only + {{ i18n.ts.limitWidthOfReaction }}
@@ -226,6 +227,7 @@ const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serve const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover')); const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showClipButtonInNoteFooter')); const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize')); +const limitWidthOfReaction = computed(defaultStore.makeGetterSetter('limitWidthOfReaction')); const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes')); const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v)); const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal')); @@ -290,6 +292,7 @@ watch([ overridedDeviceKind, mediaListWithOneImageAppearance, reactionsDisplaySize, + limitWidthOfReaction, highlightSensitiveMedia, keepScreenOn, disableStreamingTimeline, diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 6d95ddba35..12660e9e8d 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -330,6 +330,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: 'medium' as 'small' | 'medium' | 'large', }, + limitWidthOfReaction: { + where: 'device', + default: true, + }, forceShowAds: { where: 'device', default: false, From 97c10ed1e5ef5c010e8aae6042efeb6bd939757b Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 Nov 2023 09:20:34 +0900 Subject: [PATCH 03/10] Update index.d.ts --- locales/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index e6761641ab..042c7750e1 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1040,7 +1040,7 @@ export interface Locale { "enableChartsForFederatedInstances": string; "showClipButtonInNoteFooter": string; "reactionsDisplaySize": string; - "limitWidthOfReaction": string; + "limitWidthOfReaction": string; "noteIdOrUrl": string; "video": string; "videos": string; From 06ed64f26f799ada108c8f2df315414b27681765 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 Nov 2023 09:20:41 +0900 Subject: [PATCH 04/10] update node to 20.10.0 --- .devcontainer/devcontainer.json | 2 +- .github/workflows/get-api-diff.yml | 2 +- .github/workflows/test-backend.yml | 2 +- .github/workflows/test-frontend.yml | 4 ++-- .github/workflows/test-misskey-js.yml | 2 +- .github/workflows/test-production.yml | 2 +- .node-version | 2 +- Dockerfile | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0583a66960..e409adf644 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,7 @@ "version": "8.9.2" }, "ghcr.io/devcontainers/features/node:1": { - "version": "20.5.1" + "version": "20.10.0" } }, "forwardPorts": [3000], diff --git a/.github/workflows/get-api-diff.yml b/.github/workflows/get-api-diff.yml index e6de226e6b..281e2058a6 100644 --- a/.github/workflows/get-api-diff.yml +++ b/.github/workflows/get-api-diff.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - node-version: [20.5.1] + node-version: [20.10.0] api-json-name: [api-base.json, api-head.json] include: - api-json-name: api-base.json diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index cbf0275620..6e8327ca07 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [20.5.1] + node-version: [20.10.0] services: postgres: diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 9575e22d02..50c225189d 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [20.5.1] + node-version: [20.10.0] steps: - uses: actions/checkout@v4.1.1 @@ -51,7 +51,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [20.5.1] + node-version: [20.10.0] browser: [chrome] services: diff --git a/.github/workflows/test-misskey-js.yml b/.github/workflows/test-misskey-js.yml index ae1ddf31d1..76e170b3e3 100644 --- a/.github/workflows/test-misskey-js.yml +++ b/.github/workflows/test-misskey-js.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [20.5.1] + node-version: [20.10.0] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: diff --git a/.github/workflows/test-production.yml b/.github/workflows/test-production.yml index d9bfb12be5..694fa1a8f5 100644 --- a/.github/workflows/test-production.yml +++ b/.github/workflows/test-production.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [20.5.1] + node-version: [20.10.0] steps: - uses: actions/checkout@v4.1.1 diff --git a/.node-version b/.node-version index 7cc2069986..d5a159609d 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.5.1 +20.10.0 diff --git a/Dockerfile b/Dockerfile index d397fe01cd..028a3976d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax = docker/dockerfile:1.4 -ARG NODE_VERSION=20.5.1-bullseye +ARG NODE_VERSION=20.10.0-bullseye # build assets & compile TypeScript From f7bdf5a2c0d69b3c7a18078ea7ca55106460a0a3 Mon Sep 17 00:00:00 2001 From: woxtu Date: Fri, 24 Nov 2023 09:48:36 +0900 Subject: [PATCH 05/10] Replace deprecated `Repository.findOneById()` (#12426) --- packages/backend/src/server/api/endpoints/notes/create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 513b77b98a..c5d42dabe4 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -262,7 +262,7 @@ export default class extends Endpoint { // eslint- if (renote.channelId && renote.channelId !== ps.channelId) { // チャンネルのノートに対しリノート要求がきたとき、チャンネル外へのリノート可否をチェック // リノートのユースケースのうち、チャンネル内→チャンネル外は少数だと考えられるため、JOINはせず必要な時に都度取得する - const renoteChannel = await this.channelsRepository.findOneById(renote.channelId); + const renoteChannel = await this.channelsRepository.findOneBy({ id: renote.channelId }); if (renoteChannel == null) { // リノートしたいノートが書き込まれているチャンネルが無い throw new ApiError(meta.errors.noSuchChannel); From 536f08c401e82b9d34e2435f62ab2ac96473e77b Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Fri, 24 Nov 2023 15:09:25 +0900 Subject: [PATCH 06/10] fix: hard mute limit not applied (#12428) * fix: hard mute limit not applied * Update CHANGELOG.md --- CHANGELOG.md | 1 + packages/backend/src/server/api/endpoints/i/update.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c49aa0e899..5678da25a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### General - Feat: メールアドレスの認証にverifymail.ioを使えるように (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/971ba07a44550f68d2ba31c62066db2d43a0caed) - Feat: モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能を追加 (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/e0eb5a752f6e5616d6312bb7c9790302f9dbff83) +- Feat: TL上からノートが見えなくなるワードミュートであるハードミュートを追加 - Fix: MFM `$[unixtime ]` に不正な値を入力した際に発生する各種エラーを修正 ### Client diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 8ba29c5658..b045c01189 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -243,7 +243,7 @@ export default class extends Endpoint { // eslint- function checkMuteWordCount(mutedWords: (string[] | string)[], limit: number) { // TODO: ちゃんと数える - const length = JSON.stringify(ps.mutedWords).length; + const length = JSON.stringify(mutedWords).length; if (length > limit) { throw new ApiError(meta.errors.tooManyMutedWords); } From 9c84055f504d89b0ec26d89589dcb3be1d395740 Mon Sep 17 00:00:00 2001 From: Camilla Ett Date: Fri, 24 Nov 2023 16:19:37 +0900 Subject: [PATCH 07/10] =?UTF-8?q?Feat(frontend):=20=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=AD=E3=83=BC=E3=83=AB=E3=83=91=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E3=80=8C=E9=80=9A=E5=A0=B1=E3=80=8D=E3=81=AB=E3=81=8A=E3=81=84?= =?UTF-8?q?=E3=81=A6=E3=80=81=E9=80=9A=E5=A0=B1=E8=80=85=E3=82=82=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=81=A7=E9=A3=9B=E3=81=B9=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=20(#12427)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/MkAbuseReport.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkAbuseReport.vue b/packages/frontend/src/components/MkAbuseReport.vue index 66114b8734..2c7be319cb 100644 --- a/packages/frontend/src/components/MkAbuseReport.vue +++ b/packages/frontend/src/components/MkAbuseReport.vue @@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-
{{ i18n.ts.reporter }}:
+
{{ i18n.ts.reporter }}: @{{ report.reporter.username }}
{{ i18n.ts.moderator }}: From 252efe8252ce5555ebc79b6a348610e9a37d9152 Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Fri, 24 Nov 2023 20:19:46 +0900 Subject: [PATCH 08/10] =?UTF-8?q?fix:=20=E7=89=B9=E5=AE=9A=E3=81=AE?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=B8=8B=E3=81=A7=E3=83=81=E3=83=A3=E3=83=B3?= =?UTF-8?q?=E3=83=8D=E3=83=AB=E3=82=84=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=88=E4=B8=80=E8=A6=A7=E3=81=AB?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=88=E3=81=8C?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=8F=E3=81=AA?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=20(#1243?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 特定の条件下でチャンネルやユーザーのノート一覧に最新のノートが表示されなくなる問題を修正 * update: CHANGELOG.md --- CHANGELOG.md | 1 + .../backend/src/server/api/endpoints/channels/timeline.ts | 6 +++++- packages/backend/src/server/api/endpoints/users/notes.ts | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5678da25a4..64720ef482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Fix: ロールタイムラインが保存されない問題を修正 - Fix: api.jsonの生成ロジックを改善 #12402 - Fix: 招待コードが使い回せる問題を修正 +- Fix: 特定の条件下でチャンネルやユーザーのノート一覧に最新のノートが表示されなくなる問題を修正 ## 2023.11.1 diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index fae4249c8a..4ca7325f30 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -15,6 +15,7 @@ import { IdService } from '@/core/IdService.js'; import { FunoutTimelineService } from '@/core/FunoutTimelineService.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { CacheService } from '@/core/CacheService.js'; +import { MetaService } from '@/core/MetaService.js'; import { ApiError } from '../../error.js'; export const meta = { @@ -72,12 +73,15 @@ export default class extends Endpoint { // eslint- private funoutTimelineService: FunoutTimelineService, private cacheService: CacheService, private activeUsersChart: ActiveUsersChart, + private metaService: MetaService, ) { super(meta, paramDef, async (ps, me) => { const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null); const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.gen(ps.sinceDate!) : null); const isRangeSpecified = untilId != null && sinceId != null; + const serverSettings = await this.metaService.fetch(); + const channel = await this.channelsRepository.findOneBy({ id: ps.channelId, }); @@ -88,7 +92,7 @@ export default class extends Endpoint { // eslint- if (me) this.activeUsersChart.read(me); - if (isRangeSpecified || sinceId == null) { + if (serverSettings.enableFanoutTimeline && (isRangeSpecified || sinceId == null)) { const [ userIdsWhoMeMuting, ] = me ? await Promise.all([ diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index a43e572922..2e7d939b12 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -15,6 +15,7 @@ import { IdService } from '@/core/IdService.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { QueryService } from '@/core/QueryService.js'; import { FunoutTimelineService } from '@/core/FunoutTimelineService.js'; +import { MetaService } from '@/core/MetaService.js'; import { ApiError } from '../../error.js'; export const meta = { @@ -71,6 +72,7 @@ export default class extends Endpoint { // eslint- private cacheService: CacheService, private idService: IdService, private funoutTimelineService: FunoutTimelineService, + private metaService: MetaService, ) { super(meta, paramDef, async (ps, me) => { const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null); @@ -78,7 +80,9 @@ export default class extends Endpoint { // eslint- const isRangeSpecified = untilId != null && sinceId != null; const isSelf = me && (me.id === ps.userId); - if (isRangeSpecified || sinceId == null) { + const serverSettings = await this.metaService.fetch(); + + if (serverSettings.enableFanoutTimeline && (isRangeSpecified || sinceId == null)) { const [ userIdsWhoMeMuting, ] = me ? await Promise.all([ From da3064343bfc76e8402adf5cd5ed68824c1e42da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 24 Nov 2023 06:37:06 +0900 Subject: [PATCH 09/10] =?UTF-8?q?enhance(frontend):=20=E7=B5=B5=E6=96=87?= =?UTF-8?q?=E5=AD=97=E3=81=AE=E3=82=AA=E3=83=BC=E3=83=88=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AA=E3=83=BC=E3=83=88=E3=81=AE=E3=82=A2=E3=83=AB?= =?UTF-8?q?=E3=82=B4=E3=83=AA=E3=82=BA=E3=83=A0=E3=81=AE=E6=94=B9=E5=96=84?= =?UTF-8?q?=20(MisskeyIO#261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 実際は同じ絵文字なら重複してサジェストに出ないように * エイリアスではない絵文字>前方一致>部分一致>あいまい検索順で表示されるようになるように --- .../src/components/MkAutocomplete.vue | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/packages/frontend/src/components/MkAutocomplete.vue b/packages/frontend/src/components/MkAutocomplete.vue index a0f4961116..c1fcbd7ac1 100644 --- a/packages/frontend/src/components/MkAutocomplete.vue +++ b/packages/frontend/src/components/MkAutocomplete.vue @@ -265,7 +265,7 @@ function emojiAutoComplete(query: string | null, emojiDb: EmojiDef[], max = 30): // 前方一致(エイリアスなし) emojiDb.some(x => { if (x.name.startsWith(query) && !x.aliasOf) { - matched.set(x.name, { emoji: x, score: query.length }); + matched.set(x.name, { emoji: x, score: query.length + 1 }); } return matched.size === max; }); @@ -273,8 +273,8 @@ function emojiAutoComplete(query: string | null, emojiDb: EmojiDef[], max = 30): // 前方一致(エイリアス込み) if (matched.size < max) { emojiDb.some(x => { - if (x.name.startsWith(query)) { - matched.set(x.name, { emoji: x, score: query.length }); + if (x.name.startsWith(query) && !matched.has(x.aliasOf ?? x.name)) { + matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length }); } return matched.size === max; }); @@ -283,36 +283,32 @@ function emojiAutoComplete(query: string | null, emojiDb: EmojiDef[], max = 30): // 部分一致(エイリアス込み) if (matched.size < max) { emojiDb.some(x => { - if (x.name.includes(query)) { - matched.set(x.name, { emoji: x, score: query.length }); + if (x.name.includes(query) && !matched.has(x.aliasOf ?? x.name)) { + matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length - 1 }); } return matched.size === max; }); } - // 簡易あいまい検索 - if (matched.size < max) { + // 簡易あいまい検索(3文字以上) + if (matched.size < max && query.length > 3) { const queryChars = [...query]; const hitEmojis = new Map(); for (const x of emojiDb) { - // クエリ文字列の1文字単位で絵文字名にヒットするかを見る - // ただし、過剰に検出されるのを防ぐためクエリ文字列に登場する順番で絵文字名を走査する + // 文字列の位置を進めながら、クエリの文字を順番に探す - let queryCharHitPos = 0; - let queryCharHitCount = 0; - for (let idx = 0; idx < queryChars.length; idx++) { - queryCharHitPos = x.name.indexOf(queryChars[idx], queryCharHitPos); - if (queryCharHitPos <= -1) { - break; - } - - queryCharHitCount++; + let pos = 0; + let hit = 0; + for (const c of queryChars) { + pos = x.name.indexOf(c, pos); + if (pos <= -1) break; + hit++; } - // ヒット数が少なすぎると検索結果が汚れるので調節する - if (queryCharHitCount > 2) { - hitEmojis.set(x.name, { emoji: x, score: queryCharHitCount }); + // 半分以上の文字が含まれていればヒットとする + if (hit > Math.ceil(queryChars.length / 2) && hit - 2 > (matched.get(x.aliasOf ?? x.name)?.score ?? 0)) { + hitEmojis.set(x.aliasOf ?? x.name, { emoji: x, score: hit - 2 }); } } From 95095ee8d11a07938c183d4391de0a76ade31d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Fri, 24 Nov 2023 21:11:18 +0900 Subject: [PATCH 10/10] =?UTF-8?q?enhance(frontend):=20=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=81=AERaw=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=82=92=E8=AA=AD=E3=82=81=E3=82=8B=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92=E5=BE=A9=E6=B4=BB=E3=81=95=E3=81=9B=E3=82=8B=20(#1243?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * (add) User raw page * Update Changelog * fix lint --- CHANGELOG.md | 1 + packages/frontend/src/pages/user/index.vue | 6 + packages/frontend/src/pages/user/raw.vue | 130 +++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 packages/frontend/src/pages/user/raw.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index 64720ef482..0215e7e735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ ### Client - Enhance: 絵文字のオートコンプリート機能強化 #12364 +- Enhance: ユーザーのRawデータを表示するページが復活 - fix: 「設定のバックアップ」で一部の項目がバックアップに含まれていなかった問題を修正 - Fix: ウィジェットのジョブキューにて音声の発音方法変更に追従できていなかったのを修正 #12367 - Fix: コードエディタが正しく表示されない問題を修正 diff --git a/packages/frontend/src/pages/user/index.vue b/packages/frontend/src/pages/user/index.vue index 7550d5bcb2..50cc9a3311 100644 --- a/packages/frontend/src/pages/user/index.vue +++ b/packages/frontend/src/pages/user/index.vue @@ -18,6 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only +
@@ -44,6 +45,7 @@ const XLists = defineAsyncComponent(() => import('./lists.vue')); const XPages = defineAsyncComponent(() => import('./pages.vue')); const XFlashs = defineAsyncComponent(() => import('./flashs.vue')); const XGallery = defineAsyncComponent(() => import('./gallery.vue')); +const XRaw = defineAsyncComponent(() => import('./raw.vue')); const props = withDefaults(defineProps<{ acct: string; @@ -112,6 +114,10 @@ const headerTabs = $computed(() => user ? [{ key: 'gallery', title: i18n.ts.gallery, icon: 'ti ti-icons', +}, { + key: 'raw', + title: 'Raw', + icon: 'ti ti-code', }] : []); definePageMetadata(computed(() => user ? { diff --git a/packages/frontend/src/pages/user/raw.vue b/packages/frontend/src/pages/user/raw.vue new file mode 100644 index 0000000000..0c0bfc29ca --- /dev/null +++ b/packages/frontend/src/pages/user/raw.vue @@ -0,0 +1,130 @@ + + + + + + +