From da5844205c5e2ead4da42f89f1f9586683af693e Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 06:12:31 -0400
Subject: add user autosuggest component

---
 src/components/user_settings/user_settings.vue | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index c08698dc..d98a8eba 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -22,7 +22,7 @@
           <div class="setting-item" >
             <h2>{{$t('settings.name_bio')}}</h2>
             <p>{{$t('settings.name')}}</p>
-            <EmojiInput 
+            <EmojiInput
               type="text"
               v-model="newName"
               id="username"
@@ -195,6 +195,7 @@
         </div>
 
         <div :label="$t('settings.blocks_tab')">
+          <UserAutoSuggest />
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
           </block-list>
-- 
cgit v1.2.3-70-g09d2


From fd4289e45a1d9f952b44251110abe01081b92f8a Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 13:18:41 -0400
Subject: improve ui

---
 src/components/user_autosuggest/user_autosuggest.vue | 20 ++++++++++++++++++--
 src/components/user_settings/user_settings.vue       |  8 +++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_autosuggest/user_autosuggest.vue b/src/components/user_autosuggest/user_autosuggest.vue
index eb5aa41b..2840941f 100644
--- a/src/components/user_autosuggest/user_autosuggest.vue
+++ b/src/components/user_autosuggest/user_autosuggest.vue
@@ -1,6 +1,6 @@
 <template>
-    <input v-model="query" placeholder="Search..." />
   <div class="user-autosuggest" v-click-outside="onClickOutside">
+    <input v-model="query" placeholder="Search whom you want to block" @click="onInputClick" class="user-autosuggest-input" />
     <div class="user-autosuggest-results" v-if="resultsVisible">
       <BasicUserCard v-for="user in results" :key="user.id" :user="user"/>
     </div>
@@ -10,15 +10,31 @@
 <script src="./user_autosuggest.js"></script>
 
 <style lang="scss">
+@import '../../_variables.scss';
+
 .user-autosuggest {
   position: relative;
 
+  &-input {
+    display: block;
+    width: 100%;
+  }
+
   &-results {
     position: absolute;
     left: 0;
     top: 100%;
     right: 0;
-    background: #FFF;
+    background-color: $fallback--lightBg;
+    background-color: var(--lightBg, $fallback--lightBg);
+    border-style: solid;
+    border-width: 1px;
+    border-color: $fallback--border;
+    border-color: var(--border, $fallback--border);
+    border-radius: $fallback--inputRadius;
+    border-radius: var(--inputRadius, $fallback--inputRadius);
+    border-top-left-radius: 0;
+    border-top-right-radius: 0;
     max-height: 400px;
     overflow-y: auto;
     z-index: 1;
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index d98a8eba..811f63aa 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -195,7 +195,9 @@
         </div>
 
         <div :label="$t('settings.blocks_tab')">
-          <UserAutoSuggest />
+          <div class="profile-edit-usersearch-wrapper">
+            <UserAutoSuggest />
+          </div>
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
           </block-list>
@@ -263,5 +265,9 @@
       text-align: right;
     }
   }
+
+  &-usersearch-wrapper {
+    padding: 1em;
+  }
 }
 </style>
-- 
cgit v1.2.3-70-g09d2


From 8410add39457ef075a14096fbcbceab24757588f Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 15:41:26 -0400
Subject: make UserAutoSuggest component more generic

