ssb: Un-clobber the flagged message UI. Whoops.

This commit is contained in:
2025-11-29 10:41:08 -05:00
parent 0ec862eaac
commit 0827718d68
2 changed files with 46 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&g0o5rMFQcyi3GwyWGrSQcQPPABae0yrUpVehztef3XE=.sha256" "previous": "&sMLjk8uV7zNIV2JxHMw6TAYb92hvOafL0+kKWc1Tqt0=.sha256"
} }

View File

@@ -196,6 +196,26 @@ class TfMessageElement extends LitElement {
); );
} }
flag(event) {
let reason = prompt(
'What is the reason for reporting this content (spam, nsfw, ...)?',
'offensive'
);
if (reason !== undefined) {
tfrpc.rpc
.appendMessage(this.whoami, {
type: 'flag',
flag: {
link: this.message.id,
reason: reason.length ? reason : undefined,
},
})
.catch(function (error) {
alert(error?.message);
});
}
}
show_image(link) { show_image(link) {
let div = document.createElement('div'); let div = document.createElement('div');
div.style.left = 0; div.style.left = 0;
@@ -505,6 +525,12 @@ class TfMessageElement extends LitElement {
> >
👍 React 👍 React
</button> </button>
<button
class="w3-button w3-bar-item w3-border-bottom"
@click=${this.flag}
>
⚠️ Flag
</button>
${formats.map( ${formats.map(
([format, name]) => html` ([format, name]) => html`
<button <button
@@ -965,7 +991,19 @@ class TfMessageElement extends LitElement {
style="cursor: pointer" style="cursor: pointer"
@click=${(x) => this.toggle_expanded(':cw')} @click=${(x) => this.toggle_expanded(':cw')}
> >
<p>${content.contentWarning}</p> <p>
${this.message.flags
? html`<p>
Caution: This message has been flagged
${this.message.flags.length}
time${this.message.flags.length == 1 ? '' : 's'}.
</p>`
: undefined}
${content.contentWarning
? html`<p>${content.contentWarning}</p>`
: undefined}
</p>
<p class="w3-small"> <p class="w3-small">
${this.is_expanded(':cw') ? 'Show less' : 'Show more'} ${this.is_expanded(':cw') ? 'Show less' : 'Show more'}
</p> </p>
@@ -976,7 +1014,8 @@ class TfMessageElement extends LitElement {
<div @click=${this.body_click}>${body}</div> <div @click=${this.body_click}>${body}</div>
${this.render_mentions()} ${this.render_mentions()}
`; `;
let payload = content.contentWarning let payload =
this.message.flags || content.contentWarning
? self.expanded[(this.message.id || '') + ':cw'] ? self.expanded[(this.message.id || '') + ':cw']
? html` ${content_warning} ${content_html} ` ? html` ${content_warning} ${content_html} `
: content_warning : content_warning