mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-26 06:42:15 +03:00
moved post permalink processor outside web script
it also now handles comment link from main post body
This commit is contained in:
parent
6b11695e91
commit
bb61b823fc
@ -64,10 +64,7 @@ document.addEventListener('click', function(event) {
|
|||||||
var author = el.getAttribute('data-author');
|
var author = el.getAttribute('data-author');
|
||||||
var permlink = el.getAttribute('data-permlink');
|
var permlink = el.getAttribute('data-permlink');
|
||||||
|
|
||||||
const queryIndex = permlink.lastIndexOf('?');
|
|
||||||
if(queryIndex > -1){
|
|
||||||
permlink = permlink.substring(0, queryIndex)
|
|
||||||
}
|
|
||||||
var result = {
|
var result = {
|
||||||
type: 'markdown-post-link',
|
type: 'markdown-post-link',
|
||||||
category: category,
|
category: category,
|
||||||
|
@ -212,6 +212,20 @@ const PostBody = ({
|
|||||||
|
|
||||||
const _handleOnPostPress = (permlink, author) => {
|
const _handleOnPostPress = (permlink, author) => {
|
||||||
if (permlink) {
|
if (permlink) {
|
||||||
|
//snippets checks if there is anchored post inside permlink and use that instead
|
||||||
|
const anchoredPostRegex = /(.*?\#\@)(.*)\/(.*)/;
|
||||||
|
const matchedLink = permlink.match(anchoredPostRegex);
|
||||||
|
if (matchedLink) {
|
||||||
|
author = matchedLink[2];
|
||||||
|
permlink = matchedLink[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if permlink has trailing query param, remove that if is the case
|
||||||
|
const queryIndex = permlink.lastIndexOf('?');
|
||||||
|
if (queryIndex > -1) {
|
||||||
|
permlink = permlink.substring(0, queryIndex);
|
||||||
|
}
|
||||||
|
|
||||||
navigation.navigate({
|
navigation.navigate({
|
||||||
routeName: ROUTES.SCREENS.POST,
|
routeName: ROUTES.SCREENS.POST,
|
||||||
params: {
|
params: {
|
||||||
|
Loading…
Reference in New Issue
Block a user