hideNotesInSensitiveChannel -> excludeNotesInSensitiveChannel
This commit is contained in:
parent
0d18c0169f
commit
c500e4392a
11 changed files with 37 additions and 21 deletions
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class ExcludeNotesInSensitiveChannel1744075766000 {
|
||||
name = 'ExcludeNotesInSensitiveChannel1744075766000'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "antenna" RENAME COLUMN "hideNotesInSensitiveChannel" TO "excludeNotesInSensitiveChannel"`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "antenna" RENAME COLUMN "excludeNotesInSensitiveChannel" TO "hideNotesInSensitiveChannel"`);
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ export class AntennaService implements OnApplicationShutdown {
|
|||
if (note.visibility === 'specified') return false;
|
||||
if (note.visibility === 'followers') return false;
|
||||
|
||||
if (antenna.hideNotesInSensitiveChannel && note.channel?.isSensitive) return false;
|
||||
if (antenna.excludeNotesInSensitiveChannel && note.channel?.isSensitive) return false;
|
||||
|
||||
if (antenna.excludeBots && noteUser.isBot) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export class AntennaEntityService {
|
|||
excludeBots: antenna.excludeBots,
|
||||
withReplies: antenna.withReplies,
|
||||
withFile: antenna.withFile,
|
||||
hideNotesInSensitiveChannel: antenna.hideNotesInSensitiveChannel,
|
||||
excludeNotesInSensitiveChannel: antenna.excludeNotesInSensitiveChannel,
|
||||
isActive: antenna.isActive,
|
||||
hasUnreadNote: false, // TODO
|
||||
notify: false, // 後方互換性のため
|
||||
|
|
|
|||
|
|
@ -104,5 +104,5 @@ export class MiAntenna {
|
|||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public hideNotesInSensitiveChannel: boolean;
|
||||
public excludeNotesInSensitiveChannel: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export const packedAntennaSchema = {
|
|||
optional: false, nullable: false,
|
||||
default: false,
|
||||
},
|
||||
hideNotesInSensitiveChannel: {
|
||||
excludeNotesInSensitiveChannel: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
default: false,
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const paramDef = {
|
|||
excludeBots: { type: 'boolean' },
|
||||
withReplies: { type: 'boolean' },
|
||||
withFile: { type: 'boolean' },
|
||||
hideNotesInSensitiveChannel: { type: 'boolean' },
|
||||
excludeNotesInSensitiveChannel: { type: 'boolean' },
|
||||
},
|
||||
required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile'],
|
||||
} as const;
|
||||
|
|
@ -134,7 +134,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
excludeBots: ps.excludeBots,
|
||||
withReplies: ps.withReplies,
|
||||
withFile: ps.withFile,
|
||||
hideNotesInSensitiveChannel: ps.hideNotesInSensitiveChannel,
|
||||
excludeNotesInSensitiveChannel: ps.excludeNotesInSensitiveChannel,
|
||||
});
|
||||
|
||||
this.globalEventService.publishInternalEvent('antennaCreated', antenna);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export const paramDef = {
|
|||
excludeBots: { type: 'boolean' },
|
||||
withReplies: { type: 'boolean' },
|
||||
withFile: { type: 'boolean' },
|
||||
hideNotesInSensitiveChannel: { type: 'boolean' },
|
||||
excludeNotesInSensitiveChannel: { type: 'boolean' },
|
||||
},
|
||||
required: ['antennaId'],
|
||||
} as const;
|
||||
|
|
@ -130,7 +130,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
excludeBots: ps.excludeBots,
|
||||
withReplies: ps.withReplies,
|
||||
withFile: ps.withFile,
|
||||
hideNotesInSensitiveChannel: ps.hideNotesInSensitiveChannel,
|
||||
excludeNotesInSensitiveChannel: ps.excludeNotesInSensitiveChannel,
|
||||
isActive: true,
|
||||
lastUsedAt: new Date(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ describe('アンテナ', () => {
|
|||
caseSensitive: false,
|
||||
createdAt: new Date(response.createdAt).toISOString(),
|
||||
excludeKeywords: [['']],
|
||||
hideNotesInSensitiveChannel: false,
|
||||
excludeNotesInSensitiveChannel: false,
|
||||
hasUnreadNote: false,
|
||||
isActive: true,
|
||||
keywords: [['keyword']],
|
||||
|
|
@ -218,8 +218,8 @@ describe('アンテナ', () => {
|
|||
{ parameters: () => ({ withReplies: true }) },
|
||||
{ parameters: () => ({ withFile: false }) },
|
||||
{ parameters: () => ({ withFile: true }) },
|
||||
{ parameters: () => ({ hideNotesInSensitiveChannel: false }) },
|
||||
{ parameters: () => ({ hideNotesInSensitiveChannel: true }) },
|
||||
{ parameters: () => ({ excludeNotesInSensitiveChannel: false }) },
|
||||
{ parameters: () => ({ excludeNotesInSensitiveChannel: true }) },
|
||||
];
|
||||
test.each(antennaParamPattern)('を作成できること($#)', async ({ parameters }) => {
|
||||
const response = await successfulApiCall({
|
||||
|
|
@ -633,7 +633,7 @@ describe('アンテナ', () => {
|
|||
const keyword = 'キーワード';
|
||||
const antenna = await successfulApiCall({
|
||||
endpoint: 'antennas/create',
|
||||
parameters: { ...defaultParam, keywords: [[keyword]], hideNotesInSensitiveChannel: true },
|
||||
parameters: { ...defaultParam, keywords: [[keyword]], excludeNotesInSensitiveChannel: true },
|
||||
user: alice,
|
||||
});
|
||||
const nonSensitiveChannel = await successfulApiCall({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue