mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
[mastodon-client] Fix handling of undefined in normalizeComposeOptions & normalizeEditOptions
This commit is contained in:
parent
5d1bfd2e50
commit
60f314cb87
1 changed files with 8 additions and 8 deletions
|
@ -318,15 +318,15 @@ export class NoteHelpers {
|
||||||
public static normalizeComposeOptions(body: any): MastodonEntity.StatusCreationRequest {
|
public static normalizeComposeOptions(body: any): MastodonEntity.StatusCreationRequest {
|
||||||
const result: MastodonEntity.StatusCreationRequest = {};
|
const result: MastodonEntity.StatusCreationRequest = {};
|
||||||
|
|
||||||
if (body.status !== null && body.status.trim().length > 0)
|
if (body.status != null && body.status.trim().length > 0)
|
||||||
result.text = body.status;
|
result.text = body.status;
|
||||||
if (body.spoiler_text !== null && body.spoiler_text.trim().length > 0)
|
if (body.spoiler_text != null && body.spoiler_text.trim().length > 0)
|
||||||
result.spoiler_text = body.spoiler_text;
|
result.spoiler_text = body.spoiler_text;
|
||||||
if (body.visibility !== null)
|
if (body.visibility != null)
|
||||||
result.visibility = VisibilityConverter.decode(body.visibility);
|
result.visibility = VisibilityConverter.decode(body.visibility);
|
||||||
if (body.language !== null)
|
if (body.language != null)
|
||||||
result.language = body.language;
|
result.language = body.language;
|
||||||
if (body.scheduled_at !== null)
|
if (body.scheduled_at != null)
|
||||||
result.scheduled_at = new Date(Date.parse(body.scheduled_at));
|
result.scheduled_at = new Date(Date.parse(body.scheduled_at));
|
||||||
if (body.in_reply_to_id)
|
if (body.in_reply_to_id)
|
||||||
result.in_reply_to_id = convertId(body.in_reply_to_id, IdType.IceshrimpId);
|
result.in_reply_to_id = convertId(body.in_reply_to_id, IdType.IceshrimpId);
|
||||||
|
@ -352,11 +352,11 @@ export class NoteHelpers {
|
||||||
public static normalizeEditOptions(body: any): MastodonEntity.StatusEditRequest {
|
public static normalizeEditOptions(body: any): MastodonEntity.StatusEditRequest {
|
||||||
const result: MastodonEntity.StatusEditRequest = {};
|
const result: MastodonEntity.StatusEditRequest = {};
|
||||||
|
|
||||||
if (body.status !== null && body.status.trim().length > 0)
|
if (body.status != null && body.status.trim().length > 0)
|
||||||
result.text = body.status;
|
result.text = body.status;
|
||||||
if (body.spoiler_text !== null && body.spoiler_text.trim().length > 0)
|
if (body.spoiler_text != null && body.spoiler_text.trim().length > 0)
|
||||||
result.spoiler_text = body.spoiler_text;
|
result.spoiler_text = body.spoiler_text;
|
||||||
if (body.language !== null)
|
if (body.language != null)
|
||||||
result.language = body.language;
|
result.language = body.language;
|
||||||
if (body.media_ids)
|
if (body.media_ids)
|
||||||
result.media_ids = body.media_ids && body.media_ids.length > 0
|
result.media_ids = body.media_ids && body.media_ids.length > 0
|
||||||
|
|
Loading…
Reference in a new issue