mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 16:58:47 +01:00
Fix Lemmy post links not working
Because it's self-referential
This commit is contained in:
parent
b3501d158f
commit
674c99a05d
2 changed files with 12 additions and 3 deletions
|
@ -1128,7 +1128,12 @@ function Status({
|
||||||
lang={language}
|
lang={language}
|
||||||
dir="auto"
|
dir="auto"
|
||||||
class="inner-content"
|
class="inner-content"
|
||||||
onClick={handleContentLinks({ mentions, instance, previewMode })}
|
onClick={handleContentLinks({
|
||||||
|
mentions,
|
||||||
|
instance,
|
||||||
|
previewMode,
|
||||||
|
statusURL: url,
|
||||||
|
})}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: enhanceContent(content, {
|
__html: enhanceContent(content, {
|
||||||
emojis,
|
emojis,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import states from './states';
|
import states from './states';
|
||||||
|
|
||||||
function handleContentLinks(opts) {
|
function handleContentLinks(opts) {
|
||||||
const { mentions = [], instance, previewMode } = opts || {};
|
const { mentions = [], instance, previewMode, statusURL } = opts || {};
|
||||||
return (e) => {
|
return (e) => {
|
||||||
let { target } = e;
|
let { target } = e;
|
||||||
target = target.closest('a');
|
target = target.closest('a');
|
||||||
|
@ -50,7 +50,11 @@ function handleContentLinks(opts) {
|
||||||
const hashURL = instance ? `#/${instance}/t/${tag}` : `#/t/${tag}`;
|
const hashURL = instance ? `#/${instance}/t/${tag}` : `#/t/${tag}`;
|
||||||
console.log({ hashURL });
|
console.log({ hashURL });
|
||||||
location.hash = hashURL;
|
location.hash = hashURL;
|
||||||
} else if (states.unfurledLinks[target.href]?.url) {
|
} else if (
|
||||||
|
states.unfurledLinks[target.href]?.url &&
|
||||||
|
statusURL !== target.href
|
||||||
|
) {
|
||||||
|
// If unfurled AND not self-referential
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
states.prevLocation = {
|
states.prevLocation = {
|
||||||
|
|
Loading…
Reference in a new issue