diff --git a/app/ResolveRoute.js b/app/ResolveRoute.js index 4a891f4baaf67709f693efab98dfa3b5432c71bc..b01b1e4ec7aa39de008f2b01b3b9e86e722df0e2 100644 --- a/app/ResolveRoute.js +++ b/app/ResolveRoute.js @@ -53,7 +53,8 @@ export default function resolveRoute(path) return {page: 'PostsIndex', params: ['home', match[1]]}; } match = path.match(/^\/(@[\w\.\d-]+)\/?$/) || - path.match(/^\/(@[\w\.\d-]+)\/(blog|posts|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers)\/?$/); + // @user/"posts" is deprecated in favor of "comments" as of oct-2016 (#443) + path.match(/^\/(@[\w\.\d-]+)\/(blog|posts|comments|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers)\/?$/); if (match) { return {page: 'UserProfile', params: match.slice(1)}; } diff --git a/app/components/modules/Header.jsx b/app/components/modules/Header.jsx index 450270fdc506de759785584fb6531e815ade65c1..b6366aa330a9d84b09084974cd5ec638e4c9b030 100644 --- a/app/components/modules/Header.jsx +++ b/app/components/modules/Header.jsx @@ -129,7 +129,8 @@ class Header extends React.Component { if(route.params[1] === "recent-replies"){ page_title = `Replies by ${user_name} `; } - if(route.params[1] === "posts"){ + // @user/"posts" is deprecated in favor of "comments" as of oct-2016 (#443) + if(route.params[1] === "posts" || route.params[1] === "comments"){ page_title = `Comments by ${user_name} `; } } else { diff --git a/app/components/modules/TopRightMenu.jsx b/app/components/modules/TopRightMenu.jsx index c2846cc923dbf1ac9a7e140d57a4866139415bc2..c68bf343149b733f38d26192b5ad506597a528c1 100644 --- a/app/components/modules/TopRightMenu.jsx +++ b/app/components/modules/TopRightMenu.jsx @@ -26,13 +26,13 @@ function TopRightMenu({username, showLogin, logout, loggedIn, showSignUp, userpi const replies_link = `/@${username}/recent-replies`; const wallet_link = `/@${username}/transfers`; const account_link = `/@${username}`; - const posts_link = `/@${username}/posts`; + const comments_link = `/@${username}/comments`; const reset_password_link = `/@${username}/password`; if (loggedIn) { // change back to if(username) after bug fix: Clicking on Login does not cause drop-down to close #TEMP! const user_menu = [ {link: feed_link, value: 'Feed'}, {link: account_link, value: 'Blog'}, - {link: posts_link, value: 'Comments'}, + {link: comments_link, value: 'Comments'}, {link: replies_link, value: 'Replies'}, {link: wallet_link, value: 'Wallet'}, {link: reset_password_link, value: 'Change Password'}, diff --git a/app/components/pages/UserProfile.jsx b/app/components/pages/UserProfile.jsx index 4d48799715dcf8952b1f9b1db2923dfc78c86d87..9b71b6acd10d2a065d4e764fd2627d6cfdaf07be 100644 --- a/app/components/pages/UserProfile.jsx +++ b/app/components/pages/UserProfile.jsx @@ -41,7 +41,7 @@ export default class UserProfile extends React.Component { switch(category) { case 'feed': order = 'by_feed'; break; case 'blog': order = 'by_author'; break; - case 'posts': order = 'by_comments'; break; + case 'comments': order = 'by_comments'; break; case 'recent_replies': order = 'by_replies'; break; default: console.log('unhandled category:', category); } @@ -61,6 +61,9 @@ export default class UserProfile extends React.Component { // const gprops = this.props.global.getIn( ['props'] ).toJS(); if( !section ) section = 'blog'; + // @user/"posts" is deprecated in favor of "comments" as of oct-2016 (#443) + if( section == 'posts' ) section = 'comments'; + // const isMyAccount = current_user ? current_user.get('username') === accountname : false; let account let accountImm = this.props.global.getIn(['accounts', accountname]); @@ -145,14 +148,16 @@ export default class UserProfile extends React.Component { /> } } - else if( section === 'posts' && account.post_history ) { + else if( section === 'comments' && account.post_history ) { + // NOTE: `posts` key will be renamed to `comments` (https://github.com/steemit/steem/issues/507) + // -- see also GlobalReducer.js if( account.posts ) { tab_content = <PostsList emptyText={`Looks like ${account.name} hasn't made any comments yet!`} posts={account.posts} loading={fetching} - category="posts" + category="comments" loadMore={this.loadMore} showSpam />; } @@ -204,19 +209,7 @@ export default class UserProfile extends React.Component { } let printLink = null; - let section_title = account.name + ' / ' + section; - if( section === 'blog' ) { - section_title = account.name + "'s blog"; - } else if( section === 'transfers' ) { - section_title = account.name + "'s wallet"; - } else if( section === 'curation-rewards' ) { - section_title = account.name + "'s curation rewards"; - } else if( section === 'author-rewards' ) { - section_title = account.name + "'s author rewards"; - } else if( section === 'password' ) { - section_title = '' - } else if( section === 'permissions' ) { - section_title = account.name + "'s permissions" + if( section === 'permissions' ) { if(isMyAccount && wifShown) { printLink = <div> <a className="float-right noPrint" onClick={onPrint}> @@ -225,10 +218,6 @@ export default class UserProfile extends React.Component { </a> </div> } - } else if( section === 'posts' ) { - section_title = account.name + "'s posts"; - } else if( section === 'recent-replies' ) { - section_title = 'Recent replies to ' + account.name + "'s posts"; } const wallet_tab_active = section === 'transfers' || section === 'password' || section === 'permissions' ? 'active' : ''; // className={wallet_tab_active} @@ -242,7 +231,7 @@ export default class UserProfile extends React.Component { <div className="columns small-10 medium-12 medium-expand"> <ul className="menu" style={{flexWrap: "wrap"}}> <li><Link to={`/@${accountname}`} activeClassName="active">Blog</Link></li> - <li><Link to={`/@${accountname}/posts`} activeClassName="active">Comments</Link></li> + <li><Link to={`/@${accountname}/comments`} activeClassName="active">Comments</Link></li> <li><Link to={`/@${accountname}/recent-replies`} activeClassName="active">Replies</Link></li> {/*<li><Link to={`/@${accountname}/feed`} activeClassName="active">Feed</Link></li>*/} <li> @@ -304,7 +293,6 @@ export default class UserProfile extends React.Component { </div> <div className="row"> <div className="column"> - {/*section_title && <h2 className="UserProfile__section-title">{section_title}</h2>*/} {tab_content} </div> </div> diff --git a/app/redux/GlobalReducer.js b/app/redux/GlobalReducer.js index 14539f94fccd22d7a966b3e29b7febb11010d4cd..56657ee4cf4d8f1da23177ef2ccc393cbe58b27f 100644 --- a/app/redux/GlobalReducer.js +++ b/app/redux/GlobalReducer.js @@ -152,8 +152,9 @@ export default createModule({ // console.log('-- RECEIVE_DATA state -->', state.toJS()); let new_state; if (order === 'by_author' || order === 'by_feed' || order === 'by_comments' || order === 'by_replies') { - // category is either "blog", "feed", "posts", or "recent_replies" (respectively) -- and all posts are keyed under current profile - const key = ['accounts', accountname, category] + // category is either "blog", "feed", "comments", or "recent_replies" (respectively) -- and all posts are keyed under current profile + // one exception: "comments" category is keyed as "posts" in get_state (https://github.com/steemit/steem/issues/507) + const key = ['accounts', accountname, category == "comments" ? "posts" : category] new_state = state.updateIn(key, List(), list => { return list.withMutations(posts => { data.forEach(value => {