summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis <6653109+artonge@users.noreply.github.com>2023-03-13 16:48:00 +0100
committerGitHub <noreply@github.com>2023-03-13 16:48:00 +0100
commitad26bfdb919a9442b7177b48cfa3632232489242 (patch)
tree92bb765b7e96623d8b745d9c1154ee4ca306e928
parent21165718d5c7ff8150a3189bd9092275ef9882d9 (diff)
parent392ac622d68955e15842147b11b40f9bbdfa4604 (diff)
Merge pull request #1650 from nextcloud/artonge/fix/mentions_typingv0.6.0-beta3
Fix typing for mention in MessageContent.js
-rw-r--r--src/components/MessageContent.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components/MessageContent.js b/src/components/MessageContent.js
index d2c3d72d..0968c2cc 100644
--- a/src/components/MessageContent.js
+++ b/src/components/MessageContent.js
@@ -193,22 +193,22 @@ function getLinkType(className) {
/**
*
- * @param {Array} tags
+ * @param {import('../types/Mastodon').StatusMention[]} tags
* @param {string} mentionHref
* @param {string} mentionText
*/
-function matchMention(tags, mentionHref, mentionText) {
+function matchMention(tags = [], mentionHref, mentionText) {
const mentionUrl = new URL(mentionHref)
for (const tag of tags) {
- if (mentionText === tag.name) {
+ if (mentionText === tag.acct) {
return tag
}
// since the mention link href is not always equal to the href in the tag
// we instead match the server and username separate
- const tagUrl = new URL(tag.href)
+ const tagUrl = new URL(tag.url)
if (tagUrl.host === mentionUrl.host) {
- const [, name] = tag.name.split('@')
+ const [, name] = tag.acct.split('@')
if (name === mentionText || '@' + name === mentionText) {
return tag
}