diff --git a/css/style.css b/css/style.css
index b1c131c..ef791bd 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1822,7 +1822,7 @@ ol.toptrends-list {
.group-messages-join-group.modal-wrapper {
height: auto; /*about 360px*/
- margin-top: -240px;
+ margin-top: -204px;
}
.group-messages-join-group .modal-content .module {
diff --git a/home.html b/home.html
index bdbfd1b..2ff27ec 100644
--- a/home.html
+++ b/home.html
@@ -632,10 +632,6 @@
Import secret key
-
diff --git a/js/interface_localization.js b/js/interface_localization.js
index bdae9d0..ae9e44c 100644
--- a/js/interface_localization.js
+++ b/js/interface_localization.js
@@ -69,6 +69,10 @@ if(preferredLanguage == "en"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "Disable",
"display_mentions": "Display mentions",
@@ -413,6 +417,10 @@ if(preferredLanguage == "es"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Mensajes directos con %{username}",
"Disable": "Inhabilitar",
"display_mentions": "Visualización de menciones",
@@ -754,6 +762,10 @@ if(preferredLanguage == "uk"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "Вимкнено",
"display_mentions": "Показати сповіщення",
@@ -1093,6 +1105,10 @@ if(preferredLanguage == "zh-CN"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "关闭",
"display_mentions": "显示",
@@ -1437,6 +1453,10 @@ if(preferredLanguage == "nl"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "Uitschakelen",
"display_mentions": "Toon vermeldingen",
@@ -1778,6 +1798,10 @@ if(preferredLanguage == "it"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Messaggi Diretti come %{username}",
"Disable": "Disabilitato",
"display_mentions": "Mostra le menzioni",
@@ -2117,6 +2141,10 @@ if(preferredLanguage == "fr"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Messages privés avec %{username}",
"Disable": "Désactiver",
"display_mentions": "Afficher les mentions",
@@ -2459,6 +2487,10 @@ if(preferredLanguage == "ru"){
"Group Messages": "Групповые сообщения",
"Group Messages — New Group Creation": "Групповые сообщения — Создать новую группу",
"Group Messages — Join Group": "Групповые сообщения — Присоединиться к группе",
+ "group_key_cant_import": "невозможно импортировать ключ ЛС группы",
+ "group_key_is_invalid_perhaps": "возможно, неправильный ключ",
+ "group_key_was_imported": "Ключ для ЛС группы %{alias} импортирован.\n"
+ + "Её сообщения будут подгружены в скором времени.",
"direct_messages_with": "Личная переписка с %{username}",
"Disable": "Отключено",
"display_mentions": "Показать упоминания",
@@ -2804,6 +2836,10 @@ if(preferredLanguage == "de"){
"Group Messages": "Gruppennachrichten",
"Group Messages — New Group Creation": "Gruppennachrichten — Neue Gruppe erstellen",
"Group Messages — Join Group": "Gruppennachrichten — Gruppe beitreten",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direktnachrichten mit %{username}",
"Disable": "Deaktivieren",
"display_mentions": "Zeige Erwähnungen", // Ist das richtig? Ich weiß nicht, in welchem Zusammenhang das benutzt wird.
@@ -3147,6 +3183,10 @@ if(preferredLanguage == "ja"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "停止",
"display_mentions": "メンションを表示する",
@@ -3486,6 +3526,10 @@ if(preferredLanguage == "pt-BR"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Mensagens Diretas com %{username}",
"Disable": "Desabilitado",
"display_mentions": "Exibir menções",
@@ -3829,6 +3873,10 @@ if(preferredLanguage == "tr"){
"Group Messages": "Grup Mesajları",
"Group Messages — New Group Creation": "Grup Mesajları — Yeni Grup Oluştur",
"Group Messages — Join Group": "Grup Mesajları — Gruba katıl",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "%{username} ile Direk Mesajlar",
"Disable": "Kullanılmaz",
"display_mentions": "Bahsedenleri göster",
@@ -4169,6 +4217,10 @@ if(preferredLanguage == "cs"){
"Group Messages": "Group Messages",
"Group Messages — New Group Creation": "Group Messages — New Group Creation",
"Group Messages — Join Group": "Group Messages — Join Group",
+ "group_key_cant_import": "Can\'t import DM group key",
+ "group_key_is_invalid_perhaps": "perhaps the key is invalid",
+ "group_key_was_imported": "Key for DM group %{alias} was imported.\n"
+ + "Its messages will be fetched soon.",
"direct_messages_with": "Direct messages with %{username}",
"Disable": "Vypnuto",
"display_mentions": "Zobrazit zmínky",
diff --git a/js/twister_directmsg.js b/js/twister_directmsg.js
index 8df5aa5..0652fc4 100644
--- a/js/twister_directmsg.js
+++ b/js/twister_directmsg.js
@@ -359,22 +359,13 @@ function openGroupMessagesJoinGroupModal() {
closeModal(event);
});
- modal.content.find('.secret-key-import, .username-import').on('input', importSecretKeypress);
+ modal.content.find('.secret-key-import').on('input',
+ {parentSelector: '.module', enterSelector: '.import-secret-key'}, inputEnterActivator);
modal.content.find('.import-secret-key').on('click', function (event) {
- var elemModule = $(event.target).closest('.module');
- var groupAlias = elemModule.find('.username-import').val().toLowerCase();
- var secretKey = elemModule.find('.secret-key-import').val();
+ groupMsgImportKey($(event.target).closest('.module').find('.secret-key-import').val());
- twisterRpc('importprivkey', [secretKey, groupAlias],
- function(req, ret) {
- groupMsgInviteToGroup(req.groupAlias, [defaultScreenName]);
- closeModal(req.elem);
- }, {groupAlias: groupAlias, elem: elemModule},
- function(req, ret) {
- alert(polyglot.t('Error in \'importprivkey\'', {rpc: ret.message}));
- }
- );
+ closeModal(event);
});
}
@@ -392,8 +383,54 @@ function groupMsgCreateGroup(description, peersToInvite) {
);
}
-function groupMsgInviteToGroup(groupAlias, peersToInvite) {
- _groupMsgInviteToGroupQueue.push({groupAlias: groupAlias, peersToInvite: peersToInvite});
+function groupMsgImportKey(key) {
+ if (parseInt(twisterVersion) < 93800) {
+ alertPopup({
+ //txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
+ txtMessage: polyglot.t('group_key_cant_import')
+ + ' —\ndaemon is obsolete, version 0.9.38 or higher is required'
+ });
+ return;
+ }
+
+ twisterRpc('creategroup', ['whatever', key],
+ function(req, ret) {
+ if (!ret) {
+ alertPopup({
+ //txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
+ txtMessage: polyglot.t('group_key_cant_import') + ' —\n'
+ + polyglot.t('group_key_is_invalid_perhaps')
+ });
+ return;
+ }
+
+ groupMsgInviteToGroup(ret, [defaultScreenName],
+ function () {
+ twisterRpc('rescandirectmsgs', [defaultScreenName],
+ function () {}, undefined, function () {});
+ }
+ );
+ alertPopup({
+ //txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
+ txtMessage: polyglot.t('group_key_was_imported', {alias: ret})
+ });
+ }, undefined,
+ function(req, ret) {
+ alertPopup({
+ //txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
+ txtMessage: polyglot.t('group_key_cant_import') + ' —\n' + ret.message
+ });
+ }
+ );
+}
+
+function groupMsgInviteToGroup(groupAlias, peersToInvite, cbFunc, cbReq) {
+ _groupMsgInviteToGroupQueue.push({
+ groupAlias: groupAlias,
+ peersToInvite: peersToInvite,
+ cbFunc: cbFunc,
+ cbReq: cbReq
+ });
if (_groupMsgInviteToGroupQueue.length === 1)
doGroupMsgInviteToGroup();
@@ -408,7 +445,10 @@ function doGroupMsgInviteToGroup() {
_groupMsgInviteToGroupQueue.shift();
if (_groupMsgInviteToGroupQueue.length)
setTimeout(doGroupMsgInviteToGroup, 200);
- }, null,
+
+ if (typeof req.cbFunc === 'function')
+ req.cbFunc(req.cbReq);
+ }, {cbFunc: _groupMsgInviteToGroupQueue[0].cbFunc, cbReq: _groupMsgInviteToGroupQueue[0].cbReq},
function(req, ret) {
alert(polyglot.t('error',
{error: 'can\'t invite ' + req[1] + ' to ' + req[0] + ' group — ' + ret.message}));
diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css
index 6a9bc02..c377b81 100644
--- a/theme_calm/css/style.css
+++ b/theme_calm/css/style.css
@@ -2204,7 +2204,7 @@ textarea.splited-post {
.group-messages-join-group.modal-wrapper {
height: auto; /*about 360px*/
- margin-top: -240px;
+ margin-top: -204px;
}
.group-messages-join-group .modal-content .module {
diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css
index 2caf94f..fb9be7d 100644
--- a/theme_nin/css/style.css
+++ b/theme_nin/css/style.css
@@ -2974,8 +2974,8 @@ ol.toptrends-list a:hover {
.group-messages-join-group.modal-wrapper {
width: 580px;
- height: auto; /*about 360px*/
- margin: -250px 0 0 -290px;
+ height: auto; /*about 409px*/
+ margin: -204px 0 0 -290px;
}
.group-messages-join-group .modal-content {