@@ -58,7 +58,7 @@ module.exports = React.createClass({
5858 } ,
5959
6060 getInitialState : function ( ) {
61- return { menu : false } ;
61+ return { menu : false , allReadAvatars : false } ;
6262 } ,
6363
6464 componentDidUpdate : function ( ) {
@@ -82,6 +82,12 @@ module.exports = React.createClass({
8282 this . setState ( { menu : true } ) ;
8383 } ,
8484
85+ toggleAllReadAvatars : function ( ) {
86+ this . setState ( {
87+ allReadAvatars : ! this . state . allReadAvatars
88+ } ) ;
89+ } ,
90+
8591 getReadAvatars : function ( ) {
8692 var avatars = [ ] ;
8793
@@ -136,25 +142,39 @@ module.exports = React.createClass({
136142 } ) ;
137143 }
138144
145+ var style = {
146+ left : left + 'px' ,
147+ top : '0px' ,
148+ visibility : i < MAX_READ_AVATARS || this . state . allReadAvatars ? 'visible' : 'hidden'
149+ } ;
150+
139151 // add to the start so the most recent is on the end (ie. ends up rightmost)
140152 avatars . unshift (
141153 < MemberAvatar key = { member . userId } member = { member }
142154 width = { 14 } height = { 14 } resizeMethod = "crop"
143- style = { { left : left + 'px' , top : '0px' } }
155+ style = { style }
144156 startStyle = { startStyles }
145157 enterTransitionOpts = { enterTransitionOpts }
146158 id = { 'mx_readAvatar' + member . userId }
159+ onClick = { this . toggleAllReadAvatars }
147160 />
148161 ) ;
149- left -= 15 ;
150- if ( i + 1 >= MAX_READ_AVATARS ) {
151- break ;
162+ // TODO: we keep the extra read avatars in the dom to make animation simpler
163+ // we could optimise this to reduce the dom size.
164+ if ( i < MAX_READ_AVATARS - 1 || this . state . allReadAvatars ) {
165+ left -= 15 ;
152166 }
153167 }
154- var remainder = receipts . length - MAX_READ_AVATARS ;
155- var remText ;
156- if ( remainder > 0 ) {
157- remText = < span className = "mx_EventTile_readAvatarRemainder" style = { { left : left } } > +{ remainder } </ span > ;
168+ if ( ! this . state . allReadAvatars ) {
169+ var remainder = receipts . length - MAX_READ_AVATARS ;
170+ var remText ;
171+ left -= 15 ;
172+ if ( remainder > 0 ) {
173+ remText = < span className = "mx_EventTile_readAvatarRemainder"
174+ onClick = { this . toggleAllReadAvatars }
175+ style = { { left : left } } > +{ remainder }
176+ </ span > ;
177+ }
158178 }
159179
160180 return < span className = "mx_EventTile_readAvatars" ref = { this . collectReadAvatarNode } >
0 commit comments