Skip to content

Commit

Permalink
fix(chat): removed self from online user list
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Mar 3, 2019
1 parent c14d24d commit de3a596
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client/containers/Topbar/TopbarContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class TopbarContainer extends React.Component {
}

onSocketUpdateUsers (data) {
delete data[this.props.sessionUser.username]
const count = size(data)
if (count !== this.activeUserCount) this.activeUserCount = count
}
Expand Down Expand Up @@ -229,7 +230,11 @@ class TopbarContainer extends React.Component {
</div>
</div>

<OnlineUserListPartial timezone={viewdata.timezone} users={viewdata.users} />
<OnlineUserListPartial
timezone={viewdata.timezone}
users={viewdata.users}
sessionUser={this.props.sessionUser}
/>
</div>
</div>
)
Expand Down
3 changes: 3 additions & 0 deletions src/client/containers/Topbar/onlineUserList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class OnlineUserListPartial extends React.Component {
<div className='online-list-wrapper'>
<ul className='online-list'>
{entries(this.activeUsers).map(([key, value]) => {
if (this.props.sessionUser && value.user._id === this.props.sessionUser._id) return
const image = value.user.image || 'defaultProfile.jpg'
return (
<li key={key}>
Expand Down Expand Up @@ -123,6 +124,7 @@ class OnlineUserListPartial extends React.Component {
</div>
<ul className='user-list'>
{users.map(user => {
if (this.props.sessionUser && user._id === this.props.sessionUser._id) return
const image = user.image || 'defaultProfile.jpg'
return (
<li key={user._id} data-search-term={user.fullname.toLowerCase()}>
Expand Down Expand Up @@ -154,6 +156,7 @@ class OnlineUserListPartial extends React.Component {
}

OnlineUserListPartial.propTypes = {
sessionUser: PropTypes.object,
timezone: PropTypes.string.isRequired,
users: PropTypes.array.isRequired
}
Expand Down

0 comments on commit de3a596

Please sign in to comment.