This commit is contained in:
syuilo
2024-07-17 17:13:01 +09:00
parent 036f90133c
commit a2769d0733
9 changed files with 62 additions and 3 deletions

View File

@@ -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)),

View File

@@ -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 {

View File

@@ -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,