Skip to content

Commit

Permalink
0.6.4_hotfix_1
Browse files Browse the repository at this point in the history
  • Loading branch information
indeyets committed Feb 26, 2016
2 parents a9ddf62 + f80c383 commit eff6491
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/components/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import {IndexLink, Link} from 'react-router'
import {connect} from 'react-redux'
import classnames from 'classnames'

import {unauthenticated} from '../redux/action-creators'
import {unauthenticated, home} from '../redux/action-creators'
import Footer from './footer'
import Sidebar from './sidebar'
import LoaderContainer from './loader-container'
import {getCurrentRouteName} from '../utils'

const InternalLayout = ({authenticated, children}) => (
<div className={authenticated ? 'col-md-9' : 'col-md-12'}>
Expand All @@ -16,6 +17,13 @@ const InternalLayout = ({authenticated, children}) => (
</div>
)

const logoHandler = (router, cb) => _ => {
if (getCurrentRouteName(router) === 'home') {
return cb()
}
return false
}


class Layout extends React.Component {
// Here we have some handling of drag-n-drop, because standard dragenter
Expand Down Expand Up @@ -122,7 +130,7 @@ class Layout extends React.Component {
<header className="row">
<div className="col-xs-9 col-sm-6">
<h1>
<IndexLink to="/">FreeFeed</IndexLink>
<IndexLink to="/" onClick={logoHandler(props.router, props.home)}>FreeFeed</IndexLink>
</h1>
</div>

Expand Down Expand Up @@ -166,12 +174,14 @@ function select(state) {
authenticated: state.authenticated,
loadingView: state.routeLoadingState,
recentGroups: state.recentGroups,
router: state.router,
}
}

function mapDispatchToProps(dispatch){
return {
signOut: ()=>dispatch(unauthenticated())
signOut: ()=>dispatch(unauthenticated()),
home: ()=> dispatch(home()),
}
}

Expand Down
12 changes: 10 additions & 2 deletions src/components/user-profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ export default props => (
<div className="profile-stats">
{props.type !== 'group' && props.statistics.subscriptions >= 0 ? (
<div className="profile-stats-item">
<Link to={`/${props.username}/subscriptions`}>{pluralForm(props.statistics.subscriptions, 'subscription')}</Link>
{props.canISeeSubsList ? (
<Link to={`/${props.username}/subscriptions`}>{pluralForm(props.statistics.subscriptions, 'subscription')}</Link>
) : (
pluralForm(props.statistics.subscriptions, 'subscription')
)}
</div>
) : false}
{' '}
{props.statistics.subscribers >= 0 ? (
<div className="profile-stats-item">
<Link to={`/${props.username}/subscribers`}>{pluralForm(props.statistics.subscribers, 'subscriber')}</Link>
{props.canISeeSubsList ? (
<Link to={`/${props.username}/subscribers`}>{pluralForm(props.statistics.subscribers, 'subscriber')}</Link>
) : (
pluralForm(props.statistics.subscribers, 'subscriber')
)}
</div>
) : false}
{' '}
Expand Down
3 changes: 3 additions & 0 deletions src/components/user.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ function selectState(state) {
hasRequestBeenSent: authenticated && foundUser && ((user.pendingSubscriptionRequests || []).indexOf(foundUser.id) > -1)
}

statusExtension.canISeeSubsList = statusExtension.isUserFound &&
(foundUser.isPrivate === '0' || statusExtension.subscribed || statusExtension.isItMe)

const viewUser = {...(foundUser), ...statusExtension}

const breadcrumbs = {
Expand Down

0 comments on commit eff6491

Please sign in to comment.