From fc98eea51518a2346dd4e3ca061bcf4422c49d52 Mon Sep 17 00:00:00 2001 From: floatingghost Date: Tue, 9 Aug 2022 01:18:54 +0000 Subject: [PATCH] Purge defunct settings (#6) Reviewed-on: https://akkoma.dev/AkkomaGang/admin-fe/pulls/6 --- src/api/__mocks__/chat.js | 617 --------------------- src/api/__mocks__/users.js | 6 - src/api/chat.js | 35 -- src/api/users.js | 9 - src/components/ChatMessage/index.vue | 233 -------- src/lang/en.js | 8 - src/router/index.js | 12 - src/store/index.js | 2 - src/store/modules/chat.js | 56 -- src/store/modules/userProfile.js | 22 +- src/views/chats/show.vue | 250 --------- src/views/settings/components/Frontend.vue | 10 - src/views/settings/components/tabs.js | 10 +- src/views/users/show.vue | 71 +-- test/views/chats/show.test.js | 51 -- test/views/chats/store.conf.js | 25 - 16 files changed, 3 insertions(+), 1414 deletions(-) delete mode 100644 src/api/__mocks__/chat.js delete mode 100644 src/api/chat.js delete mode 100644 src/components/ChatMessage/index.vue delete mode 100644 src/store/modules/chat.js delete mode 100644 src/views/chats/show.vue delete mode 100644 test/views/chats/show.test.js delete mode 100644 test/views/chats/store.conf.js diff --git a/src/api/__mocks__/chat.js b/src/api/__mocks__/chat.js deleted file mode 100644 index 75692ea7..00000000 --- a/src/api/__mocks__/chat.js +++ /dev/null @@ -1,617 +0,0 @@ -export async function fetchChat(id, authHost, token) { - return Promise.resolve({ data: userChats[0] }) -} - -export async function fetchChatMessages(id, max_id, authHost, token) { - return Promise.resolve({ data: chatMessages }) -} - -export async function deleteChat(chat_id, message_id, authHost, token) { - return Promise.resolve({ data: userChats[0] }) -} - -export const userChats = [ - { - id: '9y8e7ESoVUiKVMAoCW', - last_message: { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'heyy', - created_at: '2020-09-11T00:07:13.000Z', - emojis: [], - id: '9z22Q9MzWiAk7GZnNY', - unread: false - }, - receiver: { - acct: 'test10', - avatar: 'http://localhost:4000/images/avi.png', - avatar_static: 'http://localhost:4000/images/avi.png', - bot: false, - created_at: '2020-07-27T00:33:02.000Z', - display_name: 'test10', - emojis: [], - fields: [], - followers_count: 2, - following_count: 1, - header: 'http://localhost:4000/images/banner.png', - header_static: 'http://localhost:4000/images/banner.png', - id: '9xUj5WTmzSlFPN6OLg', - locked: false, - note: '', - pleroma: { - accepts_chat_messages: true, - ap_id: 'http://localhost:4000/users/test10', - background_image: null, - is_confirmed: true, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: false, - is_moderator: true, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'mrf_tag:media-force-nsfw', - 'mrf_tag:media-strip', - 'mrf_tag:force-unlisted' - ] - }, - source: { - fields: [], - note: '', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 20, - url: 'http://localhost:4000/users/test10', - username: 'test10' - }, - sender: { - acct: 'mk', - avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - bot: false, - created_at: '2020-07-26T19:37:31.000Z', - display_name: 'mk', - emojis: [], - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - followers_count: 2, - following_count: 1, - header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - id: '9xUIiQfGrdPJDZe39s', - locked: false, - note: 'a bio about me', - pleroma: { - accepts_chat_messages: true, - ap_id: 'https://localhost/users/mk', - background_image: null, - is_confirmed: true, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: true, - is_moderator: false, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'verified' - ] - }, - source: { - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - note: 'a bio about me', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 77, - url: 'https://localhost/users/mk', - username: 'mk' - }, - unread: 0, - updated_at: '2020-09-11T00:07:13.000Z' - }, - { - id: '9y8dwDAQzFBZIZJzEG', - last_message: { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8dwDAQzFBZIZJzEG', - content: 'hiiiiiiiiiiiiiiiiiii', - created_at: '2020-08-15T06:45:13.000Z', - emojis: [], - id: '9y8e4EZndDmfzA0lGa', - unread: false - }, - receiver: { - acct: 'user2', - avatar: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png', - avatar_static: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png', - bot: false, - created_at: '2020-08-01T19:23:57.000Z', - display_name: 'User2', - emojis: [], - fields: [], - followers_count: 0, - following_count: 2, - header: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg', - header_static: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg', - id: '9xfhRuCIyydruc0Sh6', - locked: false, - note: 'Just me!', - pleroma: { - accepts_chat_messages: true, - ap_id: 'http://localhost:4000/users/user2', - background_image: null, - is_confirmed: false, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: false, - is_moderator: false, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'mrf_tag:force-unlisted', - 'mrf_tag:media-strip' - ] - }, - source: { - fields: [], - note: 'Just me!', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 69, - url: 'http://localhost:4000/users/user2', - username: 'user2' - }, - sender: { - acct: 'mk', - avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - bot: false, - created_at: '2020-07-26T19:37:31.000Z', - display_name: 'mk', - emojis: [], - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - followers_count: 2, - following_count: 1, - header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - id: '9xUIiQfGrdPJDZe39s', - locked: false, - note: 'a bio about me', - pleroma: { - accepts_chat_messages: true, - ap_id: 'https://localhost/users/mk', - background_image: null, - is_confirmed: true, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: true, - is_moderator: false, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'verified' - ] - }, - source: { - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - note: 'a bio about me', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 77, - url: 'https://localhost/users/mk', - username: 'mk' - }, - unread: 0, - updated_at: '2020-08-15T06:45:13.000Z' - }, - { - id: '9y8dubemxq32fkkoeu', - last_message: null, - receiver: { - acct: 'mk', - avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - bot: false, - created_at: '2020-07-26T19:37:31.000Z', - display_name: 'mk', - emojis: [], - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - followers_count: 2, - following_count: 1, - header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - id: '9xUIiQfGrdPJDZe39s', - locked: false, - note: 'a bio about me', - pleroma: { - accepts_chat_messages: true, - ap_id: 'https://localhost/users/mk', - background_image: null, - is_confirmed: true, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: true, - is_moderator: false, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'verified' - ] - }, - source: { - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - note: 'a bio about me', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 77, - url: 'https://localhost/users/mk', - username: 'mk' - }, - sender: { - acct: 'mk', - avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif', - bot: false, - created_at: '2020-07-26T19:37:31.000Z', - display_name: 'mk', - emojis: [], - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - followers_count: 2, - following_count: 1, - header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif', - id: '9xUIiQfGrdPJDZe39s', - locked: false, - note: 'a bio about me', - pleroma: { - accepts_chat_messages: true, - ap_id: 'https://localhost/users/mk', - background_image: null, - is_confirmed: true, - favicon: null, - hide_favorites: true, - hide_followers: false, - hide_followers_count: false, - hide_follows: false, - hide_follows_count: false, - is_admin: true, - is_moderator: false, - relationship: {}, - skip_thread_containment: false, - tags: [ - 'verified' - ] - }, - source: { - fields: [ - { - name: 'website', - value: 'marykatefain.com' - } - ], - note: 'a bio about me', - pleroma: { - actor_type: 'Person', - discoverable: false - }, - sensitive: false - }, - statuses_count: 77, - url: 'https://localhost/users/mk', - username: 'mk' - }, - unread: 0, - updated_at: '2020-08-15T06:43:29.000Z' - } -] - -export const chatMessages = [ - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'heyy', - created_at: '2020-09-11T00:07:13.000Z', - emojis: [], - id: '9z22Q9MzWiAk7GZnNY', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: { - description: null, - id: '-1990764178', - pleroma: { - mime_type: 'image/png' - }, - preview_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png', - remote_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png', - text_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png', - type: 'image', - url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png' - }, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: null, - created_at: '2020-09-10T20:35:33.000Z', - emojis: [], - id: '9z1jWuQNaq8Ef6fdOS', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'probably', - created_at: '2020-09-10T16:57:33.000Z', - emojis: [], - id: '9z1Q4eXb9kBYA8rNT6', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'That has got to be 20 by now', - created_at: '2020-09-10T16:57:29.000Z', - emojis: [], - id: '9z1Q4LQAF9wuraEfk8', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'I miss bars :(', - created_at: '2020-09-10T16:57:22.000Z', - emojis: [], - id: '9z1Q3gmlKEfEpnUdm4', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'Yeah tying to!', - created_at: '2020-09-10T16:57:15.000Z', - emojis: [], - id: '9z1Q307VxCiKVhs6eO', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'staying safe with covid and such?', - created_at: '2020-09-10T16:57:10.000Z', - emojis: [], - id: '9z1Q2Z56U3k6ePXIe1', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'how have you been?', - created_at: '2020-09-10T16:57:06.000Z', - emojis: [], - id: '9z1Q29XvQHLfSGowxU', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'so what are you doing?', - created_at: '2020-09-10T16:57:02.000Z', - emojis: [], - id: '9z1Q1lPb9aQYbUjxeD', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'crazy', - created_at: '2020-09-10T16:56:55.000Z', - emojis: [], - id: '9z1Q19zQHwVMXbD2DA', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'omg yeah same', - created_at: '2020-09-10T16:56:54.000Z', - emojis: [], - id: '9z1Q12zWJBQIpsCVtI', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'hahahaha', - created_at: '2020-09-10T16:56:51.000Z', - emojis: [], - id: '9z1Q0pyKiHkWSQXsjg', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'I think this is 13', - created_at: '2020-09-10T16:56:45.000Z', - emojis: [], - id: '9z1Q0Ft6sEBGXnpCb3', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'We need to keep typing until we hit 20', - created_at: '2020-09-10T16:56:42.000Z', - emojis: [], - id: '9z1PzywjrTyy08OMOO', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'That's nice', - created_at: '2020-09-10T16:56:03.000Z', - emojis: [], - id: '9z1PwOkJzs8orKsJDU', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'I've been good! Keeping busy', - created_at: '2020-09-10T16:56:00.000Z', - emojis: [], - id: '9z1Pw7qmoaDASSljQv', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: '*been', - created_at: '2020-09-10T16:55:55.000Z', - emojis: [], - id: '9z1PvcWVHwZFIa2b0y', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'How have you ben?', - created_at: '2020-09-10T16:55:52.000Z', - emojis: [], - id: '9z1PvK4BuTE03YejNw', - unread: false - }, - { - account_id: '9xUIiQfGrdPJDZe39s', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'Oh it's okay! No worries!', - created_at: '2020-09-10T16:55:44.000Z', - emojis: [], - id: '9z1Puc4hTDUJcOYW4O', - unread: false - }, - { - account_id: '9xUj5WTmzSlFPN6OLg', - attachment: null, - card: null, - chat_id: '9y8e7ESoVUiKVMAoCW', - content: 'didn't mean to ignore you', - created_at: '2020-09-10T16:55:32.000Z', - emojis: [], - id: '9z1PtWGNamQTIvUspk', - unread: false - } -] diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index b419ff3d..db0a694c 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -1,5 +1,3 @@ -import userChats from './chat' - export let users = [ { is_confirmed: true, is_approved: true, is_active: true, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, { is_confirmed: true, is_approved: true, is_active: true, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, @@ -37,10 +35,6 @@ export async function fetchUserStatuses(id, authHost, godmode, token) { return Promise.resolve({ data: userStatuses }) } -export async function fetchUserChats(id, authHost, godmode, token) { - return Promise.resolve({ data: userChats }) -} - export async function getPasswordResetToken(nickname, authHost, token) { return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/pleroma/password_reset/g05lxnBJQnL' }}) } diff --git a/src/api/chat.js b/src/api/chat.js deleted file mode 100644 index 73990cfa..00000000 --- a/src/api/chat.js +++ /dev/null @@ -1,35 +0,0 @@ -import request from '@/utils/request' -import { getToken } from '@/utils/auth' -import { baseName } from './utils' - -export async function deleteChatMessage(chat_id, message_id, authHost, token) { - return await request({ - baseURL: baseName(authHost), - url: `/api/pleroma/admin/chats/${chat_id}/messages/${message_id}`, - method: 'delete', - headers: authHeaders(token) - }) -} - -export async function fetchChat(id, authHost, token) { - return await request({ - baseURL: baseName(authHost), - url: `/api/pleroma/admin/chats/${id}`, - method: 'get', - headers: authHeaders(token) - }) -} - -export async function fetchChatMessages(id, maxId, authHost, token) { - const url = maxId - ? `/api/pleroma/admin/chats/${id}/messages?max_id=${maxId}` - : `/api/pleroma/admin/chats/${id}/messages` - return await request({ - baseURL: baseName(authHost), - url, - method: 'get', - headers: authHeaders(token) - }) -} - -const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {} diff --git a/src/api/users.js b/src/api/users.js index 41c6b9b4..55021477 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -180,15 +180,6 @@ export async function fetchUserStatuses(id, authHost, godmode, token) { }) } -export async function fetchUserChats(id, authHost, token) { - return await request({ - baseURL: baseName(authHost), - url: `/api/pleroma/admin/users/${id}/chats`, - method: 'get', - headers: authHeaders(token) - }) -} - export async function approveUserAccount(nicknames, authHost, token) { return await request({ baseURL: baseName(authHost), diff --git a/src/components/ChatMessage/index.vue b/src/components/ChatMessage/index.vue deleted file mode 100644 index 2e6a05cb..00000000 --- a/src/components/ChatMessage/index.vue +++ /dev/null @@ -1,233 +0,0 @@ - - - - - diff --git a/src/lang/en.js b/src/lang/en.js index ced4c38c..0864fdb0 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -67,7 +67,6 @@ export default { reports: 'Reports', invites: 'Invites', statuses: 'Statuses', - chats: 'Chats', settings: 'Settings', moderationLog: 'Moderation Log', relays: 'Relays', @@ -302,11 +301,6 @@ export default { unlisted: 'Unlisted', openStatusInInstance: 'Open status in instance' }, - chats: { - chats: 'Chats', - loadMore: 'Load more', - chatHistory: 'Chat History' - }, userProfile: { tags: 'Tags', moderator: 'Moderator', @@ -317,7 +311,6 @@ export default { actorType: 'Actor Type', nickname: 'Nickname', recentStatuses: 'Recent Statuses', - chats: 'Chats', roles: 'Roles', active: 'Active', status: 'Status', @@ -325,7 +318,6 @@ export default { deactivated: 'Deactivated', pending: 'Pending', noStatuses: 'No statuses to show', - noChats: 'No chats to show', noMessages: 'No messages to show', openAccountInInstance: 'Open account in instance', securitySettings: { diff --git a/src/router/index.js b/src/router/index.js index 4d046318..48855908 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -232,17 +232,5 @@ export const asyncRouterMap = [ ], hidden: true }, - { - path: '/chats/:id', - component: Layout, - children: [ - { - path: '', - name: 'ChatsShow', - component: () => import('@/views/chats/show') - } - ], - hidden: true - }, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/store/index.js b/src/store/index.js index 6e9d3b7e..bd4a6e5b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,7 +13,6 @@ import relays from './modules/relays' import reports from './modules/reports' import settings from './modules/settings' import status from './modules/status' -import chat from './modules/chat' import tagsView from './modules/tagsView' import user from './modules/user' import userProfile from './modules/userProfile' @@ -35,7 +34,6 @@ const store = new Vuex.Store({ reports, settings, status, - chat, tagsView, user, userProfile, diff --git a/src/store/modules/chat.js b/src/store/modules/chat.js deleted file mode 100644 index cc4debbe..00000000 --- a/src/store/modules/chat.js +++ /dev/null @@ -1,56 +0,0 @@ -import { fetchChat, fetchChatMessages, deleteChatMessage } from '@/api/chat' - -const chat = { - state: { - fetchedChat: {}, - fetchedChatMessages: {}, - loading: false, - buttonLoading: false, - allLoaded: false, - maxId: null - }, - mutations: { - SET_LOADING: (state, chat) => { - state.loading = chat - }, - SET_ALL_LOADED: (state, chat) => { - state.allLoaded = chat - }, - SET_BUTTON_LOADING: (state, chat) => { - state.buttonLoading = chat - }, - SET_CHAT: (state, chat) => { - state.fetchedChat = chat - }, - SET_CHAT_MESSAGES: (state, chatMessages) => { - state.fetchedChatMessages = chatMessages - }, - CHANGE_MAX_ID: (state, max_id) => { - state.maxId = max_id - } - }, - actions: { - async FetchChat({ commit, dispatch, getters, state }, id) { - commit('SET_LOADING', true) - const chat = await fetchChat(id, getters.authHost, getters.token) - - commit('SET_CHAT', chat.data) - commit('SET_LOADING', false) - }, - async FetchChatMessages({ commit, dispatch, getters, state }, id, max_id) { - commit('SET_LOADING', true) - const chat = await fetchChatMessages(id, state.maxId, getters.authHost, getters.token) - commit('SET_CHAT_MESSAGES', chat.data) - commit('SET_LOADING', false) - }, - async DeleteMessage({ commit, dispatch, getters, state }, params) { - await deleteChatMessage(params.chat_id, params.message_id, getters.authHost, getters.token) - dispatch('FetchChatMessages', params.chat_id) - }, - HandlePageChange({ commit }, max_id) { - commit('CHANGE_MAX_ID', max_id) - } - } -} - -export default chat diff --git a/src/store/modules/userProfile.js b/src/store/modules/userProfile.js index 40af065c..0cdc0df6 100644 --- a/src/store/modules/userProfile.js +++ b/src/store/modules/userProfile.js @@ -1,11 +1,9 @@ -import { fetchUser, fetchUserStatuses, fetchUserChats, fetchUserCredentials, updateUserCredentials } from '@/api/users' +import { fetchUser, fetchUserStatuses, fetchUserCredentials, updateUserCredentials } from '@/api/users' const userProfile = { state: { statuses: [], statusesLoading: true, - chats: [], - chatsLoading: true, user: {}, userCredentials: {}, userProfileLoading: true @@ -17,12 +15,6 @@ const userProfile = { SET_STATUSES_LOADING: (state, status) => { state.statusesLoading = status }, - SET_CHATS: (state, chats) => { - state.chats = chats - }, - SET_CHATS_LOADING: (state, chat) => { - state.chatsLoading = chat - }, SET_USER: (state, user) => { state.user = user }, @@ -42,7 +34,6 @@ const userProfile = { commit('SET_USER_PROFILE_LOADING', false) dispatch('FetchUserStatuses', { userId, godmode }) - dispatch('FetchUserChats', { userId }) }, FetchUserStatuses({ commit, dispatch, getters }, { userId, godmode }) { commit('SET_STATUSES_LOADING', true) @@ -52,14 +43,6 @@ const userProfile = { commit('SET_STATUSES_LOADING', false) }, - FetchUserChats({ commit, dispatch, getters }, { userId }) { - commit('SET_CHATS_LOADING', true) - - fetchUserChats(userId, getters.authHost, getters.token) - .then(chats => dispatch('SetChats', chats.data)) - - commit('SET_CHATS_LOADING', false) - }, async FetchUserCredentials({ commit, getters }, { nickname }) { const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token) commit('SET_USER_CREDENTIALS', userResponse.data) @@ -67,9 +50,6 @@ const userProfile = { SetStatuses({ commit }, statuses) { commit('SET_STATUSES', statuses) }, - SetChats({ commit }, chats) { - commit('SET_CHATS', chats) - }, async UpdateUserCredentials({ dispatch, getters }, { nickname, credentials }) { await updateUserCredentials(nickname, credentials, getters.authHost, getters.token) dispatch('FetchUserCredentials', { nickname }) diff --git a/src/views/chats/show.vue b/src/views/chats/show.vue deleted file mode 100644 index d48e15b2..00000000 --- a/src/views/chats/show.vue +++ /dev/null @@ -1,250 +0,0 @@ - - - - - diff --git a/src/views/settings/components/Frontend.vue b/src/views/settings/components/Frontend.vue index e37c43b9..f1704f79 100644 --- a/src/views/settings/components/Frontend.vue +++ b/src/views/settings/components/Frontend.vue @@ -18,10 +18,6 @@ - - - - @@ -55,12 +51,6 @@ export default { assetsData() { return _.get(this.settings.settings, [':pleroma', ':assets']) || {} }, - chat() { - return this.settings.description.find(setting => setting.key === ':chat') - }, - chatData() { - return _.get(this.settings.settings, [':pleroma', ':chat']) || {} - }, frontend() { return this.settings.description.find(setting => setting.key === ':frontend_configurations') }, diff --git a/src/views/settings/components/tabs.js b/src/views/settings/components/tabs.js index 19dccb91..a0e4d0e9 100644 --- a/src/views/settings/components/tabs.js +++ b/src/views/settings/components/tabs.js @@ -8,10 +8,6 @@ export const tabs = description => { label: 'settings.auth', settings: [':auth', ':ldap', ':oauth2', 'Pleroma.Web.Auth.Authenticator'] }, - 'esshd': { - label: 'settings.esshd', - settings: [':esshd'] - }, 'captcha': { label: 'settings.captcha', settings: ['Pleroma.Captcha', 'Pleroma.Captcha.Kocaptcha'] @@ -22,11 +18,7 @@ export const tabs = description => { }, 'frontend': { label: 'settings.frontend', - settings: [':assets', ':chat', ':frontends', ':emoji', ':frontend_configurations', ':markup', ':static_fe', 'Pleroma.Web.Preload'] - }, - 'gopher': { - label: 'settings.gopher', - settings: [':gopher'] + settings: [':assets', ':frontends', ':emoji', ':frontend_configurations', ':markup', ':static_fe', 'Pleroma.Web.Preload'] }, 'http': { label: 'settings.http', diff --git a/src/views/users/show.vue b/src/views/users/show.vue index 5d0e5f54..04f014df 100644 --- a/src/views/users/show.vue +++ b/src/views/users/show.vue @@ -110,40 +110,6 @@ :visible="securitySettingsModalVisible" @close="securitySettingsModalVisible = false" /> - -

{{ $t('userProfile.chats') }}

-
- - - - {{ $t('userProfile.noChats') }} - - - - - -
- -
- - - - - - -
-
- {{ chat.last_message.content }} -
-
-
-
-

{{ $t('userProfile.recentStatuses') }}

@@ -197,12 +163,6 @@ export default { statusesLoading() { return this.$store.state.userProfile.statusesLoading }, - chats() { - return this.$store.state.userProfile.chats - }, - chatsLoading() { - return this.$store.state.userProfile.chatsLoading - }, user() { return this.$store.state.userProfile.user }, @@ -369,11 +329,6 @@ table { width: auto; margin-bottom: 20px; } -.user-chats-card { - width: auto; - height: fit-content; - margin-bottom: 20px; -} .user-profile-container { display: flex; } @@ -381,9 +336,6 @@ table { margin: 0; width: inherit; } -.user-chats-table { - width: 100%; -} .user-profile-tag { margin: 0 4px 4px 0; } @@ -392,27 +344,6 @@ table { font-weight: bold; margin: 5px 0; } -.chat-card-header { - display: flex; - align-items: center; -} -.chat-avatar-img { - display: inline-block; - width: 15px; - height: 15px; - margin-right: 5px; -} -.chat-account-name { - display: inline-block; - margin: 0; - font-size: 15px; - font-weight: 500; -} -.chat-card-preview { - color: gray; - font-style: italic; - margin: 5px 0 0 20px; -} @media only screen and (max-width:480px) { .avatar-name-container { @@ -451,7 +382,7 @@ table { margin: 0 15px 15px 10px; } } - .user-profile-card, .user-chats-card { + .user-profile-card { margin: 0 10px 20px; width: 95%; td { diff --git a/test/views/chats/show.test.js b/test/views/chats/show.test.js deleted file mode 100644 index 5dd7e4ec..00000000 --- a/test/views/chats/show.test.js +++ /dev/null @@ -1,51 +0,0 @@ -import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' -import flushPromises from 'flush-promises' -import Element from 'element-ui' -import ChatShow from '@/views/chats/show' -import { storeConfig } from './store.conf' -import { cloneDeep } from 'lodash' - -config.mocks["$t"] = () => {} - -const localVue = createLocalVue() -localVue.use(Vuex) -localVue.use(Element) - -const $route = { - params: { - id: '9y8e7ESoVUiKVMAoCW' - } -} - -jest.mock('@/api/nodeInfo') -jest.mock('@/api/chat') - -describe('Chat view', () => { - let store - - beforeEach(() => { - store = new Vuex.Store(cloneDeep(storeConfig)) - }) - - it('fetches chat messages', async (done) => { - const wrapper = mount(ChatShow, { - store, - localVue, - sync: false, - stubs: ['router-link'], - mocks: { - $route - } - }) - - await flushPromises() - expect(wrapper.find('.message-card').isVisible()).toBe(true) - expect(wrapper.find('.chat-particiants-sender').isVisible()).toBe(true) - expect(wrapper.find('.chat-particiants-receiver').isVisible()).toBe(true) - expect(store.state.chat.fetchedChat.receiver.acct).toBe('test10') - expect(store.state.chat.fetchedChatMessages[0].chat_id).toBe('9y8e7ESoVUiKVMAoCW') - expect(store.state.chat.maxId).toBe(null) - done() - }) -}) diff --git a/test/views/chats/store.conf.js b/test/views/chats/store.conf.js deleted file mode 100644 index 91fd28c4..00000000 --- a/test/views/chats/store.conf.js +++ /dev/null @@ -1,25 +0,0 @@ -import app from '@/store/modules/app' -import settings from '@/store/modules/settings' -import user from '@/store/modules/user' -import chat from '@/store/modules/chat' -import getters from '@/store/getters' - -export const storeConfig = { - modules: { - app, - settings, - user, - chat - }, - getters -} - -export const storeWithTagPolicy = { - modules: { - app, - settings, - user, - chat - }, - getters -}