improving fav detection logic
This commit is contained in:
@@ -227,7 +227,7 @@ window.requestAnimFrame = (function () {
|
|||||||
const userMatch = url.match(/\/user\/([^/]+)/);
|
const userMatch = url.match(/\/user\/([^/]+)/);
|
||||||
if (userMatch) {
|
if (userMatch) {
|
||||||
user = decodeURIComponent(userMatch[1]);
|
user = decodeURIComponent(userMatch[1]);
|
||||||
if (url.includes(`/user/${userMatch[1]}/favs`)) isFavs = true;
|
if (url.match(/\/user\/[^/]+\/favs(\/|$|\?)/)) isFavs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If missing and inheritContext is true, check Window Location
|
// If missing and inheritContext is true, check Window Location
|
||||||
@@ -240,7 +240,8 @@ window.requestAnimFrame = (function () {
|
|||||||
const wUserMatch = window.location.href.match(/\/user\/([^/]+)/);
|
const wUserMatch = window.location.href.match(/\/user\/([^/]+)/);
|
||||||
if (wUserMatch) {
|
if (wUserMatch) {
|
||||||
user = decodeURIComponent(wUserMatch[1]);
|
user = decodeURIComponent(wUserMatch[1]);
|
||||||
if (window.location.href.includes(`/user/${wUserMatch[1]}/favs`)) isFavs = true;
|
// Check for /favs (with or without trailing /, item id, or query params)
|
||||||
|
if (window.location.href.match(/\/user\/[^/]+\/favs(\/|$|\?)/)) isFavs = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ export default (router, tpl) => {
|
|||||||
|
|
||||||
let contextUrl = `/${req.params.itemid}`;
|
let contextUrl = `/${req.params.itemid}`;
|
||||||
if (query.tag) contextUrl = `/tag/${query.tag}/${req.params.itemid}`;
|
if (query.tag) contextUrl = `/tag/${query.tag}/${req.params.itemid}`;
|
||||||
if (query.user) contextUrl = `/user/${query.user}/${req.params.itemid}`; // User filter takes precedence if both? usually mutually exclusive
|
if (query.user) {
|
||||||
|
contextUrl = query.fav === 'true'
|
||||||
|
? `/user/${query.user}/favs/${req.params.itemid}`
|
||||||
|
: `/user/${query.user}/${req.params.itemid}`;
|
||||||
|
}
|
||||||
|
|
||||||
const data = await f0cklib.getf0ck({
|
const data = await f0cklib.getf0ck({
|
||||||
itemid: req.params.itemid,
|
itemid: req.params.itemid,
|
||||||
|
|||||||
Reference in New Issue
Block a user