diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 4895f36f..8aef7e8a 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -46,6 +46,18 @@ +
+ + + + + + +
@@ -113,6 +125,16 @@ store.state.api.backendInteractor.unfollowUser(this.user.id) .then((unfollowedUser) => store.commit('addNewUsers', [unfollowedUser])) }, + blockUser () { + const store = this.$store + store.state.api.backendInteractor.blockUser(this.user.id) + .then((blockedUser) => store.commit('addNewUsers', [blockedUser])) + }, + unblockUser () { + const store = this.$store + store.state.api.backendInteractor.unblockUser(this.user.id) + .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser])) + }, toggleMute () { const store = this.$store store.commit('setMuted', {user: this.user, muted: !this.user.muted}) diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 43bded78..7bdd003a 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -125,6 +125,8 @@ const en = { follows_you: 'Follows you!', following: 'Following!', follow: 'Follow', + blocked: 'Blocked!', + block: 'Block', statuses: 'Statuses', mute: 'Mute', muted: 'Muted', @@ -163,7 +165,7 @@ const en = { reply_link_preview: 'Enable reply-link preview on mouse hover' }, notifications: { - notifications: 'Notfications', + notifications: 'Notifications', read: 'Read!', followed_you: 'followed you' }, @@ -288,12 +290,130 @@ const ja = { } } +const fr = { + nav: { + timeline: 'Journal', + mentions: 'Notifications', + public_tl: 'Statuts Locaux', + twkn: 'Le Réseau Tout Entier' + }, + user_card: { + follows_you: 'Vous Suit!', + following: 'Suivis!', + follow: 'Suivi', + statuses: 'Statuts', + mute: 'En Sourdine', + muted: 'Mis En Sourdine', + followers: 'Vous Suivent', + followees: 'Suivis', + per_day: 'par jour' + }, + timeline: { + show_new: 'Afficher plus', + error_fetching: 'Erreur en cherchant des mises à jours', + up_to_date: 'A jour', + load_older: 'Afficher plus' + }, + settings: { + user_settings: 'Paramètres Utilisateur', + name_bio: 'Nom & Bio', + name: 'Nom', + bio: 'Bio', + avatar: 'Avatar', + current_avatar: 'Votre avatar', + set_new_avatar: 'Changer d\'avatar', + profile_banner: 'Couverture du Profil', + current_profile_banner: 'Couverture du Profil', + set_new_profile_banner: 'Nouvelle couverture', + profile_background: 'Image de fond', + set_new_profile_background: 'Nouvelle image de fond', + settings: 'Paramètres', + theme: 'Thème', + filtering: 'Filtre', + filtering_explanation: 'Tout les statuts contenant ces mots vont être mis sous silence, un mot par ligne.', + attachments: 'Pièces jointes', + hide_attachments_in_tl: 'Cacher les pièces jointes dans le journal', + hide_attachments_in_convo: 'Cacher les pièces jointes dans les conversations', + nsfw_clickthrough: 'Activer le clic pour afficher les images taggées NSFW', + autoload: 'Activer le chargement automatique une fois le bas de la page atteint', + reply_link_preview: 'Activer un preview sur passage de la souris' + }, + notifications: { + notifications: 'Notfications', + read: 'Lu!', + followed_you: 'vous a suivi' + }, + general: { + submit: 'Envoyer' + } +} + +const it = { + nav: { + timeline: 'Sequenza temporale', + mentions: 'Menzioni', + public_tl: 'Sequenza temporale pubblica', + twkn: 'L\'intiera rete conosciuta' + }, + user_card: { + follows_you: 'Ti segue!', + following: 'Lo stai seguendo!', + follow: 'Segui', + statuses: 'Messaggi', + mute: 'Ammutolisci', + muted: 'Ammutoliti', + followers: 'Chi ti segue', + followees: 'Chi stai seguendo', + per_day: 'al giorno' + }, + timeline: { + show_new: 'Mostra nuovi', + error_fetching: 'Errori nel prelievo aggiornamenti', + up_to_date: 'Aggiornato', + load_older: 'Carica messaggi più vecchi' + }, + settings: { + user_settings: 'Configurazione dell\'utente', + name_bio: 'Nome & Introduzione', + name: 'Nome', + bio: 'Introduzione', + avatar: 'Avatar', + current_avatar: 'Il tuo attuale avatar', + set_new_avatar: 'Scegli un nuovo avatar', + profile_banner: 'Sfondo del tuo profilo', + current_profile_banner: 'Sfondo attuale', + set_new_profile_banner: 'Scegli un nuovo sfondo per il tuo profilo', + profile_background: 'Sfondo della tua pagina', + set_new_profile_background: 'Scegli un nuovo sfondo per la tua pagina', + settings: 'Settaggi', + theme: 'Tema', + filtering: 'Filtri', + filtering_explanation: 'Filtra via le notifiche che contengono le seguenti parole (inserisci rigo per rigo le parole di innesco)', + attachments: 'Allegati', + hide_attachments_in_tl: 'Nascondi gli allegati presenti nella sequenza temporale', + hide_attachments_in_convo: 'Nascondi gli allegati presenti nelle conversazioni', + nsfw_clickthrough: 'Abilita la trasparenza degli allegati NSFW', + autoload: 'Abilita caricamento automatico quando si raggiunge il fondo schermo', + reply_link_preview: 'Ability il reply-link preview al passaggio del mouse' + }, + notifications: { + notifications: 'Notifiche', + read: 'Leggi!', + followed_you: 'ti ha seguito' + }, + general: { + submit: 'Invia' + } +} + const messages = { de, fi, en, hu, - ja + ja, + fr, + it } export default messages diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index a1c6b657..5abaea7e 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -26,6 +26,8 @@ const BANNER_UPDATE_URL = '/api/account/update_profile_banner.json' const PROFILE_UPDATE_URL = '/api/account/update_profile.json' const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json' const QVITTER_USER_TIMELINE_URL = '/api/qvitter/statuses/user_timeline.json' +const BLOCKING_URL = '/api/blocks/create.json' +const UNBLOCKING_URL = '/api/blocks/destroy.json' // const USER_URL = '/api/users/show.json' import { each, map } from 'lodash' @@ -184,6 +186,22 @@ const unfollowUser = ({id, credentials}) => { }).then((data) => data.json()) } +const blockUser = ({id, credentials}) => { + let url = `${BLOCKING_URL}?user_id=${id}` + return fetch(url, { + headers: authHeaders(credentials), + method: 'POST' + }).then((data) => data.json()) +} + +const unblockUser = ({id, credentials}) => { + let url = `${UNBLOCKING_URL}?user_id=${id}` + return fetch(url, { + headers: authHeaders(credentials), + method: 'POST' + }).then((data) => data.json()) +} + const fetchFriends = ({id, credentials}) => { let url = `${FRIENDS_URL}?user_id=${id}` return fetch(url, { headers: authHeaders(credentials) }) @@ -343,6 +361,8 @@ const apiService = { fetchFollowers, followUser, unfollowUser, + blockUser, + unblockUser, favorite, unfavorite, retweet, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index a99ea38a..51a46e45 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -30,6 +30,14 @@ const backendInteractorService = (credentials) => { return apiService.unfollowUser({credentials, id}) } + const blockUser = (id) => { + return apiService.blockUser({credentials, id}) + } + + const unblockUser = (id) => { + return apiService.unblockUser({credentials, id}) + } + const startFetching = ({timeline, store, userId = false}) => { return timelineFetcherService.startFetching({timeline, store, credentials, userId}) } @@ -55,6 +63,8 @@ const backendInteractorService = (credentials) => { fetchFollowers, followUser, unfollowUser, + blockUser, + unblockUser, fetchAllFollowing, verifyCredentials: apiService.verifyCredentials, startFetching,