From 548586b934c8e9b51d70598af24876eb4d1f995a Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 30 Aug 2017 09:30:21 -0700 Subject: [PATCH] Chrome export fixes: too-long names, redact group ids (#1402) * On export, don't print out entire group id, just last three chars FREEBIE * Export: Limit conversation dirs to 30 characters of original name FREEBIE * Redact groups ids on import as well FREEBIE * InboxView: Protect against nonexistent loading screen FREEBIE --- js/backup.js | 12 ++++++++---- js/views/inbox_view.js | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/js/backup.js b/js/backup.js index d7e584c59..f3347e6ce 100644 --- a/js/backup.js +++ b/js/backup.js @@ -403,16 +403,20 @@ function getConversationDirName(conversation) { var name = conversation.active_at || 'never'; if (conversation.type === 'private') { - name += ' (' + (conversation.name || conversation.id) + ')'; + name += ' (' + (conversation.name || conversation.id).slice(0, 30) + ')'; } else { - name += ' (' + conversation.name + ')'; + name += ' (' + conversation.name.slice(0, 30) + ')'; } return name; } function getConversationLoggingName(conversation) { var name = conversation.active_at || 'never'; - name += ' (' + conversation.id + ')'; + if (conversation.type === 'private') { + name += ' (' + conversation.id + ')'; + } else { + name += ' ([REDACTED_GROUP]' + conversation.id.slice(-3) + ')'; + } return name; } @@ -539,7 +543,7 @@ 'Done importing', messages.length, 'messages for conversation', - conversationId + '[REDACTED]' + conversationId.slice(-3) ); resolve(); } diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index c8a974960..90fa3f54f 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -150,8 +150,10 @@ banner.$el.prependTo(this.$el); this.$el.addClass('expired'); } else if (Whisper.Migration.inProgress()) { - this.appLoadingScreen.remove(); - this.appLoadingScreen = null; + if (this.appLoadingScreen) { + this.appLoadingScreen.remove(); + this.appLoadingScreen = null; + } this.showMigrationScreen(); } else if (storage.get('migrationEnabled')) { var migrationBanner = new Whisper.MigrationAlertBanner().render();