fix: send null for empty edited_at in mastodon api
This commit is contained in:
		
							parent
							
								
									126248e58d
								
							
						
					
					
						commit
						e779c1e667
					
				
					 13 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -83,7 +83,7 @@ export class MastoConverters {
 | 
			
		|||
		}
 | 
			
		||||
		return 'unknown';
 | 
			
		||||
	}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
	public encodeFile(f: any): Entity.Attachment {
 | 
			
		||||
		return {
 | 
			
		||||
			id: f.id,
 | 
			
		||||
| 
						 | 
				
			
			@ -279,7 +279,8 @@ export class MastoConverters {
 | 
			
		|||
			emoji_reactions: status.emoji_reactions,
 | 
			
		||||
			bookmarked: false,
 | 
			
		||||
			quote: isQuote ? await this.convertReblog(status.reblog) : false,
 | 
			
		||||
			edited_at: note.updatedAt?.toISOString(),
 | 
			
		||||
			// optional chaining cannot be used, as it evaluates to undefined, not null
 | 
			
		||||
			edited_at: note.updatedAt ? note.updatedAt.toISOString() : null,
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,7 @@ namespace Entity {
 | 
			
		|||
    content: string
 | 
			
		||||
    plain_content?: string | null
 | 
			
		||||
    created_at: string
 | 
			
		||||
    edited_at: string | null
 | 
			
		||||
    emojis: Emoji[]
 | 
			
		||||
    replies_count: number
 | 
			
		||||
    reblogs_count: number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -725,6 +725,7 @@ namespace FriendicaAPI {
 | 
			
		|||
      content: s.content,
 | 
			
		||||
      plain_content: null,
 | 
			
		||||
      created_at: s.created_at,
 | 
			
		||||
      edited_at: s.edited_at || null,
 | 
			
		||||
      emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
 | 
			
		||||
      replies_count: s.replies_count,
 | 
			
		||||
      reblogs_count: s.reblogs_count,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@ namespace FriendicaEntity {
 | 
			
		|||
    reblog: Status | null
 | 
			
		||||
    content: string
 | 
			
		||||
    created_at: string
 | 
			
		||||
    edited_at?: string | null
 | 
			
		||||
    emojis: Emoji[]
 | 
			
		||||
    replies_count: number
 | 
			
		||||
    reblogs_count: number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -628,6 +628,7 @@ namespace MastodonAPI {
 | 
			
		|||
      content: s.content,
 | 
			
		||||
      plain_content: null,
 | 
			
		||||
      created_at: s.created_at,
 | 
			
		||||
      edited_at: s.edited_at || null,
 | 
			
		||||
      emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
 | 
			
		||||
      replies_count: s.replies_count,
 | 
			
		||||
      reblogs_count: s.reblogs_count,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ namespace MastodonEntity {
 | 
			
		|||
    reblog: Status | null
 | 
			
		||||
    content: string
 | 
			
		||||
    created_at: string
 | 
			
		||||
    edited_at?: string | null
 | 
			
		||||
    emojis: Emoji[]
 | 
			
		||||
    replies_count: number
 | 
			
		||||
    reblogs_count: number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -283,6 +283,7 @@ namespace MisskeyAPI {
 | 
			
		|||
          : '',
 | 
			
		||||
        plain_content: n.text ? n.text : null,
 | 
			
		||||
        created_at: n.createdAt,
 | 
			
		||||
        edited_at: n.updatedAt || null,
 | 
			
		||||
        emojis: mapEmojis(n.emojis).concat(mapReactionEmojis(n.reactionEmojis)),
 | 
			
		||||
        replies_count: n.repliesCount,
 | 
			
		||||
        reblogs_count: n.renoteCount,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ namespace MisskeyEntity {
 | 
			
		|||
  export type Note = {
 | 
			
		||||
    id: string
 | 
			
		||||
    createdAt: string
 | 
			
		||||
    updatedAt?: string | null
 | 
			
		||||
    userId: string
 | 
			
		||||
    user: User
 | 
			
		||||
    text: string | null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -357,6 +357,7 @@ namespace PleromaAPI {
 | 
			
		|||
      content: s.content,
 | 
			
		||||
      plain_content: s.pleroma.content?.['text/plain'] ? s.pleroma.content['text/plain'] : null,
 | 
			
		||||
      created_at: s.created_at,
 | 
			
		||||
      edited_at: s.edited_at || null,
 | 
			
		||||
      emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
 | 
			
		||||
      replies_count: s.replies_count,
 | 
			
		||||
      reblogs_count: s.reblogs_count,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ namespace PleromaEntity {
 | 
			
		|||
    reblog: Status | null
 | 
			
		||||
    content: string
 | 
			
		||||
    created_at: string
 | 
			
		||||
    edited_at?: string | null
 | 
			
		||||
    emojis: Emoji[]
 | 
			
		||||
    replies_count: number
 | 
			
		||||
    reblogs_count: number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,7 @@ const status: Entity.Status = {
 | 
			
		|||
  content: 'hoge',
 | 
			
		||||
  plain_content: null,
 | 
			
		||||
  created_at: '2019-03-26T21:40:32',
 | 
			
		||||
  edited_at: null,
 | 
			
		||||
  emojis: [],
 | 
			
		||||
  replies_count: 0,
 | 
			
		||||
  reblogs_count: 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,7 @@ const status: Entity.Status = {
 | 
			
		|||
  content: 'hoge',
 | 
			
		||||
  plain_content: 'hoge',
 | 
			
		||||
  created_at: '2019-03-26T21:40:32',
 | 
			
		||||
  edited_at: null,
 | 
			
		||||
  emojis: [],
 | 
			
		||||
  replies_count: 0,
 | 
			
		||||
  reblogs_count: 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,6 +37,7 @@ const status: Entity.Status = {
 | 
			
		|||
  content: 'hoge',
 | 
			
		||||
  plain_content: 'hoge',
 | 
			
		||||
  created_at: '2019-03-26T21:40:32',
 | 
			
		||||
  edited_at: null,
 | 
			
		||||
  emojis: [],
 | 
			
		||||
  replies_count: 0,
 | 
			
		||||
  reblogs_count: 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue