From fe500c44ed846514140d7f8c4b55fb653aeec6f2 Mon Sep 17 00:00:00 2001 From: Exilat Date: Sun, 30 Jun 2019 14:24:34 +0000 Subject: [PATCH 01/19] Update oc.json --- src/i18n/oc.json | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/i18n/oc.json b/src/i18n/oc.json index ec7f5740f..6100a4d27 100644 --- a/src/i18n/oc.json +++ b/src/i18n/oc.json @@ -78,6 +78,20 @@ "repeated_you": "a repetit vòstre estatut", "no_more_notifications": "Pas mai de notificacions" }, + "polls": { +"add_poll": "Ajustar un sondatge", + "add_option": "Ajustar d’opcions", + "option": "Opcion", + "votes": "vòtes", + "vote": "Votar", + "type": "Tipe de sondatge", + "single_choice": "Causida unica", + "multiple_choices": "Causida multipla", + "expiry": "Durada del sondatge", + "expires_in": "Lo sondatge s’acabarà {0}", + "expired": "Sondatge acabat {0}", + "not_enough_options": "I a pas pro d’opcions" + }, "post_status": { "new_status": "Publicar d’estatuts novèls", "account_not_locked_warning": "Vòstre compte es pas {0}. Qual que siá pòt vos seguir per veire vòstras publicacions destinadas pas qu’a vòstres seguidors.", @@ -197,6 +211,7 @@ "loop_video": "Bocla vidèo", "loop_video_silent_only": "Legir en bocla solament las vidèos sens son (coma los « Gifs » de Mastodon)", "mutes_tab": "Agamats", + "interactions_tab": "Interaccions", "play_videos_in_modal": "Legir las vidèos dirèctament dins la visualizaira mèdia", "use_contain_fit": "Talhar pas las pèças juntas per las vinhetas", "name": "Nom", @@ -264,8 +279,15 @@ "false": "non", "true": "òc" }, - "notifications": "Notificacions", - "enable_web_push_notifications": "Activar las notificacions web push", + "notifications": "Notificacions", + "notification_setting": "Receber las notificacions de :", + "notification_setting_follows": "Utilizaires que seguissètz", + "notification_setting_non_follows": "Utilizaires que seguissètz pas", + "notification_setting_followers": "Utilizaires que vos seguisson", + "notification_setting_non_followers": "Utilizaires que vos seguisson pas", + "notification_mutes": "Per receber pas mai d’un utilizaire en particular, botatz-lo en silenci.", + "notification_blocks": "Blocar un utilizaire arrèsta totas las notificacions tan coma quitar de los seguir.", + "enable_web_push_notifications": "Activar las notificacions web push", "style": { "switcher": { "keep_color": "Gardar las colors", @@ -386,14 +408,14 @@ "days": "{0} jorns", "day_short": "{0} jorn", "days_short": "{0} jorns", - "hour": "{0} hour", - "hours": "{0} hours", + "hour": "{0} ora", + "hours": "{0} oras", "hour_short": "{0}h", "hours_short": "{0}h", - "in_future": "in {0}", + "in_future": "d’aquí {0}", "in_past": "fa {0}", - "minute": "{0} minute", - "minutes": "{0} minutes", + "minute": "{0} minuta", + "minutes": "{0} minutas", "minute_short": "{0}min", "minutes_short": "{0}min", "month": "{0} mes", @@ -402,12 +424,12 @@ "months_short": "{0} meses", "now": "ara meteis", "now_short": "ara meteis", - "second": "{0} second", - "seconds": "{0} seconds", + "second": "{0} segonda", + "seconds": "{0} segondas", "second_short": "{0}s", "seconds_short": "{0}s", - "week": "{0} setm.", - "weeks": "{0} setm.", + "week": "{0} setmana.", + "weeks": "{0} setmanas.", "week_short": "{0} setm.", "weeks_short": "{0} setm.", "year": "{0} an", From 52319acf5894ac65f38a42f05b605eb7f961bec9 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 2 Jul 2019 15:33:40 +0700 Subject: [PATCH 02/19] Revoke oAuth token --- config/index.js | 5 +++++ src/modules/users.js | 37 +++++++++++++++++++++++++++-------- src/services/new_api/oauth.js | 17 +++++++++++++++- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/config/index.js b/config/index.js index 56fa59405..821d6d032 100644 --- a/config/index.js +++ b/config/index.js @@ -48,6 +48,11 @@ module.exports = { changeOrigin: true, cookieDomainRewrite: 'localhost', ws: true + }, + '/oauth/revoke': { + target: 'http://localhost:4000/', + changeOrigin: true, + cookieDomainRewrite: 'localhost' } }, // CSS Sourcemaps off by default because relative paths are "buggy" diff --git a/src/modules/users.js b/src/modules/users.js index 1e0b16f59..dd3a8f3c5 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -1,5 +1,6 @@ import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' import userSearchApi from '../services/new_api/user_search.js' +import oauthApi from '../services/new_api/oauth.js' import { compact, map, each, merge, last, concat, uniq } from 'lodash' import { set } from 'vue' import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js' @@ -397,14 +398,34 @@ const users = { }, logout (store) { - store.commit('clearCurrentUser') - store.dispatch('disconnectFromChat') - store.commit('clearToken') - store.dispatch('stopFetching', 'friends') - store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken())) - store.dispatch('stopFetching', 'notifications') - store.commit('clearNotifications') - store.commit('resetStatuses') + const { oauth, instance } = store.rootState + + const data = { + ...oauth, + commit: store.commit, + instance: instance.server + } + + return oauthApi.getOrCreateApp(data) + .then((app) => { + const params = { + app, + instance: data.instance, + token: oauth.userToken + } + + return oauthApi.revokeToken(params) + }) + .then(() => { + store.commit('clearCurrentUser') + store.dispatch('disconnectFromChat') + store.commit('clearToken') + store.dispatch('stopFetching', 'friends') + store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken())) + store.dispatch('stopFetching', 'notifications') + store.commit('clearNotifications') + store.commit('resetStatuses') + }) }, loginUser (store, accessToken) { return new Promise((resolve, reject) => { diff --git a/src/services/new_api/oauth.js b/src/services/new_api/oauth.js index 030e99801..663531ab1 100644 --- a/src/services/new_api/oauth.js +++ b/src/services/new_api/oauth.js @@ -125,13 +125,28 @@ const verifyRecoveryCode = ({app, instance, mfaToken, code}) => { }).then((data) => data.json()) } +const revokeToken = ({ app, instance, token }) => { + const url = `${instance}/oauth/revoke` + const form = new window.FormData() + + form.append('client_id', app.clientId) + form.append('client_secret', app.clientSecret) + form.append('token', token) + + return window.fetch(url, { + method: 'POST', + body: form + }).then((data) => data.json()) +} + const oauth = { login, getToken, getTokenWithCredentials, getOrCreateApp, verifyOTPCode, - verifyRecoveryCode + verifyRecoveryCode, + revokeToken } export default oauth From 0e9b8be88caa8bb21891b2be5fe2eb1333aed345 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Jul 2019 14:32:46 -0400 Subject: [PATCH 03/19] clear userId property of timeline by default in clearTimeline action --- src/components/timeline/timeline.js | 2 +- src/modules/statuses.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 9dafcbd8f..b1c7edf80 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -86,7 +86,7 @@ const Timeline = { if (this.newStatusCount === 0) return if (this.timeline.flushMarker !== 0) { - this.$store.commit('clearTimeline', { timeline: this.timelineName }) + this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true }) this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 }) this.fetchOlderStatuses() } else { diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 9b11a13e0..e58a9b4c1 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -395,8 +395,9 @@ export const mutations = { state[key] = value }) }, - clearTimeline (state, { timeline }) { - state.timelines[timeline] = emptyTl(state.timelines[timeline].userId) + clearTimeline (state, { timeline, excludeUserId = false }) { + const userId = excludeUserId ? state.timelines[timeline].userId : undefined + state.timelines[timeline] = emptyTl(userId) }, clearNotifications (state) { state.notifications = emptyNotifications() From b70c2bfef756a398305c7933f0b6906be4432e4c Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Jul 2019 14:43:01 -0400 Subject: [PATCH 04/19] make sure that user timelines are empty when opening profile page --- src/components/user_profile/user_profile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index eab330e7d..7eb4ed3ab 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -31,6 +31,8 @@ const UserProfile = { } }, created () { + // Make sure that timelines used in this page are empty + this.cleanUp() const routeParams = this.$route.params this.load(routeParams.name || routeParams.id) }, From d8e210df4d3f6e83c1fa0fc9b893b825cec45da4 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Jul 2019 15:07:18 -0400 Subject: [PATCH 05/19] update test for clearTimeline action --- test/unit/specs/modules/statuses.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js index 0bbcb25a3..e4661e2a1 100644 --- a/test/unit/specs/modules/statuses.spec.js +++ b/test/unit/specs/modules/statuses.spec.js @@ -258,11 +258,11 @@ describe('Statuses module', () => { }) describe('clearTimeline', () => { - it('keeps userId when clearing user timeline', () => { + it('keeps userId when clearing user timeline when excludeUserId param is true', () => { const state = defaultState() state.timelines.user.userId = 123 - mutations.clearTimeline(state, { timeline: 'user' }) + mutations.clearTimeline(state, { timeline: 'user', excludeUserId: true }) expect(state.timelines.user.userId).to.eql(123) }) From 0c102deeed91442999bbb9522e071b478d6388b0 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Jul 2019 16:36:14 -0400 Subject: [PATCH 06/19] hide text format when only plaintext is available --- src/components/post_status_form/post_status_form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 67cdc7218..505fd25e3 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -84,7 +84,7 @@ -
+
{{$t(`post_status.content_type["${postFormats[0]}"]`)}} From 6c6aa8446db6f6bab3240e96f82492e527ba4443 Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 3 Jul 2019 12:19:25 -0400 Subject: [PATCH 07/19] place scope selector on the left consistently --- .../post_status_form/post_status_form.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 505fd25e3..52d1b43ce 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -74,6 +74,13 @@

+ +