コメント対応(canRenote->allowRenoteToExternal)
This commit is contained in:
parent
9b69dab4b2
commit
59d3d49070
|
|
@ -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"`);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ export class ChannelEntityService {
|
|||
usersCount: channel.usersCount,
|
||||
notesCount: channel.notesCount,
|
||||
isSensitive: channel.isSensitive,
|
||||
canRenote: channel.canRenote,
|
||||
allowRenoteToExternal: channel.allowRenoteToExternal,
|
||||
|
||||
...(me ? {
|
||||
isFollowing,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -97,5 +97,5 @@ export class MiChannel {
|
|||
@Column('boolean', {
|
||||
default: true,
|
||||
})
|
||||
public canRenote: boolean;
|
||||
public allowRenoteToExternal: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export const packedChannelSchema = {
|
|||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
canRenote: {
|
||||
allowRenoteToExternal: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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<typeof meta, typeof paramDef> { // 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);
|
||||
|
|
|
|||
|
|
@ -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<typeof meta, typeof paramDef> { // 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);
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (renoteChannel == null) {
|
||||
// リノートしたいノートが書き込まれているチャンネルが無い
|
||||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
} else if (!renoteChannel.canRenote) {
|
||||
} else if (!renoteChannel.allowRenoteToExternal) {
|
||||
// リノート作成のリクエストだが、対象チャンネルがリノート禁止だった場合
|
||||
throw new ApiError(meta.errors.cannotRenoteOutsideOfChannel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #label>{{ i18n.ts.sensitive }}</template>
|
||||
</MkSwitch>
|
||||
|
||||
<MkSwitch v-model="canRenote">
|
||||
<MkSwitch v-model="allowRenoteToExternal">
|
||||
<template #label>{{ i18n.ts._channel.allowRenoteToExternal }}</template>
|
||||
</MkSwitch>
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ let bannerUrl = $ref<string | null>(null);
|
|||
let bannerId = $ref<string | null>(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) {
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ export type Channel = {
|
|||
notesCount: number;
|
||||
usersCount: number;
|
||||
isSensitive: boolean;
|
||||
canRenote: boolean;
|
||||
allowRenoteToExternal: boolean;
|
||||
};
|
||||
|
||||
export type Following = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue