added post visibility indicator

This commit is contained in:
ari melody 2024-06-21 05:43:23 +01:00
parent 46f1f93329
commit 919b1f6ebb
Signed by: ari
GPG key ID: CF99829C92678188
4 changed files with 12 additions and 6 deletions

View file

@ -24,6 +24,8 @@
return;
}
console.log(timeline_data);
for (let i in timeline_data) {
const post_data = timeline_data[i];
const post = await parsePost(post_data, 1);

View file

@ -144,18 +144,18 @@ export async function parsePost(data, num_replies) {
post.id = data.id;
post.created_at = new Date(data.created_at);
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.boost_count = data.reblogs_count;
post.reply_count = data.replies_count;
post.mentions = data.mentions;
post.files = data.media_attachments;
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;
if (data.in_reply_to_id && num_replies > 0) {

View file

@ -19,6 +19,9 @@
<div class="post-info">
<a href={post.url} class="created-at">
<time title={time_string}>{short_time(post.created_at)}</time>
{#if post.visibility !== "public"}
<span class="post-visibility">({post.visibility})</span>
{/if}
</a>
</div>
</header>

View file

@ -17,6 +17,7 @@ export default class Post {
url;
reply;
boost;
visibility;
async rich_text() {
let text = this.text;