mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 05:42:33 +03:00
using category as tag if not already present in post meta
This commit is contained in:
parent
c24739ffb4
commit
29f88adda7
@ -50,6 +50,8 @@ const PostDisplayView = ({
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [postBodyLoading, setPostBodyLoading] = useState(false);
|
||||
|
||||
const [tags, setTags] = useState([]);
|
||||
|
||||
// Component Life Cycles
|
||||
useEffect(() => {
|
||||
if (isLoggedIn && get(currentAccount, 'name') && !isNewPost) {
|
||||
@ -57,6 +59,16 @@ const PostDisplayView = ({
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (post) {
|
||||
const _tags = post.json_metadata ? post.json_metadata.tags : [];
|
||||
if (post.category && _tags[0] !== post.category) {
|
||||
_tags.splice(0, 0, post.category);
|
||||
}
|
||||
setTags(_tags);
|
||||
}
|
||||
}, [post]);
|
||||
|
||||
// Component Functions
|
||||
const onRefresh = useCallback(() => {
|
||||
setRefreshing(true);
|
||||
@ -216,7 +228,7 @@ const PostDisplayView = ({
|
||||
<PostBody body={post.body} onLoadEnd={_handleOnPostBodyLoad} />
|
||||
{!postBodyLoading && (
|
||||
<View style={styles.footer}>
|
||||
<Tags tags={post.json_metadata && post.json_metadata.tags} />
|
||||
<Tags tags={tags} />
|
||||
<Text style={styles.footerText}>
|
||||
Posted by
|
||||
<Text style={styles.footerName}>{` ${author || post.author} `}</Text>
|
||||
|
Loading…
Reference in New Issue
Block a user