diff --git a/src/boot/routes.js b/src/boot/routes.js
index b5d3c631..2a3728aa 100644
--- a/src/boot/routes.js
+++ b/src/boot/routes.js
@@ -20,6 +20,7 @@ import ChatPanel from 'components/chat_panel/chat_panel.vue'
import WhoToFollow from 'components/who_to_follow/who_to_follow.vue'
import About from 'components/about/about.vue'
import RemoteUserResolver from 'components/remote_user_resolver/remote_user_resolver.vue'
+import Lists from 'components/lists/lists.vue'
export default (store) => {
const validateAuthenticatedRoute = (to, from, next) => {
@@ -69,7 +70,8 @@ export default (store) => {
{ name: 'search', path: '/search', component: Search, props: (route) => ({ query: route.query.query }) },
{ name: 'who-to-follow', path: '/who-to-follow', component: WhoToFollow, beforeEnter: validateAuthenticatedRoute },
{ name: 'about', path: '/about', component: About },
- { name: 'user-profile', path: '/(users/)?:name', component: UserProfile }
+ { name: 'user-profile', path: '/(users/)?:name', component: UserProfile },
+ { name: 'lists', path: '/lists', component: Lists, beforeEnter: validateAuthenticatedRoute }
]
if (store.state.instance.pleromaChatMessagesAvailable) {
diff --git a/src/components/lists/lists.vue b/src/components/lists/lists.vue
new file mode 100644
index 00000000..bb7ffbe5
--- /dev/null
+++ b/src/components/lists/lists.vue
@@ -0,0 +1,34 @@
+
+
+
+ {{ list.title }}
+
+
+ No lists
+
+
+
+
+
+
+
diff --git a/src/components/timeline_menu/timeline_menu.vue b/src/components/timeline_menu/timeline_menu.vue
index c46531be..9f30e252 100644
--- a/src/components/timeline_menu/timeline_menu.vue
+++ b/src/components/timeline_menu/timeline_menu.vue
@@ -59,6 +59,15 @@
/>{{ $t("nav.twkn") }}
+
+
+ {{ $t("nav.lists") }}
+
+
`/api/v1/lists/${id}`
+const MASTODON_LIST_ACCOUNTS_URL = id => `/api/v1/lists/${id}/accounts`
const PLEROMA_EMOJI_REACTIONS_URL = id => `/api/v1/pleroma/statuses/${id}/reactions`
const PLEROMA_EMOJI_REACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
@@ -560,7 +563,7 @@ const fetchTimeline = ({
})
.then((data) => data.json())
.then((data) => {
- if (!data.error) {
+ if (!data.errors) {
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
} else {
data.status = status
@@ -1257,6 +1260,77 @@ const deleteChatMessage = ({ chatId, messageId, credentials }) => {
})
}
+const lists = ({ credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LISTS_URL,
+ method: 'GET',
+ credentials
+ })
+}
+
+const list = ({ listId, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LIST_URL(listId),
+ method: 'GET',
+ credentials
+ })
+}
+
+const createList = ({ title, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LISTS_URL,
+ method: 'POST',
+ payload: { title },
+ credentials
+ })
+}
+
+const updateList = ({ title, listId, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LIST_URL(listId),
+ method: 'PUT',
+ payload: { title },
+ credentials
+ })
+}
+
+const deleteList = ({ listId, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LIST_URL(listId),
+ method: 'DELETE',
+ credentials
+ })
+}
+
+const listUsers = ({ listId, credentials }) => {
+ // TODO: pagination
+ return promisedRequest({
+ url: MASTODON_LIST_ACCOUNTS_URL(listId),
+ method: 'GET',
+ credentials
+ })
+ .then(data => data.json())
+ .then(response => response.map(u => parseUser(u)))
+}
+
+const addUsersToList = ({ listId, userIds, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LIST_ACCOUNTS_URL(listId),
+ method: 'POST',
+ payload: { 'account_ids': userIds },
+ credentials
+ })
+}
+
+const removeUsersFromList = ({ listId, userIds, credentials }) => {
+ return promisedRequest({
+ url: MASTODON_LIST_ACCOUNTS_URL(listId),
+ method: 'DELETE',
+ payload: { 'account_ids': userIds },
+ credentials
+ })
+}
+
const apiService = {
verifyCredentials,
fetchTimeline,
@@ -1342,7 +1416,15 @@ const apiService = {
chatMessages,
sendChatMessage,
readChat,
- deleteChatMessage
+ deleteChatMessage,
+ lists,
+ list,
+ createList,
+ updateList,
+ deleteList,
+ listUsers,
+ addUsersToList,
+ removeUsersFromList
}
export default apiService