-
-
-
+
diff --git a/src/renderer/components/TimelineSpace/Modals/AddListMember.vue b/src/renderer/components/TimelineSpace/Modals/AddListMember.vue
new file mode 100644
index 00000000..b74973ea
--- /dev/null
+++ b/src/renderer/components/TimelineSpace/Modals/AddListMember.vue
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![]()
+
+
+
+ {{ username(user) }}
+
+
+ @{{ user.acct }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/renderer/store/TimelineSpace/Modals.js b/src/renderer/store/TimelineSpace/Modals.js
index dcc03b34..a18c98bc 100644
--- a/src/renderer/store/TimelineSpace/Modals.js
+++ b/src/renderer/store/TimelineSpace/Modals.js
@@ -2,6 +2,7 @@ import NewToot from './Modals/NewToot'
import ImageViewer from './Modals/ImageViewer'
import Jump from './Modals/Jump'
import ListMembership from './Modals/ListMembership'
+import AddListMember from './Modals/AddListMember'
const Modals = {
namespaced: true,
@@ -9,7 +10,8 @@ const Modals = {
ImageViewer,
NewToot,
Jump,
- ListMembership
+ ListMembership,
+ AddListMember
}
}
diff --git a/src/renderer/store/TimelineSpace/Modals/AddListMember.js b/src/renderer/store/TimelineSpace/Modals/AddListMember.js
new file mode 100644
index 00000000..e27eb81a
--- /dev/null
+++ b/src/renderer/store/TimelineSpace/Modals/AddListMember.js
@@ -0,0 +1,49 @@
+import Mastodon from 'megalodon'
+
+export default {
+ namespaced: true,
+ state: {
+ modalOpen: false,
+ accounts: [],
+ targetListId: null
+ },
+ mutations: {
+ changeModal (state, value) {
+ state.modalOpen = value
+ },
+ updateAccounts (state, accounts) {
+ state.accounts = accounts
+ },
+ setListId (state, id) {
+ state.targetListId = id
+ }
+ },
+ actions: {
+ changeModal ({ commit }, value) {
+ commit('changeModal', value)
+ },
+ search ({ commit, rootState }, name) {
+ const client = new Mastodon(
+ rootState.TimelineSpace.account.accessToken,
+ rootState.TimelineSpace.account.baseURL + '/api/v1'
+ )
+ return client.get('/accounts/search', {
+ q: name,
+ following: true
+ })
+ .then(data => {
+ commit('updateAccounts', data)
+ return data
+ })
+ },
+ add ({ state, rootState }, account) {
+ const client = new Mastodon(
+ rootState.TimelineSpace.account.accessToken,
+ rootState.TimelineSpace.account.baseURL + '/api/v1'
+ )
+ return client.post(`/lists/${state.targetListId}/accounts`, {
+ account_ids: [account.id]
+ })
+ }
+ }
+}
From b24a38bbb6bd761a366ac843ac08770ca61bc2c9 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Tue, 19 Jun 2018 08:47:35 +0900
Subject: [PATCH 3/3] refs #396 Refresh list members after add member
---
.../components/TimelineSpace/Modals/AddListMember.vue | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/renderer/components/TimelineSpace/Modals/AddListMember.vue b/src/renderer/components/TimelineSpace/Modals/AddListMember.vue
index b74973ea..76296d13 100644
--- a/src/renderer/components/TimelineSpace/Modals/AddListMember.vue
+++ b/src/renderer/components/TimelineSpace/Modals/AddListMember.vue
@@ -50,7 +50,8 @@ export default {
computed: {
...mapState({
loadingBackground: state => state.App.theme.wrapper_mask_color,
- accounts: state => state.TimelineSpace.Modals.AddListMember.accounts
+ accounts: state => state.TimelineSpace.Modals.AddListMember.accounts,
+ listId: state => state.TimelineSpace.Modals.AddListMember.targetListId
}),
addListMemberModal: {
get () {
@@ -76,6 +77,7 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/AddListMember/add', user)
.then(() => {
this.addListMemberModal = false
+ this.$store.dispatch('TimelineSpace/Contents/Lists/Edit/fetchMembers', this.listId)
})
.catch(() => {
this.$message({