diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 25ec644787..c78a395185 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -119,8 +119,9 @@ module.exports = React.createClass({
collapse_rhs: false,
ready: false,
width: 10000,
- sideOpacity: 1.0,
+ leftOpacity: 1.0,
middleOpacity: 1.0,
+ rightOpacity: 1.0,
version: null,
newVersion: null,
@@ -547,29 +548,23 @@ module.exports = React.createClass({
});
break;
case 'hide_right_panel':
- this.was_rhs_collapsed = this.state.collapse_rhs;
this.setState({
collapse_rhs: true,
});
break;
case 'show_right_panel':
- this.was_rhs_collapsed = this.state.collapse_rhs;
this.setState({
collapse_rhs: false,
});
break;
- // sets the panel to its state before last show/hide event
- case 'restore_right_panel':
+ case 'ui_opacity': {
+ const sideDefault = payload.sideOpacity >= 0.0 ? payload.sideOpacity : 1.0;
this.setState({
- collapse_rhs: this.was_rhs_collapsed,
+ leftOpacity: payload.leftOpacity >= 0.0 ? payload.leftOpacity : sideDefault,
+ middleOpacity: payload.middleOpacity || 1.0,
+ rightOpacity: payload.rightOpacity >= 0.0 ? payload.rightOpacity : sideDefault,
});
- break;
- case 'ui_opacity':
- this.setState({
- sideOpacity: payload.sideOpacity,
- middleOpacity: payload.middleOpacity,
- });
- break;
+ break; }
case 'set_theme':
this._onSetTheme(payload.value);
break;
diff --git a/src/components/views/rooms/ForwardMessage.js b/src/components/views/rooms/ForwardMessage.js
index e5be89b2e0..cd57bb1ba1 100644
--- a/src/components/views/rooms/ForwardMessage.js
+++ b/src/components/views/rooms/ForwardMessage.js
@@ -34,11 +34,11 @@ module.exports = React.createClass({
componentWillMount: function() {
this._unmounted = false;
- dis.dispatch({action: 'hide_right_panel'});
dis.dispatch({
action: 'ui_opacity',
- sideOpacity: 1.0,
- middleOpacity: 0.3,
+ leftOpacity: 1.0,
+ rightOpacity: 0.3,
+ middleOpacity: 0.5,
});
},
@@ -50,7 +50,6 @@ module.exports = React.createClass({
componentWillUnmount: function() {
this._unmounted = true;
- dis.dispatch({action: 'restore_right_panel'});
dis.dispatch({
action: 'ui_opacity',
sideOpacity: 1.0,
From bf0fe637590897f1e43d39584cef4122a2cf8bf3 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 19 May 2017 00:20:51 +0100
Subject: [PATCH 14/24] don't know why I'm even tracking mounted state. Never
refd
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/ForwardMessage.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/components/views/rooms/ForwardMessage.js b/src/components/views/rooms/ForwardMessage.js
index cd57bb1ba1..c3cec6fb36 100644
--- a/src/components/views/rooms/ForwardMessage.js
+++ b/src/components/views/rooms/ForwardMessage.js
@@ -32,8 +32,6 @@ module.exports = React.createClass({
},
componentWillMount: function() {
- this._unmounted = false;
-
dis.dispatch({
action: 'ui_opacity',
leftOpacity: 1.0,
@@ -48,8 +46,6 @@ module.exports = React.createClass({
},
componentWillUnmount: function() {
- this._unmounted = true;
-
dis.dispatch({
action: 'ui_opacity',
sideOpacity: 1.0,
From 475646a2a73296f25f118ac945b969fa34396df2 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 19 May 2017 00:34:35 +0100
Subject: [PATCH 15/24] Change wording
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/ForwardMessage.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/components/views/rooms/ForwardMessage.js b/src/components/views/rooms/ForwardMessage.js
index c3cec6fb36..e478630303 100644
--- a/src/components/views/rooms/ForwardMessage.js
+++ b/src/components/views/rooms/ForwardMessage.js
@@ -85,10 +85,7 @@ module.exports = React.createClass({
render: function() {
return (
-
-
Select a room to send the message to
- Use the left sidebar Room List to select forwarding target
-
+ Please select the destination room for this message
);
},
From cc7edbf86d0154a7b4daa4a4c2bc27a7a8d3e77a Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 19 May 2017 01:29:11 +0100
Subject: [PATCH 16/24] allow for sending arbitrary events, also override
highlight with event currently being forwarded while forwardingEvent is set
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/RoomView.js | 15 +++++++--------
src/components/views/rooms/ForwardMessage.js | 7 +++++--
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js
index 9a0534cac7..c7417eeafd 100644
--- a/src/components/structures/RoomView.js
+++ b/src/components/structures/RoomView.js
@@ -125,7 +125,7 @@ module.exports = React.createClass({
roomId: null,
roomLoading: true,
- forwardingMessage: null,
+ forwardingEvent: null,
editingRoomSettings: false,
uploadingRoomSettings: false,
numUnreadMessages: 0,
@@ -454,9 +454,9 @@ module.exports = React.createClass({
});
break;
- case 'forward_message':
+ case 'forward_event':
this.setState({
- forwardingMessage: payload.content,
+ forwardingEvent: payload.content,
});
break;
}
@@ -1203,7 +1203,7 @@ module.exports = React.createClass({
this.updateTint();
this.setState({
editingRoomSettings: false,
- forwardingMessage: null,
+ forwardingEvent: null,
});
dis.dispatch({action: 'focus_composer'});
},
@@ -1621,8 +1621,8 @@ module.exports = React.createClass({
}
let aux = null;
- if (this.state.forwardingMessage !== null) {
- aux = ;
+ if (this.state.forwardingEvent !== null) {
+ aux = ;
} else if (this.state.editingRoomSettings) {
aux = ;
} else if (this.state.uploadingRoomSettings) {
@@ -1742,14 +1742,13 @@ module.exports = React.createClass({
}
// console.log("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
-
var messagePanel = (
{
+ Client.sendEvent(payload.room_id, event.getType(), event.getContent()).done(() => {
dis.dispatch({action: 'message_sent'});
}, (err) => {
if (err.name === "UnknownDeviceError") {
From 2bcb381aa73201b3c5d1e0bb8ab9cf04816535c6 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 27 May 2017 14:19:34 +0100
Subject: [PATCH 17/24] maybe window focus should be ignored so focus is left
as what it was but with this at least clicking on a text input will not make
you be thrown into composer instead
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/MatrixChat.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 0de38ab226..a4b6b3ea6c 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -906,7 +906,9 @@ module.exports = React.createClass({
},
onFocus: function(ev) {
- dis.dispatch({action: 'focus_composer'});
+ if (document.activeElement.textLength === undefined) {
+ dis.dispatch({action: 'focus_composer'});
+ }
},
showScreen: function(screen, params) {
From 4cd7964b584bf88e4cf3e6cb6438b2c592324478 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 27 May 2017 18:43:59 +0100
Subject: [PATCH 18/24] remove window onFocus handling entirely
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/MatrixChat.js | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 6638431410..4b05d746f3 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -247,7 +247,6 @@ module.exports = React.createClass({
UDEHandler.startListening();
this.focusComposer = false;
- window.addEventListener("focus", this.onFocus);
// this can technically be done anywhere but doing this here keeps all
// the routing url path logic together.
@@ -910,12 +909,6 @@ module.exports = React.createClass({
});
},
- onFocus: function(ev) {
- if (document.activeElement.textLength === undefined) {
- dis.dispatch({action: 'focus_composer'});
- }
- },
-
showScreen: function(screen, params) {
if (screen == 'register') {
dis.dispatch({
From 71bc15c2fc6f9267a0a9b186fbd0a081ed170ae7 Mon Sep 17 00:00:00 2001
From: Matthew Hodgson
Date: Sat, 27 May 2017 19:03:18 +0100
Subject: [PATCH 19/24] fix .
---
src/i18n/strings/fr.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json
index e10c606233..53d24d484b 100644
--- a/src/i18n/strings/fr.json
+++ b/src/i18n/strings/fr.json
@@ -270,7 +270,7 @@
"Failed to reject invitation": "Échec lors du rejet de l'invitation",
"Failed to save settings": "Échec lors de la sauvegarde des paramètres",
"Failed to send email": "Échec lors de l’envoi de l’e-mail",
- "Failed to send request": "Échec lors de l’envoi de la requête",
+ "Failed to send request.": "Échec lors de l’envoi de la requête.",
"Failed to set display name": "Échec lors de l'enregistrement du nom d'affichage",
"Failed to set up conference call": "Échec lors de l’établissement de l’appel",
"Failed to toggle moderator status": "Échec lors de l’établissement du statut de modérateur",
From 796158422c4598228d08bb58e1894954c7eff728 Mon Sep 17 00:00:00 2001
From: Matthew Hodgson
Date: Sat, 27 May 2017 19:03:26 +0100
Subject: [PATCH 20/24] list the strings remaining to be translated
---
scripts/check-i18n.pl | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/scripts/check-i18n.pl b/scripts/check-i18n.pl
index 6c92dae53d..2d50138788 100755
--- a/scripts/check-i18n.pl
+++ b/scripts/check-i18n.pl
@@ -42,6 +42,9 @@ foreach my $tuple (@$src_strings) {
print "\nChecking en_EN\n";
my $count = 0;
+my $remaining_src = {};
+foreach (keys %$src) { $remaining_src->{$_}++ };
+
foreach my $k (sort keys %$en) {
# crappy heuristic to ignore country codes for now...
next if ($k =~ /^(..|..-..)$/);
@@ -61,9 +64,13 @@ foreach my $k (sort keys %$en) {
}
else {
$count++;
+ delete $remaining_src->{$k};
}
}
printf ("$count/" . (scalar keys %$src) . " strings found in src are present in en_EN\n");
+foreach (keys %$remaining_src) {
+ printf "remaining: $_\n";
+}
opendir(DIR, $i18ndir) || die $!;
my @files = readdir(DIR);
@@ -74,12 +81,17 @@ foreach my $lang (grep { -f "$i18ndir/$_" && !/(basefile|en_EN)\.json/ } @files)
my $map = read_i18n($i18ndir."/".$lang);
my $count = 0;
+ my $remaining_en = {};
+ foreach (keys %$en) { $remaining_en->{$_}++ };
+
+
foreach my $k (sort keys %$map) {
if ($en->{$k}) {
if ($map->{$k} eq $k) {
printf ("%10s %24s\t%s\n", $lang, "Untranslated string?", $k);
}
$count++;
+ delete $remaining_en->{$k};
}
else {
if ($en->{$k . "."}) {
@@ -97,6 +109,12 @@ foreach my $lang (grep { -f "$i18ndir/$_" && !/(basefile|en_EN)\.json/ } @files)
}
}
+ if (scalar keys %$remaining_en < 100) {
+ foreach (keys %$remaining_en) {
+ printf ("%10s %24s\t%s\n", $lang, "Not yet translated", $_);
+ }
+ }
+
printf ("$count/" . (scalar keys %$en) . " strings translated\n");
}
From 063230af03f1f2c4381eae86aa41195ee15d108a Mon Sep 17 00:00:00 2001
From: Matthew Hodgson
Date: Sat, 27 May 2017 19:51:44 +0100
Subject: [PATCH 21/24] fix typo breaking russian i18n
---
src/i18n/strings/ru.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json
index 5b81b88a92..cdebc47160 100644
--- a/src/i18n/strings/ru.json
+++ b/src/i18n/strings/ru.json
@@ -449,7 +449,7 @@
"sx": "Суту",
"zh-hk": "Китайский (Гонконг)",
"A text message has been sent to +%(msisdn)s. Please enter the verification code it contains": "На +%(msisdn)s было отправлено текстовое сообщение. Пожалуйста, введите проверочный код из него",
- "and %(overflowCount)s others...": "и %(overflowCounts)s других...",
+ "and %(overflowCount)s others...": "и %(overflowCount)s других...",
"Are you sure?": "Вы уверены?",
"Autoplay GIFs and videos": "Проигрывать GIF и видео автоматически",
"Can't connect to homeserver - please check your connectivity and ensure your %(urlStart)s homeserver's SSL certificate %(urlEnd)s is trusted": "Невозможно соединиться с домашним сервером - проверьте своё соединение и убедитесь, что %(urlStart)s SSL-сертификат вашего домашнего сервера %(urlEnd)s включён в доверяемые",
From a30110b5d3e06c22b3f1769b04e33b83e9649c31 Mon Sep 17 00:00:00 2001
From: Marcel
Date: Sat, 27 May 2017 21:11:00 +0200
Subject: [PATCH 22/24] Fix vector-im/riot-web#4042
---
src/components/structures/UserSettings.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 993586df84..992830066f 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -546,11 +546,13 @@ module.exports = React.createClass({
},
onLanguageChange: function(l) {
- UserSettingsStore.setLocalSetting('language', l);
- this.setState({
- language: l,
- });
- PlatformPeg.get().reload();
+ if(this.state.language !== l) {
+ UserSettingsStore.setLocalSetting('language', l);
+ this.setState({
+ language: l,
+ });
+ PlatformPeg.get().reload();
+ }
},
_renderLanguageSetting: function () {
From dba35f4901264ce4958b60897d12cb37f4abc7ac Mon Sep 17 00:00:00 2001
From: Matthew Hodgson
Date: Sat, 27 May 2017 20:14:52 +0100
Subject: [PATCH 23/24] extend script to check for broken variables
---
scripts/check-i18n.pl | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/scripts/check-i18n.pl b/scripts/check-i18n.pl
index 2d50138788..55499b0570 100755
--- a/scripts/check-i18n.pl
+++ b/scripts/check-i18n.pl
@@ -48,6 +48,11 @@ foreach (keys %$src) { $remaining_src->{$_}++ };
foreach my $k (sort keys %$en) {
# crappy heuristic to ignore country codes for now...
next if ($k =~ /^(..|..-..)$/);
+
+ if ($en->{$k} ne $k) {
+ printf ("%50s %24s\t%s\n", "en_EN", "en_EN is not symmetrical", $k);
+ }
+
if (!$src->{$k}) {
if ($src->{$k. '.'}) {
printf ("%50s %24s\t%s\n", $src->{$k. '.'}, "src has fullstop!", $k);
@@ -69,7 +74,7 @@ foreach my $k (sort keys %$en) {
}
printf ("$count/" . (scalar keys %$src) . " strings found in src are present in en_EN\n");
foreach (keys %$remaining_src) {
- printf "remaining: $_\n";
+ print "missing: $_\n";
}
opendir(DIR, $i18ndir) || die $!;
@@ -84,8 +89,23 @@ foreach my $lang (grep { -f "$i18ndir/$_" && !/(basefile|en_EN)\.json/ } @files)
my $remaining_en = {};
foreach (keys %$en) { $remaining_en->{$_}++ };
-
foreach my $k (sort keys %$map) {
+ {
+ no warnings 'uninitialized';
+ my $vars = {};
+ while ($k =~ /%\((.*?)\)s/g) {
+ $vars->{$1}++;
+ }
+ while ($map->{$k} =~ /%\((.*?)\)s/g) {
+ $vars->{$1}--;
+ }
+ foreach my $var (keys %$vars) {
+ if ($vars->{$var} != 0) {
+ printf ("%10s %24s\t%s\n", $lang, "Broken var ($var)s", $k);
+ }
+ }
+ }
+
if ($en->{$k}) {
if ($map->{$k} eq $k) {
printf ("%10s %24s\t%s\n", $lang, "Untranslated string?", $k);
From 8935e9706ebc7cbfc056f6fc396b335d071d2b59 Mon Sep 17 00:00:00 2001
From: Marcel
Date: Sat, 27 May 2017 21:21:23 +0200
Subject: [PATCH 24/24] Change variable name as mentioned by t3chguy
---
src/components/structures/UserSettings.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 992830066f..f4bf8b18cb 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -545,11 +545,11 @@ module.exports = React.createClass({
);
},
- onLanguageChange: function(l) {
- if(this.state.language !== l) {
- UserSettingsStore.setLocalSetting('language', l);
+ onLanguageChange: function(newLang) {
+ if(this.state.language !== newLang) {
+ UserSettingsStore.setLocalSetting('language', newLang);
this.setState({
- language: l,
+ language: newLang,
});
PlatformPeg.get().reload();
}