Merge pull request #367 from matrix-org/rav/remove_bad_props
Stop the Avatar classes setting properties on <span>s
This commit is contained in:
commit
88be2827fd
2 changed files with 21 additions and 15 deletions
|
@ -133,32 +133,36 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var name = this.props.name;
|
|
||||||
|
|
||||||
var imageUrl = this.state.imageUrls[this.state.urlsIndex];
|
var imageUrl = this.state.imageUrls[this.state.urlsIndex];
|
||||||
|
|
||||||
|
const {
|
||||||
|
name, idName, title, url, urls, width, height, resizeMethod,
|
||||||
|
defaultToInitialLetter,
|
||||||
|
...otherProps
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
if (imageUrl === this.state.defaultImageUrl) {
|
if (imageUrl === this.state.defaultImageUrl) {
|
||||||
var initialLetter = emojifyText(this._getInitialLetter(this.props.name));
|
var initialLetter = emojifyText(this._getInitialLetter(name));
|
||||||
return (
|
return (
|
||||||
<span className="mx_BaseAvatar" {...this.props}>
|
<span className="mx_BaseAvatar" {...otherProps}>
|
||||||
<span className="mx_BaseAvatar_initial" aria-hidden="true"
|
<span className="mx_BaseAvatar_initial" aria-hidden="true"
|
||||||
style={{ fontSize: (this.props.width * 0.65) + "px",
|
style={{ fontSize: (width * 0.65) + "px",
|
||||||
width: this.props.width + "px",
|
width: width + "px",
|
||||||
lineHeight: this.props.height + "px" }}
|
lineHeight: height + "px" }}
|
||||||
dangerouslySetInnerHTML={initialLetter}>
|
dangerouslySetInnerHTML={initialLetter}>
|
||||||
</span>
|
</span>
|
||||||
<img className="mx_BaseAvatar_image" src={imageUrl}
|
<img className="mx_BaseAvatar_image" src={imageUrl}
|
||||||
alt="" title={this.props.title} onError={this.onError}
|
alt="" title={title} onError={this.onError}
|
||||||
width={this.props.width} height={this.props.height} />
|
width={width} height={height} />
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<img className="mx_BaseAvatar mx_BaseAvatar_image" src={imageUrl}
|
<img className="mx_BaseAvatar mx_BaseAvatar_image" src={imageUrl}
|
||||||
onError={this.onError}
|
onError={this.onError}
|
||||||
width={this.props.width} height={this.props.height}
|
width={width} height={height}
|
||||||
title={this.props.title} alt=""
|
title={title} alt=""
|
||||||
{...this.props} />
|
{...otherProps} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -126,11 +126,13 @@ module.exports = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
|
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
|
||||||
|
|
||||||
var roomName = this.props.room ? this.props.room.name : this.props.oobData.name;
|
var {room, oobData, ...otherProps} = this.props;
|
||||||
|
|
||||||
|
var roomName = room ? room.name : oobData.name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseAvatar {...this.props} name={roomName}
|
<BaseAvatar {...otherProps} name={roomName}
|
||||||
idName={this.props.room ? this.props.room.roomId : null}
|
idName={room ? room.roomId : null}
|
||||||
urls={this.state.urls} />
|
urls={this.state.urls} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue