add mentions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const bookmarkMenuHrefTemplate = '/hyperapi/bookmarks-dropdown';
|
||||
const previewEndpoint = '/api/babycode-preview';
|
||||
const userEndpoint = '/api/current-user';
|
||||
|
||||
const delay = ms => {return new Promise(resolve => setTimeout(resolve, ms))}
|
||||
|
||||
@@ -260,4 +261,19 @@ export default class {
|
||||
el.textContent = date.toLocaleString();
|
||||
}
|
||||
}
|
||||
|
||||
#currentUsername = undefined;
|
||||
async highlightMentions(ev, el) {
|
||||
if (this.#currentUsername === undefined) {
|
||||
const userInfo = await this.api.getJSON(userEndpoint);
|
||||
if (!userInfo.value) {
|
||||
return;
|
||||
}
|
||||
this.#currentUsername = userInfo.value.user.username;
|
||||
}
|
||||
|
||||
if (el.getString('username') === this.#currentUsername) {
|
||||
el.classList.add('me');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user