diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a873ae..45eb0a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +### Fixed + +- Fix following and unfollowing relays from Admin-FE, update mobile UI + ## [2.1] - 2020-08-14 ### Added diff --git a/src/api/relays.js b/src/api/relays.js index 3be0188d..7891917e 100644 --- a/src/api/relays.js +++ b/src/api/relays.js @@ -11,23 +11,23 @@ export async function fetchRelays(authHost, token) { }) } -export async function addRelay(relay, authHost, token) { +export async function addRelay(relay_url, authHost, token) { return await request({ baseURL: baseName(authHost), url: '/api/pleroma/admin/relay', method: 'post', headers: authHeaders(token), - data: { relay_url: relay } + data: { relay_url } }) } -export async function deleteRelay(relay, authHost, token) { +export async function deleteRelay(relay_url, authHost, token) { return await request({ baseURL: baseName(authHost), url: '/api/pleroma/admin/relay', method: 'delete', headers: authHeaders(token), - data: { relay_url: `https://${relay}/actor` } + data: { relay_url } }) } diff --git a/src/lang/en.js b/src/lang/en.js index 2008aec8..8e9629b2 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -150,7 +150,8 @@ export default { draft: 'Draft', delete: 'Delete', cancel: 'Cancel', - confirm: 'Confirm' + confirm: 'Confirm', + unfollow: 'Unfollow' }, errorLog: { tips: 'Please click the bug icon in the upper right corner', @@ -406,6 +407,7 @@ export default { relays: 'Relays', follow: 'Follow', followRelay: 'Follow new relay', + followedBack: 'Followed Back', instanceUrl: 'Instance URL', success: 'Settings changed successfully!', description: 'Description', diff --git a/src/store/modules/relays.js b/src/store/modules/relays.js index 3a0d15cc..2d611c0e 100644 --- a/src/store/modules/relays.js +++ b/src/store/modules/relays.js @@ -13,19 +13,18 @@ const relays = { state.fetchedRelays = relays }, ADD_RELAY: (state, relay) => { - state.fetchedRelays = [...state.fetchedRelays, relay] + state.fetchedRelays = [...state.fetchedRelays, { actor: relay }] }, DELETE_RELAY: (state, relay) => { - state.fetchedRelays = state.fetchedRelays.filter(fetchedRelay => fetchedRelay !== relay) + state.fetchedRelays = state.fetchedRelays.filter(fetchedRelay => fetchedRelay.actor !== relay) } }, actions: { async FetchRelays({ commit, getters }) { commit('SET_LOADING', true) - const response = await fetchRelays(getters.authHost, getters.token) - - commit('SET_RELAYS', response.data.relays) + const { data } = await fetchRelays(getters.authHost, getters.token) + commit('SET_RELAYS', data.relays) commit('SET_LOADING', false) }, async AddRelay({ commit, dispatch, getters }, relay) { diff --git a/src/views/settings/components/Relays.vue b/src/views/settings/components/Relays.vue index eb3ac264..4ac29042 100644 --- a/src/views/settings/components/Relays.vue +++ b/src/views/settings/components/Relays.vue @@ -2,19 +2,28 @@
- + - + prop="actor"/> + + + + @@ -31,16 +40,17 @@ export default { } }, computed: { - relays() { - return this.$store.state.relays.fetchedRelays + getLabelWidth() { + return this.isDesktop ? '130px' : '85px' }, - relaysTable() { - return this.relays.map(relay => { - return { instance: relay } - }) + isDesktop() { + return this.$store.state.app.device === 'desktop' }, loading() { return this.$store.state.relays.loading + }, + relays() { + return this.$store.state.relays.fetchedRelays } }, mounted() { @@ -49,6 +59,7 @@ export default { methods: { followRelay() { this.$store.dispatch('AddRelay', this.newRelay) + this.newRelay = '' }, deleteRelay(relay) { this.$store.dispatch('DeleteRelay', relay) diff --git a/src/views/settings/styles/main.scss b/src/views/settings/styles/main.scss index 4cecb962..551e99e5 100644 --- a/src/views/settings/styles/main.scss +++ b/src/views/settings/styles/main.scss @@ -431,7 +431,7 @@ height: 2px; } .follow-relay { - width: 70%; + width: 75%; margin-right: 5px; input { width: 100%; @@ -440,6 +440,7 @@ .follow-relay-container { display: flex; justify-content: space-between; + margin: 0 5px; } h1 { font-size: 24px;