Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
Fixed posts missing description in HTML header
Browse files Browse the repository at this point in the history
The post description was missing in HTML headers, resulting in no description for search engines. This has been fixed.
  • Loading branch information
KrNel committed May 24, 2019
1 parent ff3532e commit 981e53a
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 267 deletions.
24 changes: 15 additions & 9 deletions client/src/actions/followActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ export const searchStart = page => ({
* @param {string} user User to get data for
* @returns {function} Dispatches returned action object
*/
export const getFollowCount = user => (dispatch, getState) => {
let { user: userLogged } = getState().auth;
if (!userLogged) userLogged = cookieUser();

return client.call('follow_api', 'get_follow_count', [user])
export const getFollowCount = user => (dispatch, getState) => (
client.call('follow_api', 'get_follow_count', [user])
.then(followCount => {
dispatch(followCountSuccess(followCount.follower_count, followCount.following_count));
dispatch(getAllFollowing(userLogged));
dispatch(getAllFollowing());
})
}
)

/**
* Get the user's followers list.
Expand Down Expand Up @@ -229,7 +226,10 @@ export const getFollowing = (user, startFrom = '', limit = 100, more = false, ty
* @param {string} user User to get data for
* @returns {function} Dispatches returned action object
*/
export const getAllFollowing = user => async (dispatch, getState) => {
export const getAllFollowing = () => async (dispatch, getState) => {
let { user } = getState().auth;
if (!user) user = cookieUser();

const count = await client.call('follow_api', 'get_follow_count', [user])
.then(followCount => {
return followCount.following_count;
Expand All @@ -248,9 +248,15 @@ export const getAllFollowing = user => async (dispatch, getState) => {
}

/**
* Get the search results for a specified user or letter follow search.
*
* @param {string} user User to get data for
* @param {string} startFrom Previous user to start from
* @param {string} page Follow page type
* @param {number} limit Number of users to get
* @returns {function} Dispatches returned action object
*/
export const searchFollowers = (user, startFrom = '', page = 'followers', limit = 100, more = false) => (dispatch, getState) => {
export const searchFollowers = (user, startFrom = '', page = 'followers', limit = 100) => (dispatch, getState) => {

if (page === 'followers') {
dispatch(searchStart(page));
Expand Down
81 changes: 69 additions & 12 deletions client/src/components/pages/Steem/Post/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import PostDetails from './PostDetails';
import ErrorBoundary from '../../../ErrorBoundary/ErrorBoundary';
import ModalGroup from '../../../Modal/ModalGroup';
import ErrorLabel from '../../../ErrorLabel/ErrorLabel';
import { getDetailsContent, clearPost } from '../../../../actions/detailsPostActions';
import { getDetailsContent, clearPost, deletePost } from '../../../../actions/detailsPostActions';
import * as addPostActions from '../../../../actions/addPostActions';
import { commentsClear } from '../../../../actions/commentsActions';
import { sendComment, sendCommentClear } from '../../../../actions/sendCommentActions';
import { editPost } from '../../../../actions/sendPostActions';
import { resteem } from '../../../../actions/resteemActions';
import { upvotePost } from '../../../../actions/upvoteActions';
import { sendComment } from '../../../../actions/sendCommentActions';
import { getAllFollowing } from '../../../../actions/followActions';
import { hasLength } from '../../../../utils/helpers';
import Loading from '../../../Loading/Loading';

Expand All @@ -28,7 +32,6 @@ class Post extends Component {
post: PropTypes.shape(PropTypes.object.isRequired),
handleUpvote: PropTypes.func.isRequired,
upvotePayload: PropTypes.shape(PropTypes.object.isRequired),
sendComment: PropTypes.func.isRequired,
isCommenting: PropTypes.bool.isRequired,
commentedId: PropTypes.number,
commentPayload: PropTypes.shape(PropTypes.object.isRequired),
Expand All @@ -48,8 +51,16 @@ class Post extends Component {
draft: PropTypes.shape(PropTypes.object.isRequired),
isDeleting: PropTypes.bool,
redirect: PropTypes.string,
clearPostData: PropTypes.func,
resteemedPayload: PropTypes.shape(PropTypes.object.isRequired),
clearPostDetails: PropTypes.func,
clearComments: PropTypes.func,
clearNewComments: PropTypes.func,
showEditPost: PropTypes.func,
sendDeletePost: PropTypes.func,
handleResteem: PropTypes.func,
sendComment: PropTypes.func.isRequired,
allFollowing: PropTypes.func,
followingList: PropTypes.arrayOf(PropTypes.string),
};

static defaultProps = {
Expand All @@ -65,8 +76,15 @@ class Post extends Component {
draft: {},
isDeleting: false,
redirect: '',
clearPostData: () => {},
resteemedPayload: {},
followingList: [],
clearPostDetails: () => {},
clearComments: () => {},
clearNewComments: () => {},
showEditPost: () => {},
handleResteem: () => {},
sendDeletePost: () => {},
allFollowing: () => {},
}

constructor(props) {
Expand All @@ -83,6 +101,7 @@ class Post extends Component {
componentDidMount() {
const {
getContent,
allFollowing,
match: {
params: {
author,
Expand All @@ -92,6 +111,7 @@ class Post extends Component {
} = this.props;

getContent(author, permlink);
allFollowing();
}

/**
Expand All @@ -105,7 +125,7 @@ class Post extends Component {
getContent,
draft,
redirect,
clearPostData,
clearPostDetails,
match: {
params: {
author,
Expand All @@ -124,10 +144,17 @@ class Post extends Component {
//if redirect requested, clear previous post data in Redux
if (redirect && redirect !== prevProps.redirect) {
this.redirect = redirect;
clearPostData();
clearPostDetails();
}
}

componentWillUnmount() {
const { clearPostDetails, clearComments, clearNewComments } = this.props;
clearPostDetails();
clearComments();
clearNewComments();
}

render() {
const {
user,
Expand All @@ -148,13 +175,17 @@ class Post extends Component {
handleUpvote,
upvotePayload,
replies,
sendComment,
isCommenting,
commentedId,
commentPayload,
isUpdating,
isDeleting,
resteemedPayload,
showEditPost,
sendDeletePost,
handleResteem,
sendComment,
followingList,
} = this.props;

let addErrorPost = '';
Expand Down Expand Up @@ -191,14 +222,18 @@ class Post extends Component {
handleUpvote={handleUpvote}
upvotePayload={upvotePayload}
replies={replies}
sendComment={sendComment}
isCommenting={isCommenting}
commentedId={commentedId}
isFetching={isFetchingDetails}
commentPayload={commentPayload}
isUpdating={isUpdating}
isDeleting={isDeleting}
resteemedPayload={resteemedPayload}
showEditPost={showEditPost}
sendDeletePost={sendDeletePost}
handleResteem={handleResteem}
sendComment={sendComment}
followingList={followingList}
/>
)
: <Loading />
Expand Down Expand Up @@ -259,6 +294,9 @@ class Post extends Component {
resteem: {
resteemedPayload,
},
follow: {
followingList,
},
} = state;

return {
Expand All @@ -284,6 +322,7 @@ class Post extends Component {
isDeleting,
redirect,
resteemedPayload,
followingList,
}
}

Expand All @@ -310,15 +349,33 @@ const mapDispatchToProps = dispatch => (
handleGroupSelect: (value) => (
dispatch(addPostActions.handleGroupSelect(value))
),
clearPostDetails: () => (
dispatch(clearPost())
),
clearComments: () => (
dispatch(commentsClear())
),
clearNewComments: () => (
dispatch(sendCommentClear())
),
showEditPost: (post) => (
dispatch(editPost(post))
),
sendDeletePost: (author, permlink) => (
dispatch(deletePost(author, permlink))
),
handleResteem: (pid, author, permlink) => (
dispatch(resteem(pid, author, permlink))
),
handleUpvote: (voter, author, permlink, weight) => (
dispatch(upvotePost(voter, author, permlink, weight))
),
sendComment: (body, parentPost) => (
dispatch(sendComment(body, parentPost))
),
clearPostData: () => (
dispatch(clearPost())
),
allFollowing: () => (
dispatch(getAllFollowing())
)
}
);

Expand Down
Loading

0 comments on commit 981e53a

Please sign in to comment.