From 0ac3517d51b147d5ec97be59f4e7a520db5d24bf Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 18 Jul 2018 11:40:10 -0700 Subject: [PATCH] On click of search result, show and focus conversation Also: remove too-verbose logging on contact sync --- js/background.js | 5 ----- js/views/conversation_search_view.js | 17 +++++++++++------ stylesheets/_index.scss | 5 ++++- stylesheets/_theme_dark.scss | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/js/background.js b/js/background.js index 3548f0bbdc..a5b5330a27 100644 --- a/js/background.js +++ b/js/background.js @@ -597,11 +597,6 @@ const { expireTimer } = details; const isValidExpireTimer = typeof expireTimer === 'number'; if (!isValidExpireTimer) { - console.log( - 'Ignore invalid expire timer.', - 'Expected numeric `expireTimer`, got:', - expireTimer - ); return; } diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index a34d1760f1..367ae556d3 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -42,17 +42,22 @@ this.$new_contact = this.$('.new-contact'); this.typeahead = new Whisper.ConversationCollection(); + this.collection = new Whisper.ConversationCollection([], { + comparator(m) { + return m.getTitle().toLowerCase(); + }, + }); + this.listenTo(this.collection, 'select', conversation => { + this.resetTypeahead(); + this.trigger('open', conversation); + }); + // View to display the matched contacts from typeahead this.typeahead_view = new Whisper.ConversationListView({ - collection: new Whisper.ConversationCollection([], { - comparator(m) { - return m.getTitle().toLowerCase(); - }, - }), + collection: this.collection, }); this.$el.append(this.typeahead_view.el); this.initNewContact(); - // this.listenTo(this.collection, 'reset', this.filterContacts); this.pending = Promise.resolve(); }, diff --git a/stylesheets/_index.scss b/stylesheets/_index.scss index 4bcd7d22ae..ecb966738d 100644 --- a/stylesheets/_index.scss +++ b/stylesheets/_index.scss @@ -115,8 +115,11 @@ input.search { position: relative; border-radius: 4px; - &.active { + &:focus { outline: solid 1px $blue; + } + + &.active { background-image: url('../images/x.svg'); background-repeat: no-repeat; background-size: $search-x-size; diff --git a/stylesheets/_theme_dark.scss b/stylesheets/_theme_dark.scss index fc90e38f71..6e0b2a44bb 100644 --- a/stylesheets/_theme_dark.scss +++ b/stylesheets/_theme_dark.scss @@ -460,7 +460,7 @@ body.dark-theme { color: $color-dark-05; background-color: $color-black; - &.active { + &:focus { outline: solid 1px $blue; } }