wip
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class MultipleReactions1721117896543 {
|
||||
name = 'MultipleReactions1721117896543';
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query('DROP INDEX "public"."IDX_ad0c221b25672daf2df320a817"');
|
||||
await queryRunner.query('CREATE UNIQUE INDEX "IDX_a7751b74317122d11575bff31c" ON "note_reaction" ("userId", "noteId", "reaction") ');
|
||||
await queryRunner.query('CREATE INDEX "IDX_ad0c221b25672daf2df320a817" ON "note_reaction" ("userId", "noteId") ');
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query('DROP INDEX "public"."IDX_ad0c221b25672daf2df320a817"');
|
||||
await queryRunner.query('DROP INDEX "public"."IDX_a7751b74317122d11575bff31c"');
|
||||
await queryRunner.query('CREATE UNIQUE INDEX "IDX_ad0c221b25672daf2df320a817" ON "note_reaction" ("userId", "noteId") ');
|
||||
}
|
||||
}
|
@@ -49,6 +49,7 @@ export type RolePolicies = {
|
||||
alwaysMarkNsfw: boolean;
|
||||
canUpdateBioMedia: boolean;
|
||||
pinLimit: number;
|
||||
reactionsPerNoteLimit: number;
|
||||
antennaLimit: number;
|
||||
wordMuteLimit: number;
|
||||
webhookLimit: number;
|
||||
@@ -78,6 +79,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
|
||||
alwaysMarkNsfw: false,
|
||||
canUpdateBioMedia: true,
|
||||
pinLimit: 5,
|
||||
reactionsPerNoteLimit: 1,
|
||||
antennaLimit: 5,
|
||||
wordMuteLimit: 200,
|
||||
webhookLimit: 3,
|
||||
@@ -380,6 +382,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||
alwaysMarkNsfw: calc('alwaysMarkNsfw', vs => vs.some(v => v === true)),
|
||||
canUpdateBioMedia: calc('canUpdateBioMedia', vs => vs.some(v => v === true)),
|
||||
pinLimit: calc('pinLimit', vs => Math.max(...vs)),
|
||||
reactionsPerNoteLimit: calc('reactionsPerNoteLimit', vs => Math.max(...vs)),
|
||||
antennaLimit: calc('antennaLimit', vs => Math.max(...vs)),
|
||||
wordMuteLimit: calc('wordMuteLimit', vs => Math.max(...vs)),
|
||||
webhookLimit: calc('webhookLimit', vs => Math.max(...vs)),
|
||||
|
@@ -170,10 +170,10 @@ export class NoteEntityService implements OnModuleInit {
|
||||
|
||||
@bindThis
|
||||
public async populateMyReaction(note: { id: MiNote['id']; reactions: MiNote['reactions']; reactionAndUserPairCache?: MiNote['reactionAndUserPairCache']; }, meId: MiUser['id'], _hint_?: {
|
||||
myReactions: Map<MiNote['id'], string | null>;
|
||||
myReactionsMap: Map<MiNote['id'], string | null>;
|
||||
}) {
|
||||
if (_hint_?.myReactions) {
|
||||
const reaction = _hint_.myReactions.get(note.id);
|
||||
if (_hint_?.myReactionsMap) {
|
||||
const reaction = _hint_.myReactionsMap.get(note.id);
|
||||
if (reaction) {
|
||||
return this.reactionService.convertLegacyReaction(reaction);
|
||||
} else {
|
||||
|
@@ -236,6 +236,10 @@ export const packedRolePoliciesSchema = {
|
||||
type: 'integer',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
reactionsPerNoteLimit: {
|
||||
type: 'integer',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
antennaLimit: {
|
||||
type: 'integer',
|
||||
optional: false, nullable: false,
|
||||
|
Reference in New Issue
Block a user