mirror of https://github.com/vector-im/riot-web
Remove old isAlone checker
parent
2fdfe9346f
commit
2594ff8e80
|
@ -153,16 +153,6 @@ limitations under the License.
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomStatusBar_isAlone {
|
|
||||||
height: 50px;
|
|
||||||
line-height: $font-50px;
|
|
||||||
|
|
||||||
color: $primary-fg-color;
|
|
||||||
opacity: 0.5;
|
|
||||||
overflow-y: hidden;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_MatrixChat_useCompactLayout {
|
.mx_MatrixChat_useCompactLayout {
|
||||||
.mx_RoomStatusBar {
|
.mx_RoomStatusBar {
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
|
|
|
@ -41,9 +41,6 @@ export default class RoomStatusBar extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
// the room this statusbar is representing.
|
// the room this statusbar is representing.
|
||||||
room: PropTypes.object.isRequired,
|
room: PropTypes.object.isRequired,
|
||||||
// This is true when the user is alone in the room, but has also sent a message.
|
|
||||||
// Used to suggest to the user to invite someone
|
|
||||||
sentMessageAndIsAlone: PropTypes.bool,
|
|
||||||
|
|
||||||
// The active call in the room, if any (means we show the call bar
|
// The active call in the room, if any (means we show the call bar
|
||||||
// along with the status of the call)
|
// along with the status of the call)
|
||||||
|
@ -68,10 +65,6 @@ export default class RoomStatusBar extends React.Component {
|
||||||
// 'you are alone' bar
|
// 'you are alone' bar
|
||||||
onInviteClick: PropTypes.func,
|
onInviteClick: PropTypes.func,
|
||||||
|
|
||||||
// callback for when the user clicks on the 'stop warning me' button in the
|
|
||||||
// 'you are alone' bar
|
|
||||||
onStopWarningClick: PropTypes.func,
|
|
||||||
|
|
||||||
// callback for when we do something that changes the size of the
|
// callback for when we do something that changes the size of the
|
||||||
// status bar. This is used to trigger a re-layout in the parent
|
// status bar. This is used to trigger a re-layout in the parent
|
||||||
// component.
|
// component.
|
||||||
|
@ -159,10 +152,7 @@ export default class RoomStatusBar extends React.Component {
|
||||||
// changed - so we use '0' to indicate normal size, and other values to
|
// changed - so we use '0' to indicate normal size, and other values to
|
||||||
// indicate other sizes.
|
// indicate other sizes.
|
||||||
_getSize() {
|
_getSize() {
|
||||||
if (this._shouldShowConnectionError() ||
|
if (this._shouldShowConnectionError() || this._showCallBar()) {
|
||||||
this._showCallBar() ||
|
|
||||||
this.props.sentMessageAndIsAlone
|
|
||||||
) {
|
|
||||||
return STATUS_BAR_EXPANDED;
|
return STATUS_BAR_EXPANDED;
|
||||||
} else if (this.state.unsentMessages.length > 0) {
|
} else if (this.state.unsentMessages.length > 0) {
|
||||||
return STATUS_BAR_EXPANDED_LARGE;
|
return STATUS_BAR_EXPANDED_LARGE;
|
||||||
|
@ -325,24 +315,6 @@ export default class RoomStatusBar extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you're alone in the room, and have sent a message, suggest to invite someone
|
|
||||||
if (this.props.sentMessageAndIsAlone && !this.props.isPeeking) {
|
|
||||||
return (
|
|
||||||
<div className="mx_RoomStatusBar_isAlone">
|
|
||||||
{ _t("There's no one else here! Would you like to <inviteText>invite others</inviteText> " +
|
|
||||||
"or <nowarnText>stop warning about the empty room</nowarnText>?",
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
'inviteText': (sub) =>
|
|
||||||
<a className="mx_RoomStatusBar_resend_link" key="invite" onClick={this.props.onInviteClick}>{ sub }</a>,
|
|
||||||
'nowarnText': (sub) =>
|
|
||||||
<a className="mx_RoomStatusBar_resend_link" key="nowarn" onClick={this.props.onStopWarningClick}>{ sub }</a>,
|
|
||||||
},
|
|
||||||
) }
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,6 @@ export interface IState {
|
||||||
guestsCanJoin: boolean;
|
guestsCanJoin: boolean;
|
||||||
canPeek: boolean;
|
canPeek: boolean;
|
||||||
showApps: boolean;
|
showApps: boolean;
|
||||||
isAlone: boolean;
|
|
||||||
isPeeking: boolean;
|
isPeeking: boolean;
|
||||||
showingPinned: boolean;
|
showingPinned: boolean;
|
||||||
showReadReceipts: boolean;
|
showReadReceipts: boolean;
|
||||||
|
@ -223,7 +222,6 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
guestsCanJoin: false,
|
guestsCanJoin: false,
|
||||||
canPeek: false,
|
canPeek: false,
|
||||||
showApps: false,
|
showApps: false,
|
||||||
isAlone: false,
|
|
||||||
isPeeking: false,
|
isPeeking: false,
|
||||||
showingPinned: false,
|
showingPinned: false,
|
||||||
showReadReceipts: true,
|
showReadReceipts: true,
|
||||||
|
@ -705,9 +703,8 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
private onAction = payload => {
|
private onAction = payload => {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'message_send_failed':
|
|
||||||
case 'message_sent':
|
case 'message_sent':
|
||||||
this.checkIfAlone(this.state.room);
|
this.checkDesktopNotifications();
|
||||||
break;
|
break;
|
||||||
case 'post_sticker_message':
|
case 'post_sticker_message':
|
||||||
this.injectSticker(
|
this.injectSticker(
|
||||||
|
@ -1025,36 +1022,15 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// rate limited because a power level change will emit an event for every member in the room.
|
// rate limited because a power level change will emit an event for every member in the room.
|
||||||
private updateRoomMembers = rateLimitedFunc((dueToMember) => {
|
private updateRoomMembers = rateLimitedFunc(() => {
|
||||||
this.updateDMState();
|
this.updateDMState();
|
||||||
|
|
||||||
let memberCountInfluence = 0;
|
|
||||||
if (dueToMember && dueToMember.membership === "invite" && this.state.room.getInvitedMemberCount() === 0) {
|
|
||||||
// A member got invited, but the room hasn't detected that change yet. Influence the member
|
|
||||||
// count by 1 to counteract this.
|
|
||||||
memberCountInfluence = 1;
|
|
||||||
}
|
|
||||||
this.checkIfAlone(this.state.room, memberCountInfluence);
|
|
||||||
|
|
||||||
this.updateE2EStatus(this.state.room);
|
this.updateE2EStatus(this.state.room);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
private checkIfAlone(room: Room, countInfluence?: number) {
|
private checkDesktopNotifications() {
|
||||||
let warnedAboutLonelyRoom = false;
|
const memberCount = this.state.room.getJoinedMemberCount() + this.state.room.getInvitedMemberCount();
|
||||||
if (localStorage) {
|
// if they are not alone prompt the user about notifications so they don't miss replies
|
||||||
warnedAboutLonelyRoom = Boolean(localStorage.getItem('mx_user_alone_warned_' + this.state.room.roomId));
|
if (memberCount > 1 && Notifier.shouldShowPrompt()) {
|
||||||
}
|
|
||||||
if (warnedAboutLonelyRoom) {
|
|
||||||
if (this.state.isAlone) this.setState({isAlone: false});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let joinedOrInvitedMemberCount = room.getJoinedMemberCount() + room.getInvitedMemberCount();
|
|
||||||
if (countInfluence) joinedOrInvitedMemberCount += countInfluence;
|
|
||||||
this.setState({isAlone: joinedOrInvitedMemberCount === 1});
|
|
||||||
|
|
||||||
// if they are not alone additionally prompt the user about notifications so they don't miss replies
|
|
||||||
if (joinedOrInvitedMemberCount > 1 && Notifier.shouldShowPrompt()) {
|
|
||||||
showNotificationsToast(true);
|
showNotificationsToast(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1091,14 +1067,6 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
action: 'view_invite',
|
action: 'view_invite',
|
||||||
roomId: this.state.room.roomId,
|
roomId: this.state.room.roomId,
|
||||||
});
|
});
|
||||||
this.setState({isAlone: false}); // there's a good chance they'll invite someone
|
|
||||||
};
|
|
||||||
|
|
||||||
private onStopAloneWarningClick = () => {
|
|
||||||
if (localStorage) {
|
|
||||||
localStorage.setItem('mx_user_alone_warned_' + this.state.room.roomId, String(true));
|
|
||||||
}
|
|
||||||
this.setState({isAlone: false});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onJoinButtonClicked = () => {
|
private onJoinButtonClicked = () => {
|
||||||
|
@ -1797,12 +1765,10 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
isStatusAreaExpanded = this.state.statusBarVisible;
|
isStatusAreaExpanded = this.state.statusBarVisible;
|
||||||
statusBar = <RoomStatusBar
|
statusBar = <RoomStatusBar
|
||||||
room={this.state.room}
|
room={this.state.room}
|
||||||
sentMessageAndIsAlone={this.state.isAlone}
|
|
||||||
callState={this.state.callState}
|
callState={this.state.callState}
|
||||||
callType={activeCall ? activeCall.type : null}
|
callType={activeCall ? activeCall.type : null}
|
||||||
isPeeking={myMembership !== "join"}
|
isPeeking={myMembership !== "join"}
|
||||||
onInviteClick={this.onInviteButtonClick}
|
onInviteClick={this.onInviteButtonClick}
|
||||||
onStopWarningClick={this.onStopAloneWarningClick}
|
|
||||||
onVisible={this.onStatusBarVisible}
|
onVisible={this.onStatusBarVisible}
|
||||||
onHidden={this.onStatusBarHidden}
|
onHidden={this.onStatusBarHidden}
|
||||||
/>;
|
/>;
|
||||||
|
|
Loading…
Reference in New Issue