@@ -15,6 +15,7 @@ limitations under the License.
15
15
*/
16
16
import React from 'react' ;
17
17
import sdk from '../../../index' ;
18
+ import dis from '../../../dispatcher' ;
18
19
import classNames from 'classnames' ;
19
20
import { Room , RoomMember } from 'matrix-js-sdk' ;
20
21
import PropTypes from 'prop-types' ;
@@ -140,6 +141,12 @@ const Pill = React.createClass({
140
141
} ) ;
141
142
} ,
142
143
144
+ onUserPillClicked : function ( ) {
145
+ dis . dispatch ( {
146
+ action : 'view_user' ,
147
+ member : this . state . member ,
148
+ } ) ;
149
+ } ,
143
150
render : function ( ) {
144
151
const MemberAvatar = sdk . getComponent ( 'avatars.MemberAvatar' ) ;
145
152
const RoomAvatar = sdk . getComponent ( 'avatars.RoomAvatar' ) ;
@@ -150,6 +157,8 @@ const Pill = React.createClass({
150
157
let linkText = resource ;
151
158
let pillClass ;
152
159
let userId ;
160
+ let href = this . props . url ;
161
+ let onClick ;
153
162
switch ( this . state . pillType ) {
154
163
case Pill . TYPE_USER_MENTION : {
155
164
// If this user is not a member of this room, default to the empty member
@@ -161,6 +170,8 @@ const Pill = React.createClass({
161
170
avatar = < MemberAvatar member = { member } width = { 16 } height = { 16 } /> ;
162
171
}
163
172
pillClass = 'mx_UserPill' ;
173
+ href = null ;
174
+ onClick = this . onUserPillClicked . bind ( this ) ;
164
175
}
165
176
}
166
177
break ;
@@ -183,7 +194,7 @@ const Pill = React.createClass({
183
194
184
195
if ( this . state . pillType ) {
185
196
return this . props . inMessage ?
186
- < a className = { classes } href = { this . props . url } title = { resource } data-offset-key = { this . props . offsetKey } >
197
+ < a className = { classes } href = { href } onClick = { onClick } title = { resource } data-offset-key = { this . props . offsetKey } >
187
198
{ avatar }
188
199
{ linkText }
189
200
</ a > :
0 commit comments