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

Improved forwarding UI #5999

Merged
merged 42 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b9b237f
Replace forwarding UI with dialog
robintown May 8, 2021
74925b2
Test ForwardDialog
robintown May 8, 2021
7fa8176
Remove old forwarding code
robintown May 9, 2021
219c983
Use import instead of sdk.getComponent
robintown May 9, 2021
c96888c
Make ForwardDialog more readable
robintown May 10, 2021
100efb1
Fix ForwardDialog crashing when rendering reply
robintown May 10, 2021
eb07f1f
Test that ForwardDialog can render replies
robintown May 10, 2021
35cf0e1
Find components by name rather than class in ForwardDialog test
robintown May 10, 2021
09ba74a
Disable forward buttons for rooms without send permissions
robintown May 10, 2021
eb779cd
Test that forward buttons are disabled for rooms without permission
robintown May 10, 2021
5c10e1e
Fix lints
robintown May 10, 2021
bfba2b0
Push ForwardDialog scrollbar into the gutter
robintown May 10, 2021
503301a
Make rooms in ForwardDialog clickable
robintown May 10, 2021
c39d964
Merge branch 'develop' into improved-forwarding-ui
robintown May 10, 2021
7efbd2d
Hide unencrypted badge from ForwardDialog preview
robintown May 10, 2021
64e828d
Merge branch 'develop' into improved-forwarding-ui
robintown May 16, 2021
e798b36
Decorate forward dialog room avatars
robintown May 16, 2021
678b298
Merge branch 'develop' into improved-forwarding-ui
robintown May 19, 2021
83224dc
Ensure forward list room decorations are aligned
robintown May 19, 2021
6cb6c7f
Combine forward dialog room and DM lists
robintown May 19, 2021
f34d61c
Merge branch 'develop' into improved-forwarding-ui
robintown May 21, 2021
7a04502
Iterate on forward dialog design feedback
robintown May 21, 2021
cd460a2
Adjust forward dialog copy
robintown May 21, 2021
88e0e9b
Merge branch 'develop' into improved-forwarding-ui
robintown May 24, 2021
4009176
Make myself the copyright holder for forward dialog code
robintown May 24, 2021
6ced61b
Use camelCase
robintown May 24, 2021
121ed5e
Pass Matrix client around as matrixClient
robintown May 24, 2021
5c7da97
Give forward dialog send buttons an accessible label
robintown May 24, 2021
5671452
Merge branch 'develop' into improved-forwarding-ui
robintown Jun 1, 2021
b032422
Fix whitespace lints
robintown Jun 1, 2021
8efbdd0
Match forward dialog send failed indicator color with button
robintown Jun 1, 2021
c781679
Remove unused class
robintown Jun 1, 2021
4ef69fc
Use settings hooks in forward dialog
robintown Jun 1, 2021
59660df
Use a QueryMatcher for forward dialog filtering
robintown Jun 2, 2021
992861a
Fix forward dialog tests
robintown Jun 2, 2021
a06306d
Merge branch 'develop' into improved-forwarding-ui
robintown Jun 5, 2021
bbd5fab
Fix type check
robintown Jun 5, 2021
e891d18
Add my email to my copyright notices
robintown Jun 6, 2021
b978672
Merge branch 'develop' into improved-forwarding-ui
robintown Jun 7, 2021
a8dab04
Remove mystery dot from forward dialog preview
robintown Jun 7, 2021
b00ad63
Fix whitespace nitpick
robintown Jun 7, 2021
372f24f
Hide download links from forward dialog preview
robintown Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
@import "./views/dialogs/_DevtoolsDialog.scss";
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
@import "./views/dialogs/_FeedbackDialog.scss";
@import "./views/dialogs/_ForwardDialog.scss";
@import "./views/dialogs/_GroupAddressPicker.scss";
@import "./views/dialogs/_HostSignupDialog.scss";
@import "./views/dialogs/_IncomingSasDialog.scss";
Expand Down
115 changes: 115 additions & 0 deletions res/css/views/dialogs/_ForwardDialog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
robintown marked this conversation as resolved.
Show resolved Hide resolved

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_ForwardDialog {
width: 520px;
color: $primary-fg-color;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
min-height: 0;
height: 80vh;

.mx_ForwardDialog_preview {
max-height: 30%;
flex-shrink: 0;
overflow: scroll;

div {
pointer-events: none;
robintown marked this conversation as resolved.
Show resolved Hide resolved
}

.mx_EventTile_msgOption {
display: none;
}
}

.mx_ForwardList {
display: contents;

.mx_SearchBox {
// To match the space around the title
margin: 0 0 15px 0;
flex-grow: 0;
}

.mx_ForwardList_content {
flex-grow: 1;
}

.mx_ForwardList_noResults {
display: block;
margin-top: 24px;
}

.mx_ForwardList_section {
&:not(:first-child) {
margin-top: 24px;
}

> h3 {
margin: 0;
color: $secondary-fg-color;
font-size: $font-12px;
font-weight: $font-semi-bold;
line-height: $font-15px;
}

.mx_ForwardList_entry {
display: flex;
margin-top: 12px;

.mx_BaseAvatar {
margin-right: 12px;
}

.mx_ForwardList_entry_name {
font-size: $font-15px;
line-height: 30px;
flex-grow: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 12px;
}

.mx_AccessibleButton {
&.mx_ForwardList_sending, &.mx_ForwardList_sent {
&::before {
content: '';
display: inline-block;
background-color: $button-primary-bg-color;
mask-position: center;
mask-repeat: no-repeat;
mask-size: 14px;
width: 14px;
height: 14px;
margin-right: 5px;
}
}

&.mx_ForwardList_sending::before {
mask-image: url('$(res)/img/element-icons/circle-sending.svg');
}

&.mx_ForwardList_sent::before {
mask-image: url('$(res)/img/element-icons/circle-sent.svg');
}
}
}
}
}
}
30 changes: 2 additions & 28 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import ScrollPanel from "./ScrollPanel";
import TimelinePanel from "./TimelinePanel";
import ErrorBoundary from "../views/elements/ErrorBoundary";
import RoomPreviewBar from "../views/rooms/RoomPreviewBar";
import ForwardMessage from "../views/rooms/ForwardMessage";
import SearchBar from "../views/rooms/SearchBar";
import RoomUpgradeWarningBar from "../views/rooms/RoomUpgradeWarningBar";
import PinnedEventsPanel from "../views/rooms/PinnedEventsPanel";
Expand Down Expand Up @@ -136,7 +135,6 @@ export interface IState {
// Whether to highlight the event scrolled to
isInitialEventHighlighted?: boolean;
replyToEvent?: MatrixEvent;
forwardingEvent?: MatrixEvent;
numUnreadMessages: number;
draggingFile: boolean;
searching: boolean;
Expand Down Expand Up @@ -324,7 +322,6 @@ export default class RoomView extends React.Component<IProps, IState> {
initialEventId: RoomViewStore.getInitialEventId(),
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
replyToEvent: RoomViewStore.getQuotingEvent(),
forwardingEvent: RoomViewStore.getForwardingEvent(),
// we should only peek once we have a ready client
shouldPeek: this.state.matrixClientIsReady && RoomViewStore.shouldPeek(),
showingPinned: SettingsStore.getValue("PinnedEvents.isOpen", roomId),
Expand Down Expand Up @@ -1394,18 +1391,6 @@ export default class RoomView extends React.Component<IProps, IState> {
dis.dispatch({ action: "open_room_settings" });
};

private onCancelClick = () => {
console.log("updateTint from onCancelClick");
this.updateTint();
if (this.state.forwardingEvent) {
dis.dispatch({
action: 'forward_event',
event: null,
});
}
dis.fire(Action.FocusComposer);
};

private onAppsClick = () => {
dis.dispatch({
action: "appsDrawer",
Expand Down Expand Up @@ -1856,11 +1841,7 @@ export default class RoomView extends React.Component<IProps, IState> {

let aux = null;
let previewBar;
let hideCancel = false;
if (this.state.forwardingEvent) {
aux = <ForwardMessage onCancelClick={this.onCancelClick} />;
} else if (this.state.searching) {
hideCancel = true; // has own cancel
if (this.state.searching) {
aux = <SearchBar
searchInProgress={this.state.searchInProgress}
onCancelClick={this.onCancelSearchClick}
Expand All @@ -1869,9 +1850,7 @@ export default class RoomView extends React.Component<IProps, IState> {
/>;
} else if (showRoomUpgradeBar) {
aux = <RoomUpgradeWarningBar room={this.state.room} recommendation={roomVersionRecommendation} />;
hideCancel = true;
} else if (this.state.showingPinned) {
hideCancel = true; // has own cancel
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
} else if (myMembership !== "join") {
// We do have a room object for this room, but we're not currently in it.
Expand All @@ -1881,7 +1860,6 @@ export default class RoomView extends React.Component<IProps, IState> {
inviterName = this.props.oobData.inviterName;
}
const invitedEmail = this.props.threepidInvite?.toEmail;
hideCancel = true;
previewBar = (
<RoomPreviewBar
onJoinClick={this.onJoinButtonClicked}
Expand Down Expand Up @@ -1999,11 +1977,8 @@ export default class RoomView extends React.Component<IProps, IState> {
hideMessagePanel = true;
}

const shouldHighlight = this.state.isInitialEventHighlighted;
let highlightedEventId = null;
if (this.state.forwardingEvent) {
highlightedEventId = this.state.forwardingEvent.getId();
} else if (shouldHighlight) {
if (this.state.isInitialEventHighlighted) {
highlightedEventId = this.state.initialEventId;
}

Expand Down Expand Up @@ -2091,7 +2066,6 @@ export default class RoomView extends React.Component<IProps, IState> {
onSearchClick={this.onSearchClick}
onSettingsClick={this.onSettingsClick}
onPinnedClick={this.onPinnedClick}
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
onForgetClick={(myMembership === "leave") ? this.onForgetClick : null}
onLeaveClick={(myMembership === "join") ? this.onLeaveClick : null}
e2eStatus={this.state.e2eStatus}
Expand Down
8 changes: 4 additions & 4 deletions src/components/views/context_menus/MessageContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ export default class MessageContextMenu extends React.Component {
};

onForwardClick = () => {
if (this.props.onCloseDialog) this.props.onCloseDialog();
dis.dispatch({
action: 'forward_event',
const ForwardDialog = sdk.getComponent("dialogs.ForwardDialog");
robintown marked this conversation as resolved.
Show resolved Hide resolved
Modal.createTrackedDialog('Forward Message', '', ForwardDialog, {
cli: MatrixClientPeg.get(),
robintown marked this conversation as resolved.
Show resolved Hide resolved
event: this.props.mxEvent,
});
}, 'mx_Dialog_forwardmessage');
robintown marked this conversation as resolved.
Show resolved Hide resolved
this.closeMenu();
};

Expand Down
Loading