mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
Revert "Fix showing peek preview while LL members are loading"
This commit is contained in:
parent
6967bcb445
commit
bf7633250a
@ -480,7 +480,7 @@ function getMembershipCount(event, roomId) {
|
|||||||
sendError(event, _t('This room is not recognised.'));
|
sendError(event, _t('This room is not recognised.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const count = room.getJoinedMemberCount();
|
const count = room.getJoinedMembers().length;
|
||||||
sendResponse(event, count);
|
sendResponse(event, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,11 +497,12 @@ function canSendEvent(event, roomId) {
|
|||||||
sendError(event, _t('This room is not recognised.'));
|
sendError(event, _t('This room is not recognised.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (room.getMyMembership() !== "join") {
|
const me = client.credentials.userId;
|
||||||
|
const member = room.getMember(me);
|
||||||
|
if (!member || member.membership !== "join") {
|
||||||
sendError(event, _t('You are not in this room.'));
|
sendError(event, _t('You are not in this room.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const me = client.credentials.userId;
|
|
||||||
|
|
||||||
let canSend = false;
|
let canSend = false;
|
||||||
if (isState) {
|
if (isState) {
|
||||||
|
@ -72,7 +72,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() {
|
|||||||
for (var i = 0; i < rooms.length; i++) {
|
for (var i = 0; i < rooms.length; i++) {
|
||||||
var confUser = rooms[i].getMember(this.confUserId);
|
var confUser = rooms[i].getMember(this.confUserId);
|
||||||
if (confUser && confUser.membership === "join" &&
|
if (confUser && confUser.membership === "join" &&
|
||||||
rooms[i].getJoinedMemberCount() === 2) {
|
rooms[i].getJoinedMembers().length === 2) {
|
||||||
confRoom = rooms[i];
|
confRoom = rooms[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ module.exports = React.createClass({
|
|||||||
const room = cli.getRoom(this.props.roomId);
|
const room = cli.getRoom(this.props.roomId);
|
||||||
let isUserInRoom;
|
let isUserInRoom;
|
||||||
if (room) {
|
if (room) {
|
||||||
const numMembers = room.getJoinedMemberCount();
|
const numMembers = room.getJoinedMembers().length;
|
||||||
membersTitle = _t('%(count)s Members', { count: numMembers });
|
membersTitle = _t('%(count)s Members', { count: numMembers });
|
||||||
membersBadge = <div title={membersTitle}>{ formatCount(numMembers) }</div>;
|
membersBadge = <div title={membersTitle}>{ formatCount(numMembers) }</div>;
|
||||||
isUserInRoom = room.hasMembershipState(this.context.matrixClient.credentials.userId, 'join');
|
isUserInRoom = room.hasMembershipState(this.context.matrixClient.credentials.userId, 'join');
|
||||||
|
@ -363,7 +363,7 @@ module.exports = React.createClass({
|
|||||||
// XXX: EVIL HACK to autofocus inviting on empty rooms.
|
// XXX: EVIL HACK to autofocus inviting on empty rooms.
|
||||||
// We use the setTimeout to avoid racing with focus_composer.
|
// We use the setTimeout to avoid racing with focus_composer.
|
||||||
if (this.state.room &&
|
if (this.state.room &&
|
||||||
this.state.room.getJoinedMemberCount() == 1 &&
|
this.state.room.getJoinedMembers().length == 1 &&
|
||||||
this.state.room.getLiveTimeline() &&
|
this.state.room.getLiveTimeline() &&
|
||||||
this.state.room.getLiveTimeline().getEvents() &&
|
this.state.room.getLiveTimeline().getEvents() &&
|
||||||
this.state.room.getLiveTimeline().getEvents().length <= 6) {
|
this.state.room.getLiveTimeline().getEvents().length <= 6) {
|
||||||
@ -1507,8 +1507,9 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const myMembership = this.state.room.getMyMembership();
|
const myUserId = MatrixClientPeg.get().credentials.userId;
|
||||||
if (myMembership == 'invite') {
|
const myMember = this.state.room.getMember(myUserId);
|
||||||
|
if (myMember && myMember.membership == 'invite') {
|
||||||
if (this.state.joining || this.state.rejecting) {
|
if (this.state.joining || this.state.rejecting) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
@ -1516,8 +1517,6 @@ module.exports = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const myUserId = MatrixClientPeg.get().credentials.userId;
|
|
||||||
const myMember = this.state.room.getMember(myUserId);
|
|
||||||
const inviteEvent = myMember.events.member;
|
const inviteEvent = myMember.events.member;
|
||||||
var inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender();
|
var inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender();
|
||||||
|
|
||||||
@ -1601,7 +1600,7 @@ module.exports = React.createClass({
|
|||||||
} else if (this.state.showingPinned) {
|
} else if (this.state.showingPinned) {
|
||||||
hideCancel = true; // has own cancel
|
hideCancel = true; // has own cancel
|
||||||
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
|
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
|
||||||
} else if (myMembership !== "join") {
|
} else if (!myMember || myMember.membership !== "join") {
|
||||||
// We do have a room object for this room, but we're not currently in it.
|
// We do have a room object for this room, but we're not currently in it.
|
||||||
// We may have a 3rd party invite to it.
|
// We may have a 3rd party invite to it.
|
||||||
var inviterName = undefined;
|
var inviterName = undefined;
|
||||||
@ -1643,7 +1642,7 @@ module.exports = React.createClass({
|
|||||||
let messageComposer, searchInfo;
|
let messageComposer, searchInfo;
|
||||||
const canSpeak = (
|
const canSpeak = (
|
||||||
// joined and not showing search results
|
// joined and not showing search results
|
||||||
myMembership == 'join' && !this.state.searchResults
|
myMember && (myMember.membership == 'join') && !this.state.searchResults
|
||||||
);
|
);
|
||||||
if (canSpeak) {
|
if (canSpeak) {
|
||||||
messageComposer =
|
messageComposer =
|
||||||
@ -1778,15 +1777,15 @@ module.exports = React.createClass({
|
|||||||
oobData={this.props.oobData}
|
oobData={this.props.oobData}
|
||||||
editing={this.state.editingRoomSettings}
|
editing={this.state.editingRoomSettings}
|
||||||
saving={this.state.uploadingRoomSettings}
|
saving={this.state.uploadingRoomSettings}
|
||||||
inRoom={myMembership === 'join'}
|
inRoom={myMember && myMember.membership === 'join'}
|
||||||
collapsedRhs={this.props.collapsedRhs}
|
collapsedRhs={this.props.collapsedRhs}
|
||||||
onSearchClick={this.onSearchClick}
|
onSearchClick={this.onSearchClick}
|
||||||
onSettingsClick={this.onSettingsClick}
|
onSettingsClick={this.onSettingsClick}
|
||||||
onPinnedClick={this.onPinnedClick}
|
onPinnedClick={this.onPinnedClick}
|
||||||
onSaveClick={this.onSettingsSaveClick}
|
onSaveClick={this.onSettingsSaveClick}
|
||||||
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
|
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
|
||||||
onForgetClick={(myMembership === "leave") ? this.onForgetClick : null}
|
onForgetClick={(myMember && myMember.membership === "leave") ? this.onForgetClick : null}
|
||||||
onLeaveClick={(myMembership === "join") ? this.onLeaveClick : null}
|
onLeaveClick={(myMember && myMember.membership === "join") ? this.onLeaveClick : null}
|
||||||
/>
|
/>
|
||||||
{ auxPanel }
|
{ auxPanel }
|
||||||
<div className={fadableSectionClasses}>
|
<div className={fadableSectionClasses}>
|
||||||
|
@ -346,18 +346,20 @@ module.exports = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const myMembership = this.props.room.getMyMembership();
|
const myMember = this.props.room.getMember(
|
||||||
|
MatrixClientPeg.get().credentials.userId,
|
||||||
|
);
|
||||||
|
|
||||||
// Can't set notif level or tags on non-join rooms
|
// Can't set notif level or tags on non-join rooms
|
||||||
if (myMembership !== 'join') {
|
if (myMember.membership !== 'join') {
|
||||||
return this._renderLeaveMenu(myMembership);
|
return this._renderLeaveMenu(myMember.membership);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{ this._renderNotifMenu() }
|
{ this._renderNotifMenu() }
|
||||||
<hr className="mx_RoomTileContextMenu_separator" />
|
<hr className="mx_RoomTileContextMenu_separator" />
|
||||||
{ this._renderLeaveMenu(myMembership) }
|
{ this._renderLeaveMenu(myMember.membership) }
|
||||||
<hr className="mx_RoomTileContextMenu_separator" />
|
<hr className="mx_RoomTileContextMenu_separator" />
|
||||||
{ this._renderRoomTagMenu() }
|
{ this._renderRoomTagMenu() }
|
||||||
</div>
|
</div>
|
||||||
|
@ -794,15 +794,15 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let leaveButton = null;
|
let leaveButton = null;
|
||||||
const myMemberShip = this.props.room.getMyMembership();
|
const myMember = this.props.room.getMember(myUserId);
|
||||||
if (myMemberShip) {
|
if (myMember) {
|
||||||
if (myMemberShip === "join") {
|
if (myMember.membership === "join") {
|
||||||
leaveButton = (
|
leaveButton = (
|
||||||
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onLeaveClick}>
|
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onLeaveClick}>
|
||||||
{ _t('Leave room') }
|
{ _t('Leave room') }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
} else if (myMemberShip === "leave") {
|
} else if (myMember.membership === "leave") {
|
||||||
leaveButton = (
|
leaveButton = (
|
||||||
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onForgetClick}>
|
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onForgetClick}>
|
||||||
{ _t('Forget room') }
|
{ _t('Forget room') }
|
||||||
|
@ -256,7 +256,6 @@ export function mkStubRoom(roomId = null) {
|
|||||||
getAccountData: () => null,
|
getAccountData: () => null,
|
||||||
hasMembershipState: () => null,
|
hasMembershipState: () => null,
|
||||||
getVersion: () => '1',
|
getVersion: () => '1',
|
||||||
getMyMembership: () => "join",
|
|
||||||
currentState: {
|
currentState: {
|
||||||
getStateEvents: sinon.stub(),
|
getStateEvents: sinon.stub(),
|
||||||
mayClientSendStateEvent: sinon.stub().returns(true),
|
mayClientSendStateEvent: sinon.stub().returns(true),
|
||||||
|
Loading…
Reference in New Issue
Block a user