added post visibility indicator
This commit is contained in:
		
							parent
							
								
									46f1f93329
								
							
						
					
					
						commit
						919b1f6ebb
					
				
					 4 changed files with 12 additions and 6 deletions
				
			
		|  | @ -24,6 +24,8 @@ | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         console.log(timeline_data); | ||||||
|  | 
 | ||||||
|         for (let i in timeline_data) { |         for (let i in timeline_data) { | ||||||
|             const post_data = timeline_data[i]; |             const post_data = timeline_data[i]; | ||||||
|             const post = await parsePost(post_data, 1); |             const post = await parsePost(post_data, 1); | ||||||
|  |  | ||||||
|  | @ -144,18 +144,18 @@ export async function parsePost(data, num_replies) { | ||||||
|     post.id = data.id; |     post.id = data.id; | ||||||
|     post.created_at = new Date(data.created_at); |     post.created_at = new Date(data.created_at); | ||||||
|     post.user = await parseUser(data.account); |     post.user = await parseUser(data.account); | ||||||
| 
 |  | ||||||
|     if (client.instance.capabilities.includes(capabilities.MARKDOWN_CONTENT)) |  | ||||||
|         post.text = data.text; |  | ||||||
|     else |  | ||||||
|         post.text = data.content; |  | ||||||
| 
 |  | ||||||
|     post.warning = data.spoiler_text; |     post.warning = data.spoiler_text; | ||||||
|     post.boost_count = data.reblogs_count; |     post.boost_count = data.reblogs_count; | ||||||
|     post.reply_count = data.replies_count; |     post.reply_count = data.replies_count; | ||||||
|     post.mentions = data.mentions; |     post.mentions = data.mentions; | ||||||
|     post.files = data.media_attachments; |     post.files = data.media_attachments; | ||||||
|     post.url = data.url; |     post.url = data.url; | ||||||
|  |     post.visibility = data.visibility; | ||||||
|  | 
 | ||||||
|  |     if (client.instance.capabilities.includes(capabilities.MARKDOWN_CONTENT)) | ||||||
|  |         post.text = data.text; | ||||||
|  |     else | ||||||
|  |         post.text = data.content; | ||||||
| 
 | 
 | ||||||
|     post.reply = null; |     post.reply = null; | ||||||
|     if (data.in_reply_to_id && num_replies > 0) { |     if (data.in_reply_to_id && num_replies > 0) { | ||||||
|  |  | ||||||
|  | @ -19,6 +19,9 @@ | ||||||
|         <div class="post-info"> |         <div class="post-info"> | ||||||
|             <a href={post.url} class="created-at"> |             <a href={post.url} class="created-at"> | ||||||
|                 <time title={time_string}>{short_time(post.created_at)}</time> |                 <time title={time_string}>{short_time(post.created_at)}</time> | ||||||
|  |                 {#if post.visibility !== "public"} | ||||||
|  |                     <span class="post-visibility">({post.visibility})</span> | ||||||
|  |                 {/if} | ||||||
|             </a> |             </a> | ||||||
|         </div> |         </div> | ||||||
|     </header> |     </header> | ||||||
|  |  | ||||||
|  | @ -17,6 +17,7 @@ export default class Post { | ||||||
|     url; |     url; | ||||||
|     reply; |     reply; | ||||||
|     boost; |     boost; | ||||||
|  |     visibility; | ||||||
| 
 | 
 | ||||||
|     async rich_text() { |     async rich_text() { | ||||||
|         let text = this.text; |         let text = this.text; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue