add "reject quotes" toggle at user and instance level

+ improve, cleanup, and de-duplicate quote resolution
+ add warning message when quote cannot be loaded
+ add "process error" framework to display warnings when a note cannot be correctly loaded from another instance
This commit is contained in:
Hazelnoot 2025-02-15 23:08:02 -05:00
parent 93ffd4611c
commit 292d3b9229
36 changed files with 466 additions and 88 deletions

View file

@ -164,6 +164,15 @@ export class MiInstance {
})
public rejectReports: boolean;
/**
* If true, quote posts from this instance will be downgraded to normal posts.
* The quote will be stripped and a process error will be generated.
*/
@Column('boolean', {
default: false,
})
public rejectQuotes: boolean;
@Column('varchar', {
length: 16384, default: '',
})

View file

@ -203,6 +203,17 @@ export class MiNote {
@JoinColumn()
public channel: MiChannel | null;
/**
* List of non-fatal errors encountered while processing (creating or updating) this note.
* Entries can be a translation key (which will be queried from the "_processErrors" section) or a raw string.
* Errors will be displayed to the user when viewing the note.
*/
@Column('text', {
array: true,
nullable: true,
})
public processErrors: string[] | null;
//#region Denormalized fields
@Index()
@Column('varchar', {

View file

@ -348,6 +348,15 @@ export class MiUser {
})
public mandatoryCW: string | null;
/**
* If true, quote posts from this user will be downgraded to normal posts.
* The quote will be stripped and a process error will be generated.
*/
@Column('boolean', {
default: false,
})
public rejectQuotes: boolean;
constructor(data: Partial<MiUser>) {
if (data == null) return;

View file

@ -126,6 +126,11 @@ export const packedFederationInstanceSchema = {
optional: false,
nullable: false,
},
rejectQuotes: {
type: 'boolean',
optional: false,
nullable: false,
},
moderationNote: {
type: 'string',
optional: true, nullable: true,

View file

@ -256,6 +256,14 @@ export const packedNoteSchema = {
type: 'number',
optional: true, nullable: false,
},
processErrors: {
type: 'array',
optional: true, nullable: true,
items: {
type: 'string',
optional: false, nullable: false,
},
},
myReaction: {
type: 'string',

View file

@ -445,6 +445,10 @@ export const packedUserDetailedNotMeOnlySchema = {
type: 'boolean',
nullable: false, optional: true,
},
rejectQuotes: {
type: 'boolean',
nullable: false, optional: true,
},
//#region relations
isFollowing: {
type: 'boolean',