Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e5180a4

Browse files
committed
Merge branch 'develop' into travis/skinning/pt3-easy-comps
2 parents 375ffaf + 1c482e2 commit e5180a4

39 files changed

+2446
-960
lines changed

res/css/structures/_SpaceRoomDirectory.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ limitations under the License.
203203
.mx_SpaceRoomDirectory_actions {
204204
width: 180px;
205205
text-align: right;
206-
height: min-content;
207-
margin: auto 0 auto 28px;
206+
margin-left: 28px;
207+
display: inline-flex;
208+
align-items: center;
208209

209210
.mx_AccessibleButton {
210211
vertical-align: middle;
@@ -223,9 +224,5 @@ limitations under the License.
223224
line-height: $font-15px;
224225
color: $secondary-fg-color;
225226
}
226-
227-
.mx_Checkbox {
228-
display: inline-block;
229-
}
230227
}
231228
}

res/css/views/avatars/_DecoratedRoomAvatar.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// XXX: We shouldn't be using TemporaryTile anywhere - delete it.
18-
.mx_DecoratedRoomAvatar, .mx_TemporaryTile {
17+
.mx_DecoratedRoomAvatar, .mx_ExtraTile {
1918
position: relative;
2019

2120
&.mx_DecoratedRoomAvatar_cutout .mx_BaseAvatar {

src/RoomInvite.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import MultiInviter from './utils/MultiInviter';
2222
import Modal from './Modal';
2323
import * as sdk from './';
2424
import { _t } from './languageHandler';
25-
import InviteDialog, {KIND_DM, KIND_INVITE, KIND_SPACE_INVITE} from "./components/views/dialogs/InviteDialog";
25+
import InviteDialog, {KIND_DM, KIND_INVITE} from "./components/views/dialogs/InviteDialog";
2626
import CommunityPrototypeInviteDialog from "./components/views/dialogs/CommunityPrototypeInviteDialog";
2727
import {CommunityPrototypeStore} from "./stores/CommunityPrototypeStore";
2828

@@ -50,11 +50,10 @@ export function showStartChatInviteDialog(initialText) {
5050
}
5151

5252
export function showRoomInviteDialog(roomId) {
53-
const isSpace = MatrixClientPeg.get()?.getRoom(roomId)?.isSpaceRoom();
5453
// This dialog handles the room creation internally - we don't need to worry about it.
5554
Modal.createTrackedDialog(
56-
"Invite Users", isSpace ? "Space" : "Room", InviteDialog, {
57-
kind: isSpace ? KIND_SPACE_INVITE : KIND_INVITE,
55+
"Invite Users", "", InviteDialog, {
56+
kind: KIND_INVITE,
5857
roomId,
5958
},
6059
/*className=*/null, /*isPriority=*/false, /*isStatic=*/true,

src/VoipUserMapper.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class VoipUserMapper {
3737
return results[0].userid;
3838
}
3939

40-
public async getOrCreateVirtualRoomForRoom(roomId: string):Promise<string> {
40+
public async getOrCreateVirtualRoomForRoom(roomId: string): Promise<string> {
4141
const userId = DMRoomMap.shared().getUserIdForRoomId(roomId);
4242
if (!userId) return null;
4343

@@ -52,15 +52,15 @@ export default class VoipUserMapper {
5252
return virtualRoomId;
5353
}
5454

55-
public nativeRoomForVirtualRoom(roomId: string):string {
55+
public nativeRoomForVirtualRoom(roomId: string): string {
5656
const virtualRoom = MatrixClientPeg.get().getRoom(roomId);
5757
if (!virtualRoom) return null;
5858
const virtualRoomEvent = virtualRoom.getAccountData(VIRTUAL_ROOM_EVENT_TYPE);
5959
if (!virtualRoomEvent || !virtualRoomEvent.getContent()) return null;
6060
return virtualRoomEvent.getContent()['native_room'] || null;
6161
}
6262

63-
public isVirtualRoom(room: Room):boolean {
63+
public isVirtualRoom(room: Room): boolean {
6464
if (this.nativeRoomForVirtualRoom(room.roomId)) return true;
6565

6666
if (this.virtualRoomIdCache.has(room.roomId)) return true;
@@ -79,6 +79,8 @@ export default class VoipUserMapper {
7979
}
8080

8181
public async onNewInvitedRoom(invitedRoom: Room) {
82+
if (!CallHandler.sharedInstance().getSupportsVirtualRooms()) return;
83+
8284
const inviterId = invitedRoom.getDMInviter();
8385
console.log(`Checking virtual-ness of room ID ${invitedRoom.roomId}, invited by ${inviterId}`);
8486
const result = await CallHandler.sharedInstance().sipNativeLookup(inviterId);

src/components/structures/MessagePanel.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ export default class MessagePanel extends React.Component {
500500

501501
let prevEvent = null; // the last event we showed
502502

503+
// Note: the EventTile might still render a "sent/sending receipt" independent of
504+
// this information. When not providing read receipt information, the tile is likely
505+
// to assume that sent receipts are to be shown more often.
503506
this._readReceiptsByEvent = {};
504507
if (this.props.showReadReceipts) {
505508
this._readReceiptsByEvent = this._getReadReceiptsByShownEvent();
@@ -536,10 +539,17 @@ export default class MessagePanel extends React.Component {
536539
const nextEvent = i < this.props.events.length - 1
537540
? this.props.events[i + 1]
538541
: null;
542+
543+
// The next event with tile is used to to determine the 'last successful' flag
544+
// when rendering the tile. The shouldShowEvent function is pretty quick at what
545+
// it does, so this should have no significant cost even when a room is used for
546+
// not-chat purposes.
547+
const nextTile = this.props.events.slice(i + 1).find(e => this._shouldShowEvent(e));
548+
539549
// make sure we unpack the array returned by _getTilesForEvent,
540550
// otherwise react will auto-generate keys and we will end up
541551
// replacing all of the DOM elements every time we paginate.
542-
ret.push(...this._getTilesForEvent(prevEvent, mxEv, last, nextEvent));
552+
ret.push(...this._getTilesForEvent(prevEvent, mxEv, last, nextEvent, nextTile));
543553
prevEvent = mxEv;
544554
}
545555

@@ -555,7 +565,7 @@ export default class MessagePanel extends React.Component {
555565
return ret;
556566
}
557567

558-
_getTilesForEvent(prevEvent, mxEv, last, nextEvent) {
568+
_getTilesForEvent(prevEvent, mxEv, last, nextEvent, nextEventWithTile) {
559569
const TileErrorBoundary = sdk.getComponent('messages.TileErrorBoundary');
560570
const EventTile = sdk.getComponent('rooms.EventTile');
561571
const DateSeparator = sdk.getComponent('messages.DateSeparator');
@@ -600,12 +610,23 @@ export default class MessagePanel extends React.Component {
600610
let isLastSuccessful = false;
601611
const isSentState = s => !s || s === 'sent';
602612
const isSent = isSentState(mxEv.getAssociatedStatus());
603-
if (!nextEvent && isSent) {
613+
const hasNextEvent = nextEvent && this._shouldShowEvent(nextEvent);
614+
if (!hasNextEvent && isSent) {
604615
isLastSuccessful = true;
605-
} else if (nextEvent && isSent && !isSentState(nextEvent.getAssociatedStatus())) {
616+
} else if (hasNextEvent && isSent && !isSentState(nextEvent.getAssociatedStatus())) {
606617
isLastSuccessful = true;
607618
}
608619

620+
// This is a bit nuanced, but if our next event is hidden but a future event is not
621+
// hidden then we're not the last successful.
622+
if (
623+
nextEventWithTile &&
624+
nextEventWithTile !== nextEvent &&
625+
isSentState(nextEventWithTile.getAssociatedStatus())
626+
) {
627+
isLastSuccessful = false;
628+
}
629+
609630
// We only want to consider "last successful" if the event is sent by us, otherwise of course
610631
// it's successful: we received it.
611632
isLastSuccessful = isLastSuccessful && mxEv.getSender() === MatrixClientPeg.get().getUserId();

src/components/structures/SpaceRoomDirectory.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export interface ISpaceSummaryEvent {
6464
state_key: string;
6565
content: {
6666
order?: string;
67+
suggested?: boolean;
6768
auto_join?: boolean;
6869
via?: string;
6970
};
@@ -91,7 +92,7 @@ const SubSpace: React.FC<ISubspaceProps> = ({
9192
const name = space.name || space.canonical_alias || space.aliases?.[0] || _t("Unnamed Space");
9293

9394
const evContent = event?.getContent();
94-
const [autoJoin, _setAutoJoin] = useState(evContent?.auto_join);
95+
const [suggested, _setSuggested] = useState(evContent?.suggested);
9596
const [removed, _setRemoved] = useState(!evContent?.via);
9697

9798
const cli = MatrixClientPeg.get();
@@ -102,12 +103,12 @@ const SubSpace: React.FC<ISubspaceProps> = ({
102103
let actions;
103104
if (editing && queueAction) {
104105
if (event && cli.getRoom(event.getRoomId())?.currentState.maySendStateEvent(event.getType(), cli.getUserId())) {
105-
const setAutoJoin = () => {
106-
_setAutoJoin(v => {
106+
const setSuggested = () => {
107+
_setSuggested(v => {
107108
queueAction({
108109
event,
109110
removed,
110-
autoJoin: !v,
111+
suggested: !v,
111112
});
112113
return !v;
113114
});
@@ -118,7 +119,7 @@ const SubSpace: React.FC<ISubspaceProps> = ({
118119
queueAction({
119120
event,
120121
removed: !v,
121-
autoJoin,
122+
suggested,
122123
});
123124
return !v;
124125
});
@@ -131,7 +132,7 @@ const SubSpace: React.FC<ISubspaceProps> = ({
131132
} else {
132133
actions = <React.Fragment>
133134
<FormButton kind="danger" onClick={setRemoved} label={_t("Remove from Space")} />
134-
<StyledCheckbox checked={autoJoin} onChange={setAutoJoin} />
135+
<StyledCheckbox checked={suggested} onChange={setSuggested} />
135136
</React.Fragment>;
136137
}
137138
} else {
@@ -182,8 +183,8 @@ const SubSpace: React.FC<ISubspaceProps> = ({
182183

183184
interface IAction {
184185
event: MatrixEvent;
186+
suggested: boolean;
185187
removed: boolean;
186-
autoJoin: boolean;
187188
}
188189

189190
interface IRoomTileProps {
@@ -199,7 +200,7 @@ const RoomTile = ({ room, event, editing, queueAction, onPreviewClick, onJoinCli
199200
const name = room.name || room.canonical_alias || room.aliases?.[0] || _t("Unnamed Room");
200201

201202
const evContent = event?.getContent();
202-
const [autoJoin, _setAutoJoin] = useState(evContent?.auto_join);
203+
const [suggested, _setSuggested] = useState(evContent?.suggested);
203204
const [removed, _setRemoved] = useState(!evContent?.via);
204205

205206
const cli = MatrixClientPeg.get();
@@ -209,12 +210,12 @@ const RoomTile = ({ room, event, editing, queueAction, onPreviewClick, onJoinCli
209210
let actions;
210211
if (editing && queueAction) {
211212
if (event && cli.getRoom(event.getRoomId())?.currentState.maySendStateEvent(event.getType(), cli.getUserId())) {
212-
const setAutoJoin = () => {
213-
_setAutoJoin(v => {
213+
const setSuggested = () => {
214+
_setSuggested(v => {
214215
queueAction({
215216
event,
216217
removed,
217-
autoJoin: !v,
218+
suggested: !v,
218219
});
219220
return !v;
220221
});
@@ -225,7 +226,7 @@ const RoomTile = ({ room, event, editing, queueAction, onPreviewClick, onJoinCli
225226
queueAction({
226227
event,
227228
removed: !v,
228-
autoJoin,
229+
suggested,
229230
});
230231
return !v;
231232
});
@@ -238,7 +239,7 @@ const RoomTile = ({ room, event, editing, queueAction, onPreviewClick, onJoinCli
238239
} else {
239240
actions = <React.Fragment>
240241
<FormButton kind="danger" onClick={setRemoved} label={_t("Remove from Space")} />
241-
<StyledCheckbox checked={autoJoin} onChange={setAutoJoin} />
242+
<StyledCheckbox checked={suggested} onChange={setSuggested} />
242243
</React.Fragment>;
243244
}
244245
} else {
@@ -445,10 +446,10 @@ const SpaceRoomDirectory: React.FC<IProps> = ({ space, initialText = "", onFinis
445446

446447
const onSaveButtonClicked = () => {
447448
// TODO setBusy
448-
pendingActions.current.forEach(({event, autoJoin, removed}) => {
449+
pendingActions.current.forEach(({event, suggested, removed}) => {
449450
const content = {
450451
...event.getContent(),
451-
auto_join: autoJoin,
452+
suggested,
452453
};
453454

454455
if (removed) {
@@ -463,7 +464,7 @@ const SpaceRoomDirectory: React.FC<IProps> = ({ space, initialText = "", onFinis
463464
if (isEditing) {
464465
adminButton = <React.Fragment>
465466
<FormButton label={_t("Save changes")} onClick={onSaveButtonClicked} />
466-
<span>{ _t("All users join by default") }</span>
467+
<span>{ _t("Promoted to users") }</span>
467468
</React.Fragment>;
468469
} else {
469470
adminButton = <FormButton label={_t("Manage rooms")} onClick={onManageButtonClicked} />;

src/components/structures/SpaceRoomView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
557557
case Phase.PublicCreateRooms:
558558
return <SpaceSetupFirstRooms
559559
space={this.props.space}
560-
title={_t("What discussions do you want to have?")}
560+
title={_t("What are some things you want to discuss?")}
561561
description={_t("We'll create rooms for each topic.")}
562562
onFinished={() => this.setState({ phase: Phase.PublicShare })}
563563
/>;

src/components/views/dialogs/InfoDialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class InfoDialog extends React.Component {
2727
className: PropTypes.string,
2828
title: PropTypes.string,
2929
description: PropTypes.node,
30-
button: PropTypes.oneOfType(PropTypes.string, PropTypes.bool),
30+
button: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
3131
onFinished: PropTypes.func,
3232
hasCloseButton: PropTypes.bool,
3333
onKeyDown: PropTypes.func,

src/components/views/dialogs/InviteDialog.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import {replaceableComponent} from "../../../utils/replaceableComponent";
4949

5050
export const KIND_DM = "dm";
5151
export const KIND_INVITE = "invite";
52-
export const KIND_SPACE_INVITE = "space_invite";
5352
export const KIND_CALL_TRANSFER = "call_transfer";
5453

5554
const INITIAL_ROOMS_SHOWN = 3; // Number of rooms to show at first
@@ -311,7 +310,7 @@ interface IInviteDialogProps {
311310
// not provided.
312311
kind: string,
313312

314-
// The room ID this dialog is for. Only required for KIND_INVITE and KIND_SPACE_INVITE.
313+
// The room ID this dialog is for. Only required for KIND_INVITE.
315314
roomId: string,
316315

317316
// The call to transfer. Only required for KIND_CALL_TRANSFER.
@@ -351,8 +350,8 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
351350
constructor(props) {
352351
super(props);
353352

354-
if ((props.kind === KIND_INVITE || props.kind === KIND_SPACE_INVITE) && !props.roomId) {
355-
throw new Error("When using KIND_INVITE or KIND_SPACE_INVITE a roomId is required for an InviteDialog");
353+
if ((props.kind === KIND_INVITE) && !props.roomId) {
354+
throw new Error("When using KIND_INVITE a roomId is required for an InviteDialog");
356355
} else if (props.kind === KIND_CALL_TRANSFER && !props.call) {
357356
throw new Error("When using KIND_CALL_TRANSFER a call is required for an InviteDialog");
358357
}
@@ -1029,7 +1028,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
10291028
sectionSubname = _t("May include members not in %(communityName)s", {communityName});
10301029
}
10311030

1032-
if (this.props.kind === KIND_INVITE || this.props.kind === KIND_SPACE_INVITE) {
1031+
if (this.props.kind === KIND_INVITE) {
10331032
sectionName = kind === 'recents' ? _t("Recently Direct Messaged") : _t("Suggestions");
10341033
}
10351034

@@ -1250,25 +1249,31 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
12501249
}
12511250
buttonText = _t("Go");
12521251
goButtonFn = this._startDm;
1253-
} else if (this.props.kind === KIND_INVITE || this.props.kind === KIND_SPACE_INVITE) {
1254-
title = this.props.kind === KIND_INVITE ? _t("Invite to this room") : _t("Invite to this space");
1252+
} else if (this.props.kind === KIND_INVITE) {
1253+
const room = MatrixClientPeg.get()?.getRoom(this.props.roomId);
1254+
const isSpace = room?.isSpaceRoom();
1255+
title = isSpace
1256+
? _t("Invite to %(spaceName)s", {
1257+
spaceName: room.name || _t("Unnamed Space"),
1258+
})
1259+
: _t("Invite to this room");
12551260

12561261
let helpTextUntranslated;
1257-
if (this.props.kind === KIND_INVITE) {
1262+
if (isSpace) {
12581263
if (identityServersEnabled) {
12591264
helpTextUntranslated = _td("Invite someone using their name, email address, username " +
1260-
"(like <userId/>) or <a>share this room</a>.");
1265+
"(like <userId/>) or <a>share this space</a>.");
12611266
} else {
12621267
helpTextUntranslated = _td("Invite someone using their name, username " +
1263-
"(like <userId/>) or <a>share this room</a>.");
1268+
"(like <userId/>) or <a>share this space</a>.");
12641269
}
1265-
} else { // KIND_SPACE_INVITE
1270+
} else {
12661271
if (identityServersEnabled) {
12671272
helpTextUntranslated = _td("Invite someone using their name, email address, username " +
1268-
"(like <userId/>) or <a>share this space</a>.");
1273+
"(like <userId/>) or <a>share this room</a>.");
12691274
} else {
12701275
helpTextUntranslated = _td("Invite someone using their name, username " +
1271-
"(like <userId/>) or <a>share this space</a>.");
1276+
"(like <userId/>) or <a>share this room</a>.");
12721277
}
12731278
}
12741279

0 commit comments

Comments
 (0)