Merge branch 'language' into 'main'

Support `language` param with L tags

See merge request soapbox-pub/ditto!365
This commit is contained in:
Alex Gleason 2024-06-07 15:10:43 +00:00
commit 6024586b19
2 changed files with 6 additions and 1 deletions

View File

@ -104,6 +104,11 @@ const createStatusController: AppController = async (c) => {
tags.push(['subject', data.spoiler_text]);
}
if (data.language) {
tags.push(['L', 'ISO-639-1']);
tags.push(['l', data.language, 'ISO-639-1']);
}
const media = data.media_ids?.length ? await getUnattachedMediaByIds(kysely, data.media_ids) : [];
const imeta: string[][] = media.map(({ data }) => {

View File

@ -100,7 +100,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
sensitive: !!cw,
spoiler_text: (cw ? cw[1] : subject?.[1]) || '',
visibility: 'public',
language: event.tags.find((tag) => tag[0] === 'lang')?.[1] || null,
language: event.tags.find((tag) => tag[0] === 'l' && tag[2] === 'ISO-639-1')?.[1] || null,
replies_count: event.event_stats?.replies_count ?? 0,
reblogs_count: event.event_stats?.reposts_count ?? 0,
favourites_count: event.event_stats?.reactions['+'] ?? 0,