FIX: Do not check for duplicate links in Onebox (#13345)

If a user posted a URL that appeared inside a Onebox, then the user
got a duplicate link notice. This was fixed by skipping those links in
Ruby.

If a user posted a URL that was Oneboxes and contained other links that
appeared in previous posts, then the user got a duplicate link notice.
This was fixed by skipping those links in JavaScript.
This commit is contained in:
Bianca Nenciu
2021-06-18 18:55:24 +03:00
committed by GitHub
parent 74f7295631
commit 1e992d9193
3 changed files with 30 additions and 3 deletions

View File

@@ -456,7 +456,7 @@ export default Controller.extend({
$links.each((idx, l) => {
const href = l.href;
if (href && href.length) {
// skip links in quotes
// skip links in quotes and oneboxes
for (let element = l; element; element = element.parentElement) {
if (
element.tagName === "DIV" &&
@@ -471,6 +471,14 @@ export default Controller.extend({
) {
return true;
}
if (
element.tagName === "ASIDE" &&
element.classList.contains("onebox") &&
href !== element.dataset["onebox-src"]
) {
return true;
}
}
const [warn, info] = linkLookup.check(post, href);