mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-22 05:55:12 +00:00
remove duplicate isPureRenote
method
This commit is contained in:
parent
eb1e326813
commit
c9934c379f
2 changed files with 3 additions and 10 deletions
|
@ -146,7 +146,7 @@ type Option = {
|
||||||
app?: MiApp | null;
|
app?: MiApp | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PureRenoteOption = Option & { renote: MiNote } & ({ text?: null } | { cw?: null } | { reply?: null } | { poll?: null } | { files?: null | [] });
|
export type PureRenoteOption = Option & { renote: MiNote } & ({ text?: null } | { cw?: null } | { reply?: null } | { poll?: null } | { files?: null | [] });
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NoteCreateService implements OnApplicationShutdown {
|
export class NoteCreateService implements OnApplicationShutdown {
|
||||||
|
@ -824,7 +824,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private isPureRenote(note: Option): note is PureRenoteOption {
|
public isPureRenote(note: Option): note is PureRenoteOption {
|
||||||
return this.isRenote(note) && !this.isQuote(note);
|
return this.isRenote(note) && !this.isQuote(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,6 @@ type Option = {
|
||||||
editcount?: boolean | null;
|
editcount?: boolean | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PureRenoteOption = Option & { renote: MiNote } & ({ text?: null } | { cw?: null } | { reply?: null } | { poll?: null } | { files?: null | [] });
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NoteEditService implements OnApplicationShutdown {
|
export class NoteEditService implements OnApplicationShutdown {
|
||||||
#shutdownController = new AbortController();
|
#shutdownController = new AbortController();
|
||||||
|
@ -444,7 +442,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
|
|
||||||
if (user.host && !data.cw) {
|
if (user.host && !data.cw) {
|
||||||
await this.federatedInstanceService.fetch(user.host).then(async i => {
|
await this.federatedInstanceService.fetch(user.host).then(async i => {
|
||||||
if (i.isNSFW && !this.isPureRenote(data)) {
|
if (i.isNSFW && !this.noteCreateService.isPureRenote(data)) {
|
||||||
data.cw = 'Instance is marked as NSFW';
|
data.cw = 'Instance is marked as NSFW';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -789,11 +787,6 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
if (!user.noindex) this.index(note);
|
if (!user.noindex) this.index(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
|
||||||
private isPureRenote(note: Option): note is PureRenoteOption {
|
|
||||||
return this.isRenote(note) && !this.isQuote(note);
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private isRenote(note: Option): note is Option & { renote: MiNote } {
|
private isRenote(note: Option): note is Option & { renote: MiNote } {
|
||||||
return note.renote != null;
|
return note.renote != null;
|
||||||
|
|
Loading…
Reference in a new issue