---
 .../user_autosuggest/user_autosuggest.js           | 33 +++++++++++-----------
 .../user_autosuggest/user_autosuggest.vue          |  2 +-
 src/components/user_settings/user_settings.js      | 16 +++++++++++
 src/components/user_settings/user_settings.vue     |  2 +-
 4 files changed, 34 insertions(+), 19 deletions(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js
index 75798b7e..6b95fc15 100644
--- a/src/components/user_autosuggest/user_autosuggest.js
+++ b/src/components/user_autosuggest/user_autosuggest.js
@@ -1,46 +1,45 @@
-import reject from 'lodash/reject'
-import map from 'lodash/map'
 import BlockCard from '../block_card/block_card.vue'
-import userSearchApi from '../../services/new_api/user_search.js'
 
 const debounceMilliseconds = 500
 
 export default {
+  props: {
+    query: {    // function to query results and return a promise
+      type: Function,
+      required: true
+    },
+    filter: {   // function to filter results in real time
+      type: Function
+    }
+  },
   components: {
     BlockCard
   },
   data () {
     return {
-      query: '',
-      results: [],
+      term: '',
       timeout: null,
+      results: [],
       resultsVisible: false
     }
   },
   computed: {
     filtered () {
-      return reject(this.results, (userId) => {
-        const user = this.$store.getters.findUser(userId)
-        return !user || user.statusnet_blocking || user.id === this.$store.state.users.currentUser.id
-      })
+      return this.filter ? this.filter(this.results) : this.results
     }
   },
   watch: {
-    query (val) {
+    term (val) {
       this.fetchResults(val)
     }
   },
   methods: {
-    fetchResults (query) {
+    fetchResults (term) {
       clearTimeout(this.timeout)
       this.timeout = setTimeout(() => {
         this.results = []
-        if (query) {
-          userSearchApi.search({query, store: this.$store})
-            .then((users) => {
-              this.$store.dispatch('addNewUsers', users)
-              this.results = map(users, 'id')
-            })
+        if (term) {
+          this.query(term).then((results) => { this.results = results })
         }
       }, debounceMilliseconds)
     },
diff --git a/src/components/user_autosuggest/user_autosuggest.vue b/src/components/user_autosuggest/user_autosuggest.vue
index 930216a7..48cffc78 100644
--- a/src/components/user_autosuggest/user_autosuggest.vue
+++ b/src/components/user_autosuggest/user_autosuggest.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="user-autosuggest" v-click-outside="onClickOutside">
-    <input v-model="query" placeholder="Search whom you want to block" @click="onInputClick" class="user-autosuggest-input" />
+    <input v-model="term" placeholder="Search whom you want to block" @click="onInputClick" class="user-autosuggest-input" />
     <div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0">
       <BlockCard v-for="userId in filtered" :key="userId" :userId="userId"/>
     </div>
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index d5772082..259e3418 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -1,6 +1,8 @@
 import { compose } from 'vue-compose'
 import unescape from 'lodash/unescape'
 import get from 'lodash/get'
+import map from 'lodash/map'
+import reject from 'lodash/reject'
 import TabSwitcher from '../tab_switcher/tab_switcher.js'
 import ImageCropper from '../image_cropper/image_cropper.vue'
 import StyleSwitcher from '../style_switcher/style_switcher.vue'
@@ -12,6 +14,7 @@ import EmojiInput from '../emoji-input/emoji-input.vue'
 import UserAutoSuggest from '../user_autosuggest/user_autosuggest.vue'
 import withSubscription from '../../hocs/with_subscription/with_subscription'
 import withList from '../../hocs/with_list/with_list'
+import userSearchApi from '../../services/new_api/user_search.js'
 
 const BlockList = compose(
   withSubscription({
@@ -336,6 +339,19 @@ const UserSettings = {
       if (window.confirm(`${this.$i18n.t('settings.revoke_token')}?`)) {
         this.$store.dispatch('revokeToken', id)
       }
+    },
+    filterUnblockedUsers (userIds) {
+      return reject(userIds, (userId) => {
+        const user = this.$store.getters.findUser(userId)
+        return !user || user.statusnet_blocking || user.id === this.$store.state.users.currentUser.id
+      })
+    },
+    queryUserIds (query) {
+      return userSearchApi.search({query, store: this.$store})
+        .then((users) => {
+          this.$store.dispatch('addNewUsers', users)
+          return map(users, 'id')
+        })
     }
   }
 }
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 811f63aa..6018cc30 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -196,7 +196,7 @@
 
         <div :label="$t('settings.blocks_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <UserAutoSuggest />
+            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" />
           </div>
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
-- 
cgit v1.2.3-70-g09d2


From fc5f4fba8c4af713855b881d7b178623b1e77b01 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 15:43:41 -0400
Subject: make more generic

---
 src/components/user_autosuggest/user_autosuggest.js  | 4 ++++
 src/components/user_autosuggest/user_autosuggest.vue | 2 +-
 src/components/user_settings/user_settings.vue       | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js
index 6b95fc15..12a6964a 100644
--- a/src/components/user_autosuggest/user_autosuggest.js
+++ b/src/components/user_autosuggest/user_autosuggest.js
@@ -10,6 +10,10 @@ export default {
     },
     filter: {   // function to filter results in real time
       type: Function
+    },
+    placeholder: {
+      type: String,
+      default: 'Search...'
     }
   },
   components: {
diff --git a/src/components/user_autosuggest/user_autosuggest.vue b/src/components/user_autosuggest/user_autosuggest.vue
index 48cffc78..db3e1bdf 100644
--- a/src/components/user_autosuggest/user_autosuggest.vue
+++ b/src/components/user_autosuggest/user_autosuggest.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="user-autosuggest" v-click-outside="onClickOutside">
-    <input v-model="term" placeholder="Search whom you want to block" @click="onInputClick" class="user-autosuggest-input" />
+    <input v-model="term" :placeholder="placeholder" @click="onInputClick" class="user-autosuggest-input" />
     <div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0">
       <BlockCard v-for="userId in filtered" :key="userId" :userId="userId"/>
     </div>
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 6018cc30..3dde5ae1 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -196,7 +196,7 @@
 
         <div :label="$t('settings.blocks_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" />
+            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block" />
           </div>
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
-- 
cgit v1.2.3-70-g09d2


From 1cf9780e05957c96b6d6b6b898b83ff1987b2703 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 16:02:02 -0400
Subject: make more generic

---
 src/components/user_autosuggest/user_autosuggest.js  | 5 -----
 src/components/user_autosuggest/user_autosuggest.vue | 3 ++-
 src/components/user_settings/user_settings.js        | 3 ++-
 src/components/user_settings/user_settings.vue       | 4 +++-
 4 files changed, 7 insertions(+), 8 deletions(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js
index 12a6964a..d4efe912 100644
--- a/src/components/user_autosuggest/user_autosuggest.js
+++ b/src/components/user_autosuggest/user_autosuggest.js
@@ -1,5 +1,3 @@
-import BlockCard from '../block_card/block_card.vue'
-
 const debounceMilliseconds = 500
 
 export default {
@@ -16,9 +14,6 @@ export default {
       default: 'Search...'
     }
   },
-  components: {
-    BlockCard
-  },
   data () {
     return {
       term: '',
diff --git a/src/components/user_autosuggest/user_autosuggest.vue b/src/components/user_autosuggest/user_autosuggest.vue
index db3e1bdf..6eaecbaa 100644
--- a/src/components/user_autosuggest/user_autosuggest.vue
+++ b/src/components/user_autosuggest/user_autosuggest.vue
@@ -2,7 +2,8 @@
   <div class="user-autosuggest" v-click-outside="onClickOutside">
     <input v-model="term" :placeholder="placeholder" @click="onInputClick" class="user-autosuggest-input" />
     <div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0">
-      <BlockCard v-for="userId in filtered" :key="userId" :userId="userId"/>
+      <slot v-for="item in filtered" :item="item">
+      </slot>
     </div>
   </div>
 </template>
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 259e3418..2cae2d00 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -78,7 +78,8 @@ const UserSettings = {
     BlockList,
     MuteList,
     EmojiInput,
-    UserAutoSuggest
+    UserAutoSuggest,
+    BlockCard
   },
   computed: {
     user () {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 3dde5ae1..69d3dc53 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -196,7 +196,9 @@
 
         <div :label="$t('settings.blocks_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block" />
+            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block">
+              <BlockCard slot-scope="row" :userId="row.item"/>
+            </UserAutoSuggest>
           </div>
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
-- 
cgit v1.2.3-70-g09d2


From 0bdb0e5a8124508edff12a265174bd51a09c37e6 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 16:10:03 -0400
Subject: rename Autosuggest component

---
 src/components/autosuggest/autosuggest.js          | 52 ++++++++++++++++++++++
 src/components/autosuggest/autosuggest.vue         | 46 +++++++++++++++++++
 .../user_autosuggest/user_autosuggest.js           | 52 ----------------------
 .../user_autosuggest/user_autosuggest.vue          | 46 -------------------
 src/components/user_settings/user_settings.js      |  4 +-
 src/components/user_settings/user_settings.vue     |  4 +-
 6 files changed, 102 insertions(+), 102 deletions(-)
 create mode 100644 src/components/autosuggest/autosuggest.js
 create mode 100644 src/components/autosuggest/autosuggest.vue
 delete mode 100644 src/components/user_autosuggest/user_autosuggest.js
 delete mode 100644 src/components/user_autosuggest/user_autosuggest.vue

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/autosuggest/autosuggest.js b/src/components/autosuggest/autosuggest.js
new file mode 100644
index 00000000..d4efe912
--- /dev/null
+++ b/src/components/autosuggest/autosuggest.js
@@ -0,0 +1,52 @@
+const debounceMilliseconds = 500
+
+export default {
+  props: {
+    query: {    // function to query results and return a promise
+      type: Function,
+      required: true
+    },
+    filter: {   // function to filter results in real time
+      type: Function
+    },
+    placeholder: {
+      type: String,
+      default: 'Search...'
+    }
+  },
+  data () {
+    return {
+      term: '',
+      timeout: null,
+      results: [],
+      resultsVisible: false
+    }
+  },
+  computed: {
+    filtered () {
+      return this.filter ? this.filter(this.results) : this.results
+    }
+  },
+  watch: {
+    term (val) {
+      this.fetchResults(val)
+    }
+  },
+  methods: {
+    fetchResults (term) {
+      clearTimeout(this.timeout)
+      this.timeout = setTimeout(() => {
+        this.results = []
+        if (term) {
+          this.query(term).then((results) => { this.results = results })
+        }
+      }, debounceMilliseconds)
+    },
+    onInputClick () {
+      this.resultsVisible = true
+    },
+    onClickOutside () {
+      this.resultsVisible = false
+    }
+  }
+}
diff --git a/src/components/autosuggest/autosuggest.vue b/src/components/autosuggest/autosuggest.vue
new file mode 100644
index 00000000..ae1e312d
--- /dev/null
+++ b/src/components/autosuggest/autosuggest.vue
@@ -0,0 +1,46 @@
+<template>
+  <div class="autosuggest" v-click-outside="onClickOutside">
+    <input v-model="term" :placeholder="placeholder" @click="onInputClick" class="autosuggest-input" />
+    <div class="autosuggest-results" v-if="resultsVisible && filtered.length > 0">
+      <slot v-for="item in filtered" :item="item">
+      </slot>
+    </div>
+  </div>
+</template>
+
+<script src="./autosuggest.js"></script>
+
+<style lang="scss">
+@import '../../_variables.scss';
+
+.autosuggest {
+  position: relative;
+
+  &-input {
+    display: block;
+    width: 100%;
+  }
+
+  &-results {
+    position: absolute;
+    left: 0;
+    top: 100%;
+    right: 0;
+    max-height: 400px;
+    background-color: $fallback--lightBg;
+    background-color: var(--lightBg, $fallback--lightBg);
+    border-style: solid;
+    border-width: 1px;
+    border-color: $fallback--border;
+    border-color: var(--border, $fallback--border);
+    border-radius: $fallback--inputRadius;
+    border-radius: var(--inputRadius, $fallback--inputRadius);
+    border-top-left-radius: 0;
+    border-top-right-radius: 0;
+    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
+    box-shadow: var(--panelShadow);
+    overflow-y: auto;
+    z-index: 1;
+  }
+}
+</style>
diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js
deleted file mode 100644
index d4efe912..00000000
--- a/src/components/user_autosuggest/user_autosuggest.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const debounceMilliseconds = 500
-
-export default {
-  props: {
-    query: {    // function to query results and return a promise
-      type: Function,
-      required: true
-    },
-    filter: {   // function to filter results in real time
-      type: Function
-    },
-    placeholder: {
-      type: String,
-      default: 'Search...'
-    }
-  },
-  data () {
-    return {
-      term: '',
-      timeout: null,
-      results: [],
-      resultsVisible: false
-    }
-  },
-  computed: {
-    filtered () {
-      return this.filter ? this.filter(this.results) : this.results
-    }
-  },
-  watch: {
-    term (val) {
-      this.fetchResults(val)
-    }
-  },
-  methods: {
-    fetchResults (term) {
-      clearTimeout(this.timeout)
-      this.timeout = setTimeout(() => {
-        this.results = []
-        if (term) {
-          this.query(term).then((results) => { this.results = results })
-        }
-      }, debounceMilliseconds)
-    },
-    onInputClick () {
-      this.resultsVisible = true
-    },
-    onClickOutside () {
-      this.resultsVisible = false
-    }
-  }
-}
diff --git a/src/components/user_autosuggest/user_autosuggest.vue b/src/components/user_autosuggest/user_autosuggest.vue
deleted file mode 100644
index 6eaecbaa..00000000
--- a/src/components/user_autosuggest/user_autosuggest.vue
+++ /dev/null
@@ -1,46 +0,0 @@
-<template>
-  <div class="user-autosuggest" v-click-outside="onClickOutside">
-    <input v-model="term" :placeholder="placeholder" @click="onInputClick" class="user-autosuggest-input" />
-    <div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0">
-      <slot v-for="item in filtered" :item="item">
-      </slot>
-    </div>
-  </div>
-</template>
-
-<script src="./user_autosuggest.js"></script>
-
-<style lang="scss">
-@import '../../_variables.scss';
-
-.user-autosuggest {
-  position: relative;
-
-  &-input {
-    display: block;
-    width: 100%;
-  }
-
-  &-results {
-    position: absolute;
-    left: 0;
-    top: 100%;
-    right: 0;
-    max-height: 400px;
-    background-color: $fallback--lightBg;
-    background-color: var(--lightBg, $fallback--lightBg);
-    border-style: solid;
-    border-width: 1px;
-    border-color: $fallback--border;
-    border-color: var(--border, $fallback--border);
-    border-radius: $fallback--inputRadius;
-    border-radius: var(--inputRadius, $fallback--inputRadius);
-    border-top-left-radius: 0;
-    border-top-right-radius: 0;
-    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
-    box-shadow: var(--panelShadow);
-    overflow-y: auto;
-    z-index: 1;
-  }
-}
-</style>
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 2cae2d00..a0dfbc67 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -11,7 +11,7 @@ import fileSizeFormatService from '../../services/file_size_format/file_size_for
 import BlockCard from '../block_card/block_card.vue'
 import MuteCard from '../mute_card/mute_card.vue'
 import EmojiInput from '../emoji-input/emoji-input.vue'
-import UserAutoSuggest from '../user_autosuggest/user_autosuggest.vue'
+import Autosuggest from '../autosuggest/autosuggest.vue'
 import withSubscription from '../../hocs/with_subscription/with_subscription'
 import withList from '../../hocs/with_list/with_list'
 import userSearchApi from '../../services/new_api/user_search.js'
@@ -78,7 +78,7 @@ const UserSettings = {
     BlockList,
     MuteList,
     EmojiInput,
-    UserAutoSuggest,
+    Autosuggest,
     BlockCard
   },
   computed: {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 69d3dc53..d79abd0f 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -196,9 +196,9 @@
 
         <div :label="$t('settings.blocks_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block">
+            <Autosuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block">
               <BlockCard slot-scope="row" :userId="row.item"/>
-            </UserAutoSuggest>
+            </Autosuggest>
           </div>
           <block-list :refresh="true">
             <template slot="empty">{{$t('settings.no_blocks')}}</template>
-- 
cgit v1.2.3-70-g09d2


From d58e08cf52c5953914f0bf1b6c9fb120168c6160 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 16:14:45 -0400
Subject: add search to the mutes tab as well

---
 src/components/user_settings/user_settings.js  | 9 ++++++++-
 src/components/user_settings/user_settings.vue | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index a0dfbc67..dd931e67 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -79,7 +79,8 @@ const UserSettings = {
     MuteList,
     EmojiInput,
     Autosuggest,
-    BlockCard
+    BlockCard,
+    MuteCard
   },
   computed: {
     user () {
@@ -347,6 +348,12 @@ const UserSettings = {
         return !user || user.statusnet_blocking || user.id === this.$store.state.users.currentUser.id
       })
     },
+    filterUnMutedUsers (userIds) {
+      return reject(userIds, (userId) => {
+        const user = this.$store.getters.findUser(userId)
+        return !user || user.muted || user.id === this.$store.state.users.currentUser.id
+      })
+    },
     queryUserIds (query) {
       return userSearchApi.search({query, store: this.$store})
         .then((users) => {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index d79abd0f..8fcf4c07 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -206,6 +206,11 @@
         </div>
 
         <div :label="$t('settings.mutes_tab')">
+          <div class="profile-edit-usersearch-wrapper">
+            <Autosuggest :filter="filterUnMutedUsers" :query="queryUserIds" placeholder="Search whom you want to mute">
+              <MuteCard slot-scope="row" :userId="row.item"/>
+            </Autosuggest>
+          </div>
           <mute-list :refresh="true">
             <template slot="empty">{{$t('settings.no_mutes')}}</template>
           </mute-list>
-- 
cgit v1.2.3-70-g09d2


From d874ca905cbf90a4adb070bbe9b307e5bf9ad82f Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Tue, 2 Apr 2019 16:28:51 -0400
Subject: support i18n

---
 src/components/user_settings/user_settings.vue | 4 ++--
 src/i18n/en.json                               | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/components/user_settings/user_settings.vue')

diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 8fcf4c07..9d37ffc4 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -196,7 +196,7 @@
 
         <div :label="$t('settings.blocks_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <Autosuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block">
+            <Autosuggest :filter="filterUnblockedUsers" :query="queryUserIds" :placeholder="$t('settings.search_user_to_block')">
               <BlockCard slot-scope="row" :userId="row.item"/>
             </Autosuggest>
           </div>
@@ -207,7 +207,7 @@
 
         <div :label="$t('settings.mutes_tab')">
           <div class="profile-edit-usersearch-wrapper">
-            <Autosuggest :filter="filterUnMutedUsers" :query="queryUserIds" placeholder="Search whom you want to mute">
+            <Autosuggest :filter="filterUnMutedUsers" :query="queryUserIds" :placeholder="$t('settings.search_user_to_mute')">
               <MuteCard slot-scope="row" :userId="row.item"/>
             </Autosuggest>
           </div>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 9188c6f7..c71c9036 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -217,6 +217,8 @@
     "reply_visibility_self": "Only show replies directed at me",
     "saving_err": "Error saving settings",
     "saving_ok": "Settings saved",
+    "search_user_to_block": "Search whom you want to block",
+    "search_user_to_mute": "Search whom you want to mute",
     "security_tab": "Security",
     "scope_copy": "Copy scope when replying (DMs are always copied)",
     "minimal_scopes_mode": "Minimize post scope selection options",
-- 
cgit v1.2.3-70-g09d2

