mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 22:21:17 +00:00
REFACTOR: isValidLink
- Reduced verbose comments - Merged 2 `if` which had the same logic
This commit is contained in:
parent
6d6ffe5131
commit
92a9ae6ab0
@ -8,21 +8,13 @@ import ENV from "discourse-common/config/environment";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
export function isValidLink($link) {
|
||||
// Do not track:
|
||||
// - lightboxes
|
||||
// - links with disabled tracking
|
||||
// - category links
|
||||
// - quote back button
|
||||
// .hashtag == category/tag link
|
||||
// .back == quote back ^ button
|
||||
if ($link.is(".lightbox, .no-track-link, .hashtag, .back")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not track links in quotes or in elided part
|
||||
if ($link.parents("aside.quote, .elided").length !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($link.parents(".expanded-embed").length !== 0) {
|
||||
if ($link.parents("aside.quote, .elided, .expanded-embed").length !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user