mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 03:05:41 +03: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}
|
||||
dir="auto"
|
||||
class="inner-content"
|
||||
onClick={handleContentLinks({ mentions, instance, previewMode })}
|
||||
onClick={handleContentLinks({
|
||||
mentions,
|
||||
instance,
|
||||
previewMode,
|
||||
statusURL: url,
|
||||
})}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: enhanceContent(content, {
|
||||
emojis,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import states from './states';
|
||||
|
||||
function handleContentLinks(opts) {
|
||||
const { mentions = [], instance, previewMode } = opts || {};
|
||||
const { mentions = [], instance, previewMode, statusURL } = opts || {};
|
||||
return (e) => {
|
||||
let { target } = e;
|
||||
target = target.closest('a');
|
||||
|
@ -50,7 +50,11 @@ function handleContentLinks(opts) {
|
|||
const hashURL = instance ? `#/${instance}/t/${tag}` : `#/t/${tag}`;
|
||||
console.log({ 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.stopPropagation();
|
||||
states.prevLocation = {
|
||||
|
|
Loading…
Reference in a new issue