diff --git a/packages/backend/migration/1698840138000-add-can-renote-to-channel.js b/packages/backend/migration/1698840138000-add-allow-renote-to-external.js similarity index 50% rename from packages/backend/migration/1698840138000-add-can-renote-to-channel.js rename to packages/backend/migration/1698840138000-add-allow-renote-to-external.js index 62b9559a44..0edf298841 100644 --- a/packages/backend/migration/1698840138000-add-can-renote-to-channel.js +++ b/packages/backend/migration/1698840138000-add-allow-renote-to-external.js @@ -3,14 +3,14 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export class AddCanRenoteToChannel1698840138000 { - name = 'AddCanRenoteToChannel1698840138000' +export class AddAllowRenoteToExternal1698840138000 { + name = 'AddAllowRenoteToExternal1698840138000' async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel" ADD "canRenote" boolean NOT NULL DEFAULT true`); + await queryRunner.query(`ALTER TABLE "channel" ADD "allowRenoteToExternal" boolean NOT NULL DEFAULT true`); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel" DROP COLUMN "canRenote"`); + await queryRunner.query(`ALTER TABLE "channel" DROP COLUMN "allowRenoteToExternal"`); } } diff --git a/packages/backend/src/core/entities/ChannelEntityService.ts b/packages/backend/src/core/entities/ChannelEntityService.ts index b2ed32fe40..305946b8a6 100644 --- a/packages/backend/src/core/entities/ChannelEntityService.ts +++ b/packages/backend/src/core/entities/ChannelEntityService.ts @@ -85,7 +85,7 @@ export class ChannelEntityService { usersCount: channel.usersCount, notesCount: channel.notesCount, isSensitive: channel.isSensitive, - canRenote: channel.canRenote, + allowRenoteToExternal: channel.allowRenoteToExternal, ...(me ? { isFollowing, diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 25260cec6b..c49dad8e79 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -350,7 +350,7 @@ export class NoteEntityService implements OnModuleInit { name: channel.name, color: channel.color, isSensitive: channel.isSensitive, - canRenote: channel.canRenote, + allowRenoteToExternal: channel.allowRenoteToExternal, } : undefined, mentions: note.mentions.length > 0 ? note.mentions : undefined, uri: note.uri ?? undefined, diff --git a/packages/backend/src/models/Channel.ts b/packages/backend/src/models/Channel.ts index 72616009d8..a7f9e262b1 100644 --- a/packages/backend/src/models/Channel.ts +++ b/packages/backend/src/models/Channel.ts @@ -97,5 +97,5 @@ export class MiChannel { @Column('boolean', { default: true, }) - public canRenote: boolean; + public allowRenoteToExternal: boolean; } diff --git a/packages/backend/src/models/json-schema/channel.ts b/packages/backend/src/models/json-schema/channel.ts index 1d18bd23c1..8f9770cdc5 100644 --- a/packages/backend/src/models/json-schema/channel.ts +++ b/packages/backend/src/models/json-schema/channel.ts @@ -76,7 +76,7 @@ export const packedChannelSchema = { type: 'boolean', optional: false, nullable: false, }, - canRenote: { + allowRenoteToExternal: { type: 'boolean', optional: false, nullable: false, }, diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index b33ca4e538..3dd1eddd01 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -50,7 +50,7 @@ export const paramDef = { bannerId: { type: 'string', format: 'misskey:id', nullable: true }, color: { type: 'string', minLength: 1, maxLength: 16 }, isSensitive: { type: 'boolean', nullable: true }, - canRenote: { type: 'boolean', nullable: true }, + allowRenoteToExternal: { type: 'boolean', nullable: true }, }, required: ['name'], } as const; @@ -88,7 +88,7 @@ export default class extends Endpoint { // eslint- bannerId: banner ? banner.id : null, isSensitive: ps.isSensitive ?? false, ...(ps.color !== undefined ? { color: ps.color } : {}), - canRenote: ps.canRenote ?? true, + allowRenoteToExternal: ps.allowRenoteToExternal ?? true, } as MiChannel).then(x => this.channelsRepository.findOneByOrFail(x.identifiers[0])); return await this.channelEntityService.pack(channel, me); diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index b79c260b6f..93d02e4a12 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -61,7 +61,7 @@ export const paramDef = { }, color: { type: 'string', minLength: 1, maxLength: 16 }, isSensitive: { type: 'boolean', nullable: true }, - canRenote: { type: 'boolean', nullable: true }, + allowRenoteToExternal: { type: 'boolean', nullable: true }, }, required: ['channelId'], } as const; @@ -116,7 +116,7 @@ export default class extends Endpoint { // eslint- ...(typeof ps.isArchived === 'boolean' ? { isArchived: ps.isArchived } : {}), ...(banner ? { bannerId: banner.id } : {}), ...(typeof ps.isSensitive === 'boolean' ? { isSensitive: ps.isSensitive } : {}), - ...(typeof ps.canRenote === 'boolean' ? { canRenote: ps.canRenote } : {}), + ...(typeof ps.allowRenoteToExternal === 'boolean' ? { allowRenoteToExternal: ps.allowRenoteToExternal } : {}), }); return await this.channelEntityService.pack(channel.id, me); diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 3d30fe20f6..59b65bb7ba 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -260,7 +260,7 @@ export default class extends Endpoint { // eslint- if (renoteChannel == null) { // リノートしたいノートが書き込まれているチャンネルが無い throw new ApiError(meta.errors.noSuchChannel); - } else if (!renoteChannel.canRenote) { + } else if (!renoteChannel.allowRenoteToExternal) { // リノート作成のリクエストだが、対象チャンネルがリノート禁止だった場合 throw new ApiError(meta.errors.cannotRenoteOutsideOfChannel); } diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 13be6fc38e..91d12683dd 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -329,48 +329,48 @@ function renote(viaKeyboard = false) { }]); } - if (!appearNote.channel || appearNote.channel?.canRenote) { - normalRenoteItems.push(...[{ - text: i18n.ts.renote, - icon: 'ti ti-repeat', - action: () => { - const el = renoteButton.value as HTMLElement | null | undefined; - if (el) { - const rect = el.getBoundingClientRect(); - const x = rect.left + (el.offsetWidth / 2); - const y = rect.top + (el.offsetHeight / 2); - os.popup(MkRippleEffect, {x, y}, {}, 'end'); - } + if (!appearNote.channel || appearNote.channel?.allowRenoteToExternal) { + normalRenoteItems.push(...[{ + text: i18n.ts.renote, + icon: 'ti ti-repeat', + action: () => { + const el = renoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } - const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility; - const localOnly = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly; + const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility; + const localOnly = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly; - let visibility = appearNote.visibility; - visibility = smallerVisibility(visibility, configuredVisibility); - if (appearNote.channel?.isSensitive) { - visibility = smallerVisibility(visibility, 'home'); - } + let visibility = appearNote.visibility; + visibility = smallerVisibility(visibility, configuredVisibility); + if (appearNote.channel?.isSensitive) { + visibility = smallerVisibility(visibility, 'home'); + } - if (!props.mock) { - os.api('notes/create', { - localOnly, - visibility, - renoteId: appearNote.id, - }).then(() => { - os.toast(i18n.ts.renoted); - }); - } - }, - }, (props.mock) ? undefined : { - text: i18n.ts.quote, - icon: 'ti ti-quote', - action: () => { - os.post({ - renote: appearNote, - }); - }, - }]); - } + if (!props.mock) { + os.api('notes/create', { + localOnly, + visibility, + renoteId: appearNote.id, + }).then(() => { + os.toast(i18n.ts.renoted); + }); + } + }, + }, (props.mock) ? undefined : { + text: i18n.ts.quote, + icon: 'ti ti-quote', + action: () => { + os.post({ + renote: appearNote, + }); + }, + }]); + } // nullを挟むことで区切り線を出せる const renoteItems = [ diff --git a/packages/frontend/src/pages/channel-editor.vue b/packages/frontend/src/pages/channel-editor.vue index 02770b2347..5256ea4f11 100644 --- a/packages/frontend/src/pages/channel-editor.vue +++ b/packages/frontend/src/pages/channel-editor.vue @@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -97,7 +97,7 @@ let bannerUrl = $ref(null); let bannerId = $ref(null); let color = $ref('#000'); let isSensitive = $ref(false); -let canRenote = $ref(true); +let allowRenoteToExternal = $ref(true); const pinnedNotes = ref([]); watch(() => bannerId, async () => { @@ -126,7 +126,7 @@ async function fetchChannel() { id, })); color = channel.color; - canRenote = channel.canRenote; + allowRenoteToExternal = channel.allowRenoteToExternal; } fetchChannel(); @@ -156,7 +156,7 @@ function save() { pinnedNoteIds: pinnedNotes.value.map(x => x.id), color: color, isSensitive: isSensitive, - canRenote: canRenote, + allowRenoteToExternal: allowRenoteToExternal, }; if (props.channelId) { diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 0689d3c6f9..a0d0b7528d 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -529,7 +529,7 @@ export type Channel = { notesCount: number; usersCount: number; isSensitive: boolean; - canRenote: boolean; + allowRenoteToExternal: boolean; }; export type Following = {