Skip to content

Commit

Permalink
Patch route user (#883)
Browse files Browse the repository at this point in the history
* Tweak translate setting for followed/follower count

* Remove un-needed setting, refactor match for existing regex setting covering needs
  • Loading branch information
Mike authored and Valentine Zavgorodnev committed Dec 21, 2016
1 parent ac51da9 commit 86797ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/ResolveRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const routeRegex = {
PostsIndex: /^\/(@[\w\.\d-]+)\/feed\/?$/,
UserProfile1: /^\/(@[\w\.\d-]+)\/?$/,
UserProfile2: /^\/(@[\w\.\d-]+)\/(blog|posts|comments|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers|settings)\/?$/,
UserRoute: /^(@[\w\.\d//-]+)/,
UserEndPoints: /^(blog|posts|comments|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers|settings)$/,
CategoryFilters: /^\/(hot|created|trending|active|promoted)\/?$/ig,
PostNoCategory: /^\/(@[\w\.\d-]+)\/([\w\d-]+)/,
Expand Down
4 changes: 2 additions & 2 deletions app/components/pages/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ export default class UserProfile extends React.Component {
{about && <p className="UserProfile__bio">{about}</p>}
<div className="UserProfile__stats">
<span>
<Link to={`/@${accountname}/followers`}>{followerCount ? translate('follower_count', {followerCount}) : translate('followers')}</Link>
<Link to={`/@${accountname}/followers`}>{translate('follower_count', {followerCount})}</Link>
{isMyAccount && <NotifiCounter fields="follow" />}
</span>
<span><Link to={`/@${accountname}`}>{translate('post_count', {postCount: account.post_count || 0})}</Link></span>
<span><Link to={`/@${accountname}/followed`}>{followingCount ? translate('followed_count', {followingCount}) : translate('following')}</Link></span>
<span><Link to={`/@${accountname}/followed`}>{translate('followed_count', {followingCount})}</Link></span>
</div>
<p className="UserProfile__info">
{location && <span><Icon name="location" /> {location}</span>}
Expand Down
2 changes: 1 addition & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ app.use(function *(next) {
}
}
// // handle non-existing users endpoints with 404
if (this.method === 'GET' && routeRegex.UserRoute.test(this.url)) {
if (this.method === 'GET' && routeRegex.PostNoCategory.test(this.url)) {
const segments = this.url.split('/');
if(segments[2] && !routeRegex.UserEndPoints.test(segments[2])) {
this.status = 404;
Expand Down

0 comments on commit 86797ee

Please sign in to comment.