fix(api): 🐛 Give correct URI/URL values for notes in API

This commit is contained in:
Jesse Wierzbinski 2024-06-09 15:17:03 -10:00
parent c6c71bebb7
commit 11369649c0
No known key found for this signature in database

View file

@ -723,7 +723,7 @@ export class Note {
sensitive: data.sensitive,
spoiler_text: data.spoilerText,
tags: [],
uri: data.uri || this.getMastoURI(),
uri: data.uri || this.getURI(),
visibility: data.visibility as APIStatus["visibility"],
url: data.uri || this.getMastoURI(),
bookmarked: false,
@ -747,7 +747,10 @@ export class Note {
}
getMastoURI() {
return `/@${this.getAuthor().getUser().username}/${this.id}`;
return new URL(
`/@${this.getAuthor().getUser().username}/${this.id}`,
config.http.base_url,
).toString();
}
toLysand(): typeof EntityValidator.$Note {