Wire up members button to member view

Ideally this would open up the group members panel, but that's exceedingly difficult. Instead, we switch to the general chat and rename the button to be a bit more helpful.
This commit is contained in:
Travis Ralston 2020-08-31 10:12:12 -06:00
parent 281e2ab27b
commit 93d67a6689
6 changed files with 52 additions and 11 deletions

View file

@ -27,6 +27,8 @@ import rate_limited_func from "../../../ratelimitedfunc";
import {MatrixClientPeg} from "../../../MatrixClientPeg";
import * as sdk from "../../../index";
import CallHandler from "../../../CallHandler";
import TagOrderStore from "../../../stores/TagOrderStore";
import {CommunityPrototypeStore} from "../../../stores/CommunityPrototypeStore";
const INITIAL_LOAD_NUM_MEMBERS = 30;
const INITIAL_LOAD_NUM_INVITED = 5;
@ -464,10 +466,19 @@ export default createReactClass({
}
}
let inviteButtonText = _t("Invite to this room");
const communityId = TagOrderStore.getSelectedPrototypeTag();
if (communityId) {
const chat = CommunityPrototypeStore.instance.getGeneralChat(communityId);
if (chat && chat.roomId === this.props.roomId) {
inviteButtonText = _t("Invite to this community");
}
}
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
inviteButton =
<AccessibleButton className="mx_MemberList_invite" onClick={this.onInviteButtonClick} disabled={!canInvite}>
<span>{ _t('Invite to this room') }</span>
<span>{ inviteButtonText }</span>
</AccessibleButton>;
}