mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-13 17:02:02 +03:00
Convert to API objects
& remove redundant power label
This commit is contained in:
parent
c1546ceb59
commit
4daf9064d9
2 changed files with 6 additions and 7 deletions
|
@ -26,6 +26,7 @@ import DMRoomMap from '../../../utils/DMRoomMap';
|
||||||
import Unread from '../../../Unread';
|
import Unread from '../../../Unread';
|
||||||
import { GroupMemberType } from '../../../groups';
|
import { GroupMemberType } from '../../../groups';
|
||||||
import { findReadReceiptFromUserId } from '../../../utils/Receipt';
|
import { findReadReceiptFromUserId } from '../../../utils/Receipt';
|
||||||
|
import { groupMemberFromApiObject } from '../../../groups';
|
||||||
import withMatrixClient from '../../../wrappers/withMatrixClient';
|
import withMatrixClient from '../../../wrappers/withMatrixClient';
|
||||||
import AccessibleButton from '../elements/AccessibleButton';
|
import AccessibleButton from '../elements/AccessibleButton';
|
||||||
import GeminiScrollbar from 'react-gemini-scrollbar';
|
import GeminiScrollbar from 'react-gemini-scrollbar';
|
||||||
|
@ -48,7 +49,9 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
this.setState({fetching: true});
|
this.setState({fetching: true});
|
||||||
this.props.matrixClient.getGroupUsers(this.props.groupId).then((result) => {
|
this.props.matrixClient.getGroupUsers(this.props.groupId).then((result) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
members: result.chunk,
|
members: result.chunk.map((apiMember) => {
|
||||||
|
return groupMemberFromApiObject(apiMember);
|
||||||
|
}),
|
||||||
fetching: false,
|
fetching: false,
|
||||||
});
|
});
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
@ -91,7 +94,7 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
|
|
||||||
let targetIsInGroup = false;
|
let targetIsInGroup = false;
|
||||||
for (const m of this.state.members) {
|
for (const m of this.state.members) {
|
||||||
if (m.user_id == this.props.member.userId) {
|
if (m.userId == this.props.member.userId) {
|
||||||
targetIsInGroup = true;
|
targetIsInGroup = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,6 @@ export default withMatrixClient(React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPowerLabel: function() {
|
|
||||||
return _t("%(userName)s (power %(powerLevelNumber)s)", {userName: this.props.member.userId, powerLevelNumber: this.props.member.powerLevel});
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
|
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
|
||||||
const EntityTile = sdk.getComponent('rooms.EntityTile');
|
const EntityTile = sdk.getComponent('rooms.EntityTile');
|
||||||
|
@ -60,7 +56,7 @@ export default withMatrixClient(React.createClass({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EntityTile presenceState="online"
|
<EntityTile presenceState="online"
|
||||||
avatarJsx={av} title={this.getPowerLabel()} onClick={this.onClick}
|
avatarJsx={av} onClick={this.onClick}
|
||||||
name={name} powerLevel={0} suppressOnHover={true}
|
name={name} powerLevel={0} suppressOnHover={true}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue