diff options
| author | Julia <julia@insertdomain.name> | 2025-06-19 21:35:18 +0000 |
|---|---|---|
| committer | Julia <julia@insertdomain.name> | 2025-06-19 21:35:18 +0000 |
| commit | a77c32b17da63d3932b219f74152cce023a30f4a (patch) | |
| tree | d2a05796e942c8f250bbd01369eab0cbe5a14531 /packages/frontend/src/utility/getNoteUrls.ts | |
| parent | merge: release 2025.4.2 (!1051) (diff) | |
| parent | Merge branch 'develop' into release/2025.4.3 (diff) | |
| download | sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.tar.gz sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.tar.bz2 sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.zip | |
merge: prepare release 2025.4.3 (!1125)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1125
Approved-by: Marie <github@yuugi.dev>
Approved-by: Julia <julia@insertdomain.name>
Diffstat (limited to 'packages/frontend/src/utility/getNoteUrls.ts')
| -rw-r--r-- | packages/frontend/src/utility/getNoteUrls.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/frontend/src/utility/getNoteUrls.ts b/packages/frontend/src/utility/getNoteUrls.ts new file mode 100644 index 0000000000..efd014cbf0 --- /dev/null +++ b/packages/frontend/src/utility/getNoteUrls.ts @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import * as config from '@@/js/config.js'; +import type * as Misskey from 'misskey-js'; + +export function getNoteUrls(note: Misskey.entities.Note): string[] { + const urls: string[] = [ + // Any note + `${config.url}/notes/${note.id}`, + ]; + + // Remote note + if (note.url) urls.push(note.url); + if (note.uri) urls.push(note.uri); + + if (note.reply) { + // Any Reply + urls.push(`${config.url}/notes/${note.reply.id}`); + // Remote Reply + if (note.reply.url) urls.push(note.reply.url); + if (note.reply.uri) urls.push(note.reply.uri); + } + + if (note.renote) { + // Any Renote + urls.push(`${config.url}/notes/${note.renote.id}`); + // Remote Renote + if (note.renote.url) urls.push(note.renote.url); + if (note.renote.uri) urls.push(note.renote.uri); + } + + if (note.renote?.renote) { + // Any Quote + urls.push(`${config.url}/notes/${note.renote.renote.id}`); + // Remote Quote + if (note.renote.renote.url) urls.push(note.renote.renote.url); + if (note.renote.renote.uri) urls.push(note.renote.renote.uri); + } + + return urls; +} |