From 336f623aa905b2feb7879e7b67f8c6eb4db8f821 Mon Sep 17 00:00:00 2001
From: "J. Ryan Stinnett"
Date: Wed, 29 Jan 2020 12:00:02 +0000
Subject: [PATCH 1/5] Check for timeline in pre-join UISI path
Somehow, live events can be missing a timeline, even though that should not
happen... This restores @uhoreg's previous version where we test for this case.
Fixes https://github.com/vector-im/riot-web/issues/12120
---
src/components/structures/TimelinePanel.js | 48 ++++++++++++++--------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js
index e708fad6a4..25526c3139 100644
--- a/src/components/structures/TimelinePanel.js
+++ b/src/components/structures/TimelinePanel.js
@@ -1171,28 +1171,40 @@ const TimelinePanel = createReactClass({
// get the user's membership at the last event by getting the timeline
// that the event belongs to, and traversing the timeline looking for
// that event, while keeping track of the user's membership
- const lastEvent = events[events.length - 1];
- const timeline = room.getTimelineForEvent(lastEvent.getId());
- const userMembershipEvent =
- timeline.getState(EventTimeline.FORWARDS).getMember(userId);
- let userMembership = userMembershipEvent
- ? userMembershipEvent.membership : "leave";
- const timelineEvents = timeline.getEvents();
- for (let i = timelineEvents.length - 1; i >= 0; i--) {
- const event = timelineEvents[i];
- if (event.getId() === lastEvent.getId()) {
- // found the last event, so we can stop looking through the timeline
- break;
- } else if (event.getStateKey() === userId
- && event.getType() === "m.room.member") {
- const prevContent = event.getPrevContent();
- userMembership = prevContent.membership || "leave";
+ let i;
+ let userMembership = "leave";
+ for (i = events.length - 1; i >= 0; i--) {
+ const timeline = room.getTimelineForEvent(events[i].getId());
+ if (!timeline) {
+ // Somehow, it seems to be possible for live events to not have
+ // a timeline, even though that should not happen. :(
+ // https://github.com/vector-im/riot-web/issues/12120
+ console.warn(
+ `Event ${events[i].getId()} in room ${room.roomId} is live, ` +
+ `but it does not have a timeline`,
+ );
+ continue;
}
+ const userMembershipEvent =
+ timeline.getState(EventTimeline.FORWARDS).getMember(userId);
+ userMembership = userMembershipEvent ? userMembershipEvent.membership : "leave";
+ const timelineEvents = timeline.getEvents();
+ for (let j = timelineEvents.length - 1; j >= 0; j--) {
+ const event = timelineEvents[j];
+ if (event.getId() === events[i].getId()) {
+ break;
+ } else if (event.getStateKey() === userId
+ && event.getType() === "m.room.member") {
+ const prevContent = event.getPrevContent();
+ userMembership = prevContent.membership || "leave";
+ }
+ }
+ break;
}
- // now go through the events that we have and find the first undecryptable
+ // now go through the rest of the events and find the first undecryptable
// one that was sent when the user wasn't in the room
- for (let i = events.length - 1; i >= 0; i--) {
+ for (; i >= 0; i--) {
const event = events[i];
if (event.getStateKey() === userId
&& event.getType() === "m.room.member") {
From a549c42022eb8cf4acb1f3ba129ab2755b046304 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 29 Jan 2020 12:10:50 +0000
Subject: [PATCH 2/5] Update copy for right panel verification
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/dialogs/DeviceVerifyDialog.js | 5 +----
src/components/views/right_panel/EncryptionInfo.js | 2 +-
src/components/views/verification/VerificationShowSas.js | 2 +-
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/components/views/dialogs/DeviceVerifyDialog.js b/src/components/views/dialogs/DeviceVerifyDialog.js
index 67e1649bb9..4340082c3a 100644
--- a/src/components/views/dialogs/DeviceVerifyDialog.js
+++ b/src/components/views/dialogs/DeviceVerifyDialog.js
@@ -194,10 +194,7 @@ export default class DeviceVerifyDialog extends React.Component {
{ _t("Verify by comparing a short text string.") }
- {_t(
- "For maximum security, we recommend you do this in person or " +
- "use another trusted means of communication.",
- )}
+ {_t("To be secure, do this in person or use another way to communicate.")}
{
{_t("Verify User")}
{_t("For extra security, verify this user by checking a one-time code on both of your devices.")}
-
{_t("For maximum security, do this in person.")}
+
{_t("To be secure, do this in person or use another way to communicate.")}
{_t("For ultimate security, do this in person or use another way to communicate.")}
+
{_t("To be secure, do this in person or use another way to communicate.")}
{sasDisplay}
{confirm}
;
From 227e6f63762e3268c7d4e4aa09ffc26e119e8f6e Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 29 Jan 2020 12:16:42 +0000
Subject: [PATCH 3/5] regen i18n
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/i18n/strings/en_EN.json | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 3ae0991f16..b00fcf3c11 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -451,7 +451,7 @@
"Waiting for %(displayName)s to verify…": "Waiting for %(displayName)s to verify…",
"They match": "They match",
"They don't match": "They don't match",
- "For ultimate security, do this in person or use another way to communicate.": "For ultimate security, do this in person or use another way to communicate.",
+ "To be secure, do this in person or use another way to communicate.": "To be secure, do this in person or use another way to communicate.",
"Dog": "Dog",
"Cat": "Cat",
"Lion": "Lion",
@@ -1150,7 +1150,6 @@
"Your messages are secured and only you and the recipient have the unique keys to unlock them.": "Your messages are secured and only you and the recipient have the unique keys to unlock them.",
"Verify User": "Verify User",
"For extra security, verify this user by checking a one-time code on both of your devices.": "For extra security, verify this user by checking a one-time code on both of your devices.",
- "For maximum security, do this in person.": "For maximum security, do this in person.",
"Your messages are not secure": "Your messages are not secure",
"One of the following may be compromised:": "One of the following may be compromised:",
"Your homeserver": "Your homeserver",
@@ -1462,7 +1461,6 @@
"Verify device": "Verify device",
"Use Legacy Verification (for older clients)": "Use Legacy Verification (for older clients)",
"Verify by comparing a short text string.": "Verify by comparing a short text string.",
- "For maximum security, we recommend you do this in person or use another trusted means of communication.": "For maximum security, we recommend you do this in person or use another trusted means of communication.",
"Begin Verifying": "Begin Verifying",
"Waiting for partner to accept...": "Waiting for partner to accept...",
"Nothing appearing? Not all clients support interactive verification yet. .": "Nothing appearing? Not all clients support interactive verification yet. .",
From 957e8629397cc620a1790e7154dba4d866b1b5a0 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 29 Jan 2020 13:58:02 +0000
Subject: [PATCH 4/5] Update copy some more
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/dialogs/DeviceVerifyDialog.js | 2 +-
src/components/views/right_panel/EncryptionInfo.js | 2 +-
src/components/views/verification/VerificationShowSas.js | 2 +-
src/i18n/strings/en_EN.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/views/dialogs/DeviceVerifyDialog.js b/src/components/views/dialogs/DeviceVerifyDialog.js
index 4340082c3a..f2368ad795 100644
--- a/src/components/views/dialogs/DeviceVerifyDialog.js
+++ b/src/components/views/dialogs/DeviceVerifyDialog.js
@@ -194,7 +194,7 @@ export default class DeviceVerifyDialog extends React.Component {
{ _t("Verify by comparing a short text string.") }
- {_t("To be secure, do this in person or use another way to communicate.")}
+ {_t("To be secure, do this in person or use a trusted way to communicate.")}
{
{_t("Verify User")}
{_t("For extra security, verify this user by checking a one-time code on both of your devices.")}
-
{_t("To be secure, do this in person or use another way to communicate.")}
+
{_t("To be secure, do this in person or use a trusted way to communicate.")}
{_t("To be secure, do this in person or use another way to communicate.")}
+
{_t("To be secure, do this in person or use a trusted way to communicate.")}
{sasDisplay}
{confirm}
;
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b00fcf3c11..20c1234190 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -451,7 +451,7 @@
"Waiting for %(displayName)s to verify…": "Waiting for %(displayName)s to verify…",
"They match": "They match",
"They don't match": "They don't match",
- "To be secure, do this in person or use another way to communicate.": "To be secure, do this in person or use another way to communicate.",
+ "To be secure, do this in person or use a trusted way to communicate.": "To be secure, do this in person or use a trusted way to communicate.",
"Dog": "Dog",
"Cat": "Cat",
"Lion": "Lion",
From 6d47f9620f12fe50efc4220a5ed7b71a40fd5358 Mon Sep 17 00:00:00 2001
From: "J. Ryan Stinnett"
Date: Wed, 29 Jan 2020 14:28:19 +0000
Subject: [PATCH 5/5] Adjust icons with in person with design
---
res/css/views/rooms/_InviteOnlyIcon.scss | 2 +-
res/css/views/rooms/_MessageComposer.scss | 4 ++--
res/css/views/rooms/_RoomHeader.scss | 8 ++++----
res/css/views/rooms/_RoomTile.scss | 15 +++++----------
4 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/res/css/views/rooms/_InviteOnlyIcon.scss b/res/css/views/rooms/_InviteOnlyIcon.scss
index e70586bb73..f4d9e4869f 100644
--- a/res/css/views/rooms/_InviteOnlyIcon.scss
+++ b/res/css/views/rooms/_InviteOnlyIcon.scss
@@ -20,7 +20,7 @@ limitations under the License.
position: relative;
display: block !important;
// Align the padlock with unencrypted room names
- margin-left: 6px;
+ margin: 0 4px;
&::before {
background-color: $roomtile-name-color;
diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss
index fae9d0dfe3..a05b4c0c0e 100644
--- a/res/css/views/rooms/_MessageComposer.scss
+++ b/res/css/views/rooms/_MessageComposer.scss
@@ -76,8 +76,8 @@ limitations under the License.
left: 60px;
margin-right: 0; // Counteract the E2EIcon class
margin-left: 3px; // Counteract the E2EIcon class
- width: 12px;
- height: 12px;
+ width: 15px;
+ height: 15px;
}
.mx_MessageComposer_noperm_error {
diff --git a/res/css/views/rooms/_RoomHeader.scss b/res/css/views/rooms/_RoomHeader.scss
index 6f0377b29c..47b8131ef0 100644
--- a/res/css/views/rooms/_RoomHeader.scss
+++ b/res/css/views/rooms/_RoomHeader.scss
@@ -21,10 +21,10 @@ limitations under the License.
.mx_E2EIcon {
margin: 0;
position: absolute;
- bottom: -1px;
- right: -2px;
- height: 10px;
- width: 10px;
+ bottom: -2px;
+ right: -6px;
+ height: 15px;
+ width: 15px;
}
}
diff --git a/res/css/views/rooms/_RoomTile.scss b/res/css/views/rooms/_RoomTile.scss
index a24fdf2629..31d887cbbb 100644
--- a/res/css/views/rooms/_RoomTile.scss
+++ b/res/css/views/rooms/_RoomTile.scss
@@ -101,19 +101,19 @@ limitations under the License.
// Note we match .mx_E2EIcon to make sure this matches more tightly than just
// .mx_E2EIcon on its own
.mx_RoomTile_e2eIcon.mx_E2EIcon {
- height: 10px;
- width: 10px;
+ height: 14px;
+ width: 14px;
display: block;
position: absolute;
- bottom: -1px;
- right: -2px;
+ bottom: -2px;
+ right: -5px;
z-index: 1;
margin: 0;
}
.mx_RoomTile_name {
font-size: 14px;
- padding: 0 6px;
+ padding: 0 4px;
color: $roomtile-name-color;
white-space: nowrap;
overflow-x: hidden;
@@ -214,8 +214,3 @@ limitations under the License.
.mx_GroupInviteTile .mx_RoomTile_name {
flex: 1;
}
-
-.mx_InviteOnlyIcon + .mx_RoomTile_nameContainer .mx_RoomTile_name {
- // Scoot the padding in a bit from 6px to make it look better
- padding-left: 3px;
-}