Capture clicks on statuses to hijack mention clicks, match mention href to user somehow

This commit is contained in:
shpuld 2019-01-30 19:15:35 +02:00
parent 3cfbf0141f
commit 15603981f8
4 changed files with 88 additions and 3 deletions

View file

@ -0,0 +1,9 @@
export const mentionMatchesUrl = (attention, url) => {
if (url === attention.statusnet_profile_url) {
return true
}
const [namepart, instancepart] = attention.screen_name.split('@')
const matchstring = new RegExp('://' + instancepart + '/.*' + namepart + '$', 'g')
return !!url.match(matchstring)
}