Skip to content

Commit

Permalink
Fix display CONNECTED BY user in sharing connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed May 1, 2017
1 parent 85f5a9f commit 3d1b6e3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/my-sites/sharing/connections/connection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getCurrentUserId } from 'state/current-user/selectors';
import { canCurrentUser } from 'state/selectors';
import { getSelectedSiteId } from 'state/ui/selectors';
import { recordGoogleEvent } from 'state/analytics/actions';
import site from 'lib/site';
import UsersStore from 'lib/users/store';

class SharingConnection extends Component {
static propTypes = {
Expand Down Expand Up @@ -126,8 +126,7 @@ class SharingConnection extends Component {
}

getConnectionKeyringUserLabel() {
const { connection, siteId, translate, userId } = this.props;
const keyringUser = site( { ID: siteId } ).getUser( connection.keyring_connection_user_ID );
const { translate, keyringUser, userId } = this.props;

if ( keyringUser && userId !== keyringUser.ID ) {
return (
Expand Down Expand Up @@ -197,11 +196,14 @@ class SharingConnection extends Component {
}

export default connect(
( state ) => {
( state, ownProps ) => {
const siteId = getSelectedSiteId( state );
const keyringUserId = ownProps.connection.keyring_connection_user_ID;
const keyringUser = keyringUserId ? UsersStore.getUser( keyringUserId ) : null;

return {
siteId,
keyringUser,
userHasCaps: canCurrentUser( state, siteId, 'edit_others_posts' ),
userId: getCurrentUserId( state ),
};
Expand Down

0 comments on commit 3d1b6e3

Please sign in to comment.