feat: ユーザを除外できるアンテナ
This commit is contained in:
parent
2b6dbd4fcb
commit
89a04c3b0d
|
@ -0,0 +1,10 @@
|
||||||
|
export class UserBlacklistAnntena1689325027964 {
|
||||||
|
name = 'UserBlacklistAnntena1689325027964'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TYPE "antenna_src_enum" ADD VALUE 'users_blacklist' AFTER 'list'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -129,6 +129,12 @@ export class AntennaService implements OnApplicationShutdown {
|
||||||
return this.utilityService.getFullApAccount(username, host).toLowerCase();
|
return this.utilityService.getFullApAccount(username, host).toLowerCase();
|
||||||
});
|
});
|
||||||
if (!accts.includes(this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase())) return false;
|
if (!accts.includes(this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase())) return false;
|
||||||
|
} else if (antenna.src === 'users_blacklist') {
|
||||||
|
const accts = antenna.users.map(x => {
|
||||||
|
const { username, host } = Acct.parse(x);
|
||||||
|
return this.utilityService.getFullApAccount(username, host).toLowerCase();
|
||||||
|
});
|
||||||
|
if (accts.includes(this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase())) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const keywords = antenna.keywords
|
const keywords = antenna.keywords
|
||||||
|
|
|
@ -36,8 +36,8 @@ export class Antenna {
|
||||||
})
|
})
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
||||||
@Column('enum', { enum: ['home', 'all', 'users', 'list'] })
|
@Column('enum', { enum: ['home', 'all', 'users', 'list', 'users_blacklist'] })
|
||||||
public src: 'home' | 'all' | 'users' | 'list';
|
public src: 'home' | 'all' | 'users' | 'list' | 'users_blacklist';
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
|
|
@ -42,7 +42,7 @@ export const packedAntennaSchema = {
|
||||||
src: {
|
src: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
enum: ['home', 'all', 'users', 'list'],
|
enum: ['home', 'all', 'users', 'list', 'users_blacklist'],
|
||||||
},
|
},
|
||||||
userListId: {
|
userListId: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
Loading…
Reference in New Issue