diff --git a/src/App.js b/src/App.js
index f5bd7e2e..12a12f71 100644
--- a/src/App.js
+++ b/src/App.js
@@ -85,8 +85,12 @@ export default {
isChats () {
return this.$route.name === 'chat' || this.$route.name === 'chats'
},
+ isListEdit () {
+ return this.$route.name === 'lists-edit'
+ },
newPostButtonShown () {
if (this.isChats) return false
+ if (this.isListEdit) return false
return this.$store.getters.mergedConfig.alwaysShowNewPostButton || this.layoutType === 'mobile'
},
showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
diff --git a/src/App.vue b/src/App.vue
index c741aa70..cb6a0115 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -33,7 +33,7 @@
{ this.title = this.findListTitle(this.id) })
+ .then(() => {
+ this.title = this.findListTitle(this.id)
+ this.titleDraft = this.title
+ })
this.$store.dispatch('fetchListAccounts', { listId: this.id })
.then(() => {
- this.selectedUserIds = this.findListAccounts(this.id)
- this.selectedUserIds.forEach(userId => {
+ this.membersUserIds = this.findListAccounts(this.id)
+ this.membersUserIds.forEach(userId => {
this.$store.dispatch('fetchUserIfMissing', userId)
})
})
@@ -41,11 +53,12 @@ const ListsNew = {
id () {
return this.$route.params.id
},
- users () {
- return this.userIds.map(userId => this.findUser(userId))
+ membersUsers () {
+ return [...this.membersUserIds, ...this.addedUserIds]
+ .map(userId => this.findUser(userId)).filter(user => user)
},
- selectedUsers () {
- return this.selectedUserIds.map(userId => this.findUser(userId)).filter(user => user)
+ searchUsers () {
+ return this.searchUserIds.map(userId => this.findUser(userId)).filter(user => user)
},
...mapState({
currentUser: state => state.users.currentUser
@@ -56,30 +69,51 @@ const ListsNew = {
onInput () {
this.search(this.query)
},
- selectUser (user) {
- if (this.selectedUserIds.includes(user.id)) {
- this.removeUser(user.id)
- } else {
+ toggleRemoveMember (user) {
+ if (this.removedUserIds.has(user.id)) {
this.addUser(user)
+ this.removedUserIds.delete(user.id)
+ } else {
+ this.removeUser(user.id)
+ this.removedUserIds.add(user.id)
}
},
- isSelected (user) {
- return this.selectedUserIds.includes(user.id)
+ toggleAddFromSearch (user) {
+ if (this.addedUserIds.has(user.id)) {
+ this.removeUser(user.id)
+ this.addedUserIds.delete(user.id)
+ } else {
+ this.addUser(user)
+ this.addedUserIds.add(user.id)
+ }
+ },
+ isRemoved (user) {
+ return this.removedUserIds.has(user.id)
+ },
+ isAdded (user) {
+ return this.addedUserIds.has(user.id)
},
addUser (user) {
- this.selectedUserIds.push(user.id)
+ // this.selectedUserIds.push(user.id)
},
removeUser (userId) {
- this.selectedUserIds = this.selectedUserIds.filter(id => id !== userId)
+ // this.selectedUserIds = this.selectedUserIds.filter(id => id !== userId)
},
- onResults (results) {
- this.userIds = results
+ onSearchLoading (results) {
+ this.searchLoading = true
},
- updateList () {
- this.$store.dispatch('setList', { listId: this.id, title: this.title })
- this.$store.dispatch('setListAccounts', { listId: this.id, accountIds: this.selectedUserIds })
-
- this.$router.push({ name: 'lists-timeline', params: { id: this.id } })
+ onSearchLoadingDone (results) {
+ this.searchLoading = false
+ },
+ onSearchResults (results) {
+ this.searchLoading = false
+ this.searchUserIds = results
+ },
+ updateListTitle () {
+ this.$store.dispatch('setList', { listId: this.id, title: this.titleDraft })
+ .then(() => {
+ this.title = this.findListTitle(this.id)
+ })
},
deleteList () {
this.$store.dispatch('deleteList', { listId: this.id })
diff --git a/src/components/lists_edit/lists_edit.vue b/src/components/lists_edit/lists_edit.vue
index 69007b02..dffbff2f 100644
--- a/src/components/lists_edit/lists_edit.vue
+++ b/src/components/lists_edit/lists_edit.vue
@@ -1,8 +1,8 @@
-
+
-
-
-
+
-
-
-
-
-
-
+
+
+
+ {{ ' ' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('lists.is_in_list') }}
+
+
+
+
+
+
+
+
+
+
-
-
@@ -69,28 +144,43 @@
diff --git a/src/components/lists_user_search/lists_user_search.js b/src/components/lists_user_search/lists_user_search.js
index 5798841a..c92ec0ee 100644
--- a/src/components/lists_user_search/lists_user_search.js
+++ b/src/components/lists_user_search/lists_user_search.js
@@ -15,6 +15,7 @@ const ListsUserSearch = {
components: {
Checkbox
},
+ emits: ['loading', 'loadingDone', 'results'],
data () {
return {
loading: false,
@@ -33,12 +34,16 @@ const ListsUserSearch = {
}
this.loading = true
+ this.$emit('loading')
this.userIds = []
this.$store.dispatch('search', { q: query, resolve: true, type: 'accounts', following: this.followingOnly })
.then(data => {
- this.loading = false
this.$emit('results', data.accounts.map(a => a.id))
})
+ .finally(() => {
+ this.loading = false
+ this.$emit('loadingDone')
+ })
}
}
}
diff --git a/src/components/lists_user_search/lists_user_search.vue b/src/components/lists_user_search/lists_user_search.vue
index 03fb3ba6..8633170c 100644
--- a/src/components/lists_user_search/lists_user_search.vue
+++ b/src/components/lists_user_search/lists_user_search.vue
@@ -1,5 +1,5 @@
-