diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-03-24 13:01:19 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-03-27 19:51:43 -0400 |
| commit | 81f7346f80467e7e715fba18489342079a51088c (patch) | |
| tree | 1629b69ab0bff8f419746c5d9b66ee84c8e2f6b4 /packages/backend/src/misc | |
| parent | handle errors in mastodon search endpoints (diff) | |
| download | sharkey-81f7346f80467e7e715fba18489342079a51088c.tar.gz sharkey-81f7346f80467e7e715fba18489342079a51088c.tar.bz2 sharkey-81f7346f80467e7e715fba18489342079a51088c.zip | |
fixes to CW and quote conversion for mastodon
Diffstat (limited to 'packages/backend/src/misc')
| -rw-r--r-- | packages/backend/src/misc/append-content-warning.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/backend/src/misc/append-content-warning.ts b/packages/backend/src/misc/append-content-warning.ts index 152cd6760e..9f61776b1d 100644 --- a/packages/backend/src/misc/append-content-warning.ts +++ b/packages/backend/src/misc/append-content-warning.ts @@ -14,10 +14,13 @@ * @param additional Content warning to append * @param reverse If true, then the additional CW will be prepended instead of appended. */ -export function appendContentWarning(original: string | null | undefined, additional: string, reverse = false): string { +export function appendContentWarning(original: string | null | undefined, additional: string, reverse?: boolean): string; +export function appendContentWarning(original: string, additional: string | null | undefined, reverse?: boolean): string; +export function appendContentWarning(original: string | null | undefined, additional: string | null | undefined, reverse?: boolean): string | null; +export function appendContentWarning(original: string | null | undefined, additional: string | null | undefined, reverse = false): string | null { // Easy case - if original is empty, then additional replaces it. if (!original) { - return additional; + return additional ?? null; } // Easy case - if the additional CW is empty, then don't append it. |