diff --git a/src/components/basicUIElements/view/tag/tagContainer.js b/src/components/basicUIElements/view/tag/tagContainer.js index ddc6fb519..feb871041 100644 --- a/src/components/basicUIElements/view/tag/tagContainer.js +++ b/src/components/basicUIElements/view/tag/tagContainer.js @@ -28,35 +28,33 @@ const TagContainer = ({ style, textStyle, disabled, + communityTitle, }) => { const [label, setLabel] = useState(value); const [isCommunity, setIsCommunity] = useState(false); useEffect(() => { - let isCancelled = false; - if (value && /^hive-\d+/.test(value)) { - getCommunityTitle(value) - .then((r) => { - if (!isCancelled) { + if (value && /hive-[1-3]\d{4,6}$/.test(value)) { + if (communityTitle) { + setLabel(communityTitle); + setIsCommunity(true); + } else { + getCommunityTitle(value) + .then((r) => { setLabel(r); setIsCommunity(value !== r); return r; - } - }) - .catch((e) => { - if (!isCancelled) { + }) + .catch((e) => { setLabel(value); - setIsCommunity(/^hive-\d+/.test(value)); + setIsCommunity(/hive-[1-3]\d{4,6}$/.test(value)); return value; - } - }); + }); + } } else { setLabel(value); setIsCommunity(false); } - return () => { - isCancelled = true; - }; }); // Component Functions diff --git a/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js b/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js index 28951533c..f41d73e2d 100644 --- a/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js +++ b/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js @@ -37,7 +37,7 @@ const SelectCommunityModalView = ({ renderItem={({ item, index, separators }) => ( diff --git a/src/components/postCard/container/postCardContainer.js b/src/components/postCard/container/postCardContainer.js index 7db89c5a4..2f221996a 100644 --- a/src/components/postCard/container/postCardContainer.js +++ b/src/components/postCard/container/postCardContainer.js @@ -39,25 +39,25 @@ const PostCardContainer = ({ }, [isRefresh]); useEffect(() => { - if (content) { - setActiveVotes(get(content, 'active_votes', [])); + if (_content) { + setActiveVotes(get(_content, 'active_votes', [])); - getPostReblogs(content).then((result) => { + getPostReblogs(_content).then((result) => { setReblogs(result); }); - setContent(content); + setContent(_content); } - }, [content]); + }, [_content]); const _handleOnUserPress = () => { - if (content && get(currentAccount, 'name') !== get(content, 'author')) { + if (_content && get(currentAccount, 'name') !== get(_content, 'author')) { navigation.navigate({ routeName: ROUTES.SCREENS.PROFILE, params: { - username: get(content, 'author'), - reputation: get(content, 'author_reputation'), + username: get(_content, 'author'), + reputation: get(_content, 'author_reputation'), }, - key: get(content, 'author'), + key: get(_content, 'author'), }); } }; @@ -79,9 +79,9 @@ const PostCardContainer = ({ routeName: ROUTES.SCREENS.VOTERS, params: { activeVotes, - content, + content: _content, }, - key: get(content, 'permlink'), + key: get(_content, 'permlink'), }); }; @@ -91,12 +91,16 @@ const PostCardContainer = ({ params: { reblogs, }, - key: get(content, 'permlink', get(content, 'author', '')), + key: get(_content, 'permlink', get(_content, 'author', '')), }); }; const _fetchPost = async () => { - await getPost(get(content, 'author'), get(content, 'permlink'), get(currentAccount, 'username')) + await getPost( + get(_content, 'author'), + get(_content, 'permlink'), + get(currentAccount, 'username'), + ) .then((result) => { if (result) { setContent(result); diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index e220c0c8d..108182b21 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -102,7 +102,7 @@ const PostCardView = ({ profileOnPress={_handleOnUserPress} reputation={get(content, 'author_reputation')} size={36} - tag={content.category} + content={content} rebloggedBy={rebloggedBy} isPromoted={get(content, 'is_promoted')} /> diff --git a/src/components/postElements/headerDescription/view/postHeaderDescription.js b/src/components/postElements/headerDescription/view/postHeaderDescription.js index a5fd40ecf..618eae62b 100644 --- a/src/components/postElements/headerDescription/view/postHeaderDescription.js +++ b/src/components/postElements/headerDescription/view/postHeaderDescription.js @@ -46,6 +46,7 @@ class PostHeaderDescription extends PureComponent { reputation, size, tag, + content, tagOnPress, isShowOwnerIndicator, isPromoted, @@ -90,6 +91,16 @@ class PostHeaderDescription extends PureComponent { + {!!content && ( + tagOnPress && tagOnPress()}> + + + )} {!!tag && ( tagOnPress && tagOnPress()}> diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 6bfc628b1..cc7a44b06 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -198,7 +198,7 @@ const PostDisplayView = ({ name={author || post.author} currentAccountUsername={name} reputation={post.author_reputation} - tag={post.category} + content={post} size={36} /> diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 6437f3341..adb9d8f45 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -255,7 +255,7 @@ const PostsContainer = ({ const filter = type || selectedFilterValue; const subfilter = selectedFeedSubfilterValue; let options = {}; - const limit = 7; + const limit = 5; let func = null; if ( @@ -319,7 +319,7 @@ const PostsContainer = ({ _posts = unionBy(posts, _posts, 'permlink'); } } - if (posts.length <= 7 && pageType !== 'profiles') { + if (posts.length <= 5 && pageType !== 'profiles') { _setFeedPosts(_posts); }