mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 07:25:12 +00:00
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/536 Approved-by: Amelia Yukii <amelia.yukii@shourai.de> Approved-by: Marie <marie@kaifa.ch>
This commit is contained in:
commit
b2088e60b7
3 changed files with 14 additions and 2 deletions
|
@ -627,6 +627,14 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
userHost: user.host,
|
||||
});
|
||||
|
||||
// should really not happen, but better safe than sorry
|
||||
if (data.reply?.id === insert.id) {
|
||||
throw new Error("A note can't reply to itself");
|
||||
}
|
||||
if (data.renote?.id === insert.id) {
|
||||
throw new Error("A note can't renote itself");
|
||||
}
|
||||
|
||||
if (data.uri != null) insert.uri = data.uri;
|
||||
if (data.url != null) insert.url = data.url;
|
||||
|
||||
|
|
|
@ -299,6 +299,10 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
if (data.renote) {
|
||||
if (data.renote.id === oldnote.id) {
|
||||
throw new Error("A note can't renote itself");
|
||||
}
|
||||
|
||||
switch (data.renote.visibility) {
|
||||
case 'public':
|
||||
// public noteは無条件にrenote可能
|
||||
|
|
|
@ -251,7 +251,7 @@ export class ApNoteService {
|
|||
> => {
|
||||
if (typeof uri !== 'string' || !/^https?:/.test(uri)) return { status: 'permerror' };
|
||||
try {
|
||||
const res = await this.resolveNote(uri);
|
||||
const res = await this.resolveNote(uri, { resolver });
|
||||
if (res == null) return { status: 'permerror' };
|
||||
return { status: 'ok', res };
|
||||
} catch (e) {
|
||||
|
@ -478,7 +478,7 @@ export class ApNoteService {
|
|||
> => {
|
||||
if (!/^https?:/.test(uri)) return { status: 'permerror' };
|
||||
try {
|
||||
const res = await this.resolveNote(uri);
|
||||
const res = await this.resolveNote(uri, { resolver });
|
||||
if (res == null) return { status: 'permerror' };
|
||||
return { status: 'ok', res };
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue