Display links to tildefriends apps again.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4010 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-10-16 00:54:16 +00:00
parent de398786be
commit 3bbeec8ece
2 changed files with 6 additions and 4 deletions

View File

@ -137,6 +137,9 @@ class TfMessageElement extends LitElement {
<source src=${'/' + mention.link + '/view'}></source>
</audio>
`;
} else if (mention.link?.startsWith('&') &&
mention?.type === 'application/tildefriends') {
return html`<a href=${`/${mention.link}/`}>😎 ${mention.name}</a>`;
} else if (mention.link?.startsWith('%') || mention.link?.startsWith('@')) {
return html` <a href=${'#' + encodeURIComponent(mention.link)}>${mention.name}</a>`;
} else if (mention.link?.startsWith('#')) {
@ -148,14 +151,13 @@ class TfMessageElement extends LitElement {
render_mentions() {
let mentions = this.message?.content?.mentions || [];
let content = JSON.stringify(this.message?.content);
mentions = mentions.filter(x => content.indexOf(x.link) === -1);
mentions = mentions.filter(x => this.message?.content?.text?.indexOf(x.link) === -1);
if (mentions.length) {
let self = this;
return html`
<fieldset style="background-color: rgba(0, 0, 0, 0.1); padding: 0.5em; border: 1px solid black">
<legend>Mentions</legend>
${(this.message?.content?.mentions || []).map(x => self.render_mention(x))}
${mentions.map(x => self.render_mention(x))}
</fieldset>
`;
}