From 28aa99b2737fd3d66f8c438477c96aa94b0059ed Mon Sep 17 00:00:00 2001 From: CenTdemeern1 Date: Wed, 2 Oct 2024 23:49:30 +0200 Subject: [PATCH 01/20] Implement "Show Below Avatar" for Avatar Decorations --- locales/en-US.yml | 1 + .../src/core/entities/UserEntityService.ts | 1 + packages/backend/src/models/User.ts | 1 + .../backend/src/models/json-schema/user.ts | 4 +++ .../src/server/api/endpoints/i/update.ts | 2 ++ .../src/components/global/MkAvatar.vue | 32 +++++++++++-------- .../settings/avatar-decoration.decoration.vue | 3 +- .../settings/avatar-decoration.dialog.vue | 9 ++++++ .../src/pages/settings/avatar-decoration.vue | 3 ++ 9 files changed, 42 insertions(+), 14 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 6d24bb5b41..2d3c5c53b6 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1277,6 +1277,7 @@ detach: "Remove" detachAll: "Remove All" angle: "Angle" flip: "Flip" +showBelowAvatar: "Show Below Avatar" showAvatarDecorations: "Show avatar decorations" releaseToRefresh: "Release to refresh" refreshing: "Refreshing..." diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 2b1c4d5c63..40830f86b4 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -525,6 +525,7 @@ export class UserEntityService implements OnModuleInit { flipH: ud.flipH || undefined, offsetX: ud.offsetX || undefined, offsetY: ud.offsetY || undefined, + showBelow: ud.showBelow || undefined, url: decorations.find(d => d.id === ud.id)!.url, }))) : [], isBot: user.isBot, diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts index b0910133c9..cbebd0102d 100644 --- a/packages/backend/src/models/User.ts +++ b/packages/backend/src/models/User.ts @@ -170,6 +170,7 @@ export class MiUser { flipH?: boolean; offsetX?: number; offsetY?: number; + showBelow?: boolean; }[]; @Index() diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 33a3efd453..249b9bba38 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -104,6 +104,10 @@ export const packedUserLiteSchema = { type: 'number', nullable: false, optional: true, }, + showBelow: { + type: 'boolean', + nullable: false, optional: true, + }, }, }, }, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 6cc22e7994..f9b8061249 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -159,6 +159,7 @@ export const paramDef = { flipH: { type: 'boolean', nullable: true }, offsetX: { type: 'number', nullable: true, maximum: 0.25, minimum: -0.25 }, offsetY: { type: 'number', nullable: true, maximum: 0.25, minimum: -0.25 }, + showBelow: { type: 'boolean', nullable: true }, }, required: ['id'], } }, @@ -417,6 +418,7 @@ export default class extends Endpoint { // eslint- flipH: d.flipH ?? false, offsetX: d.offsetX ?? 0, offsetY: d.offsetY ?? 0, + showBelow: d.showBelow ?? false, })); } diff --git a/packages/frontend/src/components/global/MkAvatar.vue b/packages/frontend/src/components/global/MkAvatar.vue index de62fe12a9..ce6985d907 100644 --- a/packages/frontend/src/components/global/MkAvatar.vue +++ b/packages/frontend/src/components/global/MkAvatar.vue @@ -7,6 +7,20 @@ SPDX-License-Identifier: AGPL-3.0-only +
@@ -23,19 +37,6 @@ SPDX-License-Identifier: AGPL-3.0-only
-
@@ -113,6 +114,11 @@ function getDecorationOffset(decoration: Omit) { + const zIndex = decoration.showBelow ? 0 : 1; + return zIndex === 1 ? undefined : `${zIndex}`; +} + const color = ref(); watch(() => props.user.avatarBlurhash, () => { diff --git a/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue b/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue index 0767fa7864..9f7852a71d 100644 --- a/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue +++ b/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue @@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only @click="emit('click')" >
{{ decoration.name }}
- + @@ -32,6 +32,7 @@ const props = defineProps<{ flipH?: boolean; offsetX?: number; offsetY?: number; + showBelow?: boolean; }>(); const emit = defineEmits<{ diff --git a/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue b/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue index ce1d4e48d8..400b365ca6 100644 --- a/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue +++ b/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue @@ -29,6 +29,9 @@ SPDX-License-Identifier: AGPL-3.0-only + + + @@ -71,12 +74,14 @@ const emit = defineEmits<{ flipH: boolean; offsetX: number; offsetY: number; + showBelow: boolean; }): void; (ev: 'update', payload: { angle: number; flipH: boolean; offsetX: number; offsetY: number; + showBelow: boolean; }): void; (ev: 'detach'): void; }>(); @@ -87,6 +92,7 @@ const angle = ref((props.usingIndex != null ? $i.avatarDecorations[props.usingIn const flipH = ref((props.usingIndex != null ? $i.avatarDecorations[props.usingIndex].flipH : null) ?? false); const offsetX = ref((props.usingIndex != null ? $i.avatarDecorations[props.usingIndex].offsetX : null) ?? 0); const offsetY = ref((props.usingIndex != null ? $i.avatarDecorations[props.usingIndex].offsetY : null) ?? 0); +const showBelow = ref((props.usingIndex != null ? $i.avatarDecorations[props.usingIndex].showBelow : null) ?? false); const decorationsForPreview = computed(() => { const decoration = { @@ -96,6 +102,7 @@ const decorationsForPreview = computed(() => { flipH: flipH.value, offsetX: offsetX.value, offsetY: offsetY.value, + showBelow: showBelow.value, }; const decorations = [...$i.avatarDecorations]; if (props.usingIndex != null) { @@ -116,6 +123,7 @@ async function update() { flipH: flipH.value, offsetX: offsetX.value, offsetY: offsetY.value, + showBelow: showBelow.value, }); dialog.value.close(); } @@ -126,6 +134,7 @@ async function attach() { flipH: flipH.value, offsetX: offsetX.value, offsetY: offsetY.value, + showBelow: showBelow.value, }); dialog.value.close(); } diff --git a/packages/frontend/src/pages/settings/avatar-decoration.vue b/packages/frontend/src/pages/settings/avatar-decoration.vue index 77229d3349..5324a6b7f7 100644 --- a/packages/frontend/src/pages/settings/avatar-decoration.vue +++ b/packages/frontend/src/pages/settings/avatar-decoration.vue @@ -21,6 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only :flipH="avatarDecoration.flipH" :offsetX="avatarDecoration.offsetX" :offsetY="avatarDecoration.offsetY" + :showBelow="avatarDecoration.showBelow" :active="true" @click="openDecoration(avatarDecoration, i)" /> @@ -78,6 +79,7 @@ function openDecoration(avatarDecoration, index?: number) { flipH: payload.flipH, offsetX: payload.offsetX, offsetY: payload.offsetY, + showBelow: payload.showBelow, }; const update = [...$i.avatarDecorations, decoration]; await os.apiWithDialog('i/update', { @@ -92,6 +94,7 @@ function openDecoration(avatarDecoration, index?: number) { flipH: payload.flipH, offsetX: payload.offsetX, offsetY: payload.offsetY, + showBelow: payload.showBelow, }; const update = [...$i.avatarDecorations]; update[index] = decoration; From e43c58a9555b6a241455a11f7671d0e72c37bdfd Mon Sep 17 00:00:00 2001 From: CenTdemeern1 Date: Thu, 3 Oct 2024 16:55:24 +0200 Subject: [PATCH 02/20] Simplify the getDecorationZIndex function --- packages/frontend/src/components/global/MkAvatar.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/frontend/src/components/global/MkAvatar.vue b/packages/frontend/src/components/global/MkAvatar.vue index ce6985d907..e9df7083e3 100644 --- a/packages/frontend/src/components/global/MkAvatar.vue +++ b/packages/frontend/src/components/global/MkAvatar.vue @@ -115,8 +115,7 @@ function getDecorationOffset(decoration: Omit) { - const zIndex = decoration.showBelow ? 0 : 1; - return zIndex === 1 ? undefined : `${zIndex}`; + return decoration.showBelow ? '0' : undefined; } const color = ref(); From d55c86548d265fa6702c9235738f30862dff2b5a Mon Sep 17 00:00:00 2001 From: Leah Date: Mon, 26 Aug 2024 20:27:08 +0200 Subject: [PATCH 03/20] You can now disable cat speak in settings (client side) --- locales/en-US.yml | 3 ++- locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + .../src/components/global/MkMisskeyFlavoredMarkdown.ts | 2 ++ packages/frontend/src/pages/settings/general.vue | 2 ++ packages/frontend/src/store.ts | 4 ++++ 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 13ddcc4b5c..f04d82d378 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -184,7 +184,7 @@ flagAsBotDescription: "Enable this option if this account is controlled by a pro flagAsCat: "Mark this account as a cat" flagAsCatDescription: "Enable this option to mark this account as a cat." flagSpeakAsCat: "Speak as a cat" -flagSpeakAsCatDescription: "Your posts will get nyanified when in cat mode." +flagSpeakAsCatDescription: "Your posts will get nyanified when in cat mode. If this isnt working please check that you dont have 'Disable cat speak' on under General/Note Display" flagShowTimelineReplies: "Show replies in timeline" flagShowTimelineRepliesDescription: "Shows replies of users to notes of other users in the timeline if turned on." autoAcceptFollowed: "Automatically approve follow requests from users you're following" @@ -1103,6 +1103,7 @@ letsLookAtTimeline: "Have a look at the timeline" disableFederationConfirm: "Really disable federation?" disableFederationConfirmWarn: "Even if defederated, posts will continue to be public unless set otherwise. You usually do not need to do this." disableFederationOk: "Disable" +disableCatSpeak: "Disable cat speak" invitationRequiredToRegister: "This instance is invite-only. You must enter a valid invite code sign up." approvalRequiredToRegister: "This instance is only accepting users who specify a reason for registration." emailNotSupported: "This instance does not support sending emails" diff --git a/locales/index.d.ts b/locales/index.d.ts index 0239da7071..f53436e62e 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -4429,6 +4429,10 @@ export interface Locale extends ILocale { * 連合なしにする */ "disableFederationOk": string; + /** + * 猫の話し方を無効にする + */ + "disableCatSpeak": string; /** * 現在このサーバーは招待制です。招待コードをお持ちの方のみ登録できます。 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index caed03910f..210e3b2935 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1103,6 +1103,7 @@ letsLookAtTimeline: "タイムラインを見てみる" disableFederationConfirm: "連合なしにしますか?" disableFederationConfirmWarn: "連合なしにしても投稿は非公開になりません。ほとんどの場合、連合なしにする必要はありません。" disableFederationOk: "連合なしにする" +disableCatSpeak: "猫の話し方を無効にする" invitationRequiredToRegister: "現在このサーバーは招待制です。招待コードをお持ちの方のみ登録できます。" approvalRequiredToRegister: "現在このサーバーは承認制です。参加したい理由を記入し、承認された方のみ登録できます。" emailNotSupported: "このサーバーではメール配信はサポートされていません" diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index a3a2b9f319..f42e8b1e80 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -89,6 +89,8 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext ast.map((token): VNode | string | (VNode | string)[] => { + if (defaultStore.state.disableCatSpeak) + disableNyaize = true switch (token.type) { case 'text': { let text = token.props.text.replace(/(\r\n|\n|\r)/g, '\n'); diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 637c1b24b9..8cd1caf6bd 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -68,6 +68,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.showGapBetweenNotesInTimeline }} {{ i18n.ts.loadRawImages }} {{ i18n.ts.showTickerOnReplies }} + {{ i18n.ts.disableCatSpeak }}