From 533597fe259344c763ea06f8be71f34491c4d4e9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 21 Feb 2019 19:52:58 +0200 Subject: [PATCH 01/29] bad defaults --- src/modules/instance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/instance.js b/src/modules/instance.js index 59c6b91c7..c31d02b97 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -21,7 +21,7 @@ const defaultState = { collapseMessageWithSubject: false, hidePostStats: false, hideUserStats: false, - hideFilteredStatuses: true, + hideFilteredStatuses: false, disableChat: false, scopeCopy: true, subjectLineBehavior: 'email', From 2d453e635572dd640d4f5e1ecd7837b5874bd250 Mon Sep 17 00:00:00 2001 From: Shpuld Shpludson Date: Thu, 21 Feb 2019 17:06:10 +0000 Subject: [PATCH 02/29] Merge branch 'issue-383-content-type' into 'develop' #383: content type error Closes #383 See merge request pleroma/pleroma-fe!603 (cherry picked from commit 254b0afab747ad6e67b675bdf233b9dfcbc59f0b) 09822cc1 #383: content type error --- src/components/post_status_form/post_status_form.js | 12 ++++++------ src/components/post_status_form/post_status_form.vue | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index ab379c233..c28c51bf4 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -56,6 +56,10 @@ const PostStatusForm = { ? this.copyMessageScope : this.$store.state.users.currentUser.default_scope + const contentType = typeof this.$store.state.config.postContentType === 'undefined' + ? this.$store.state.instance.postContentType + : this.$store.state.config.postContentType + return { dropFiles: [], submitDisabled: false, @@ -67,7 +71,8 @@ const PostStatusForm = { status: statusText, nsfw: false, files: [], - visibility: scope + visibility: scope, + contentType }, caret: 0 } @@ -166,11 +171,6 @@ const PostStatusForm = { }, formattingOptionsEnabled () { return this.$store.state.instance.formattingOptionsEnabled - }, - defaultPostContentType () { - return typeof this.$store.state.config.postContentType === 'undefined' - ? this.$store.state.instance.postContentType - : this.$store.state.config.postContentType } }, methods: { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 6ed5d92e0..e09ad37f5 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -35,7 +35,7 @@
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 423589fa8..adf119076 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -92,7 +92,7 @@

+ > {{ $t('settings.hide_followers_description') }}

From 1d2ddaf2d06281e6769a1ca8f265ff8e620eb90e Mon Sep 17 00:00:00 2001 From: DYM Date: Wed, 30 Oct 2019 03:15:57 +0000 Subject: [PATCH 06/29] profile-banner rounding css, fixes #690 --- src/components/user_card/user_card.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 2755d89bd..6f3c958e7 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -276,6 +276,8 @@ mask-composite: exclude; background-size: cover; mask-size: 100% 60%; + border-top-left-radius: calc(var(--panelRadius) - 1px); + border-top-right-radius: calc(var(--panelRadius) - 1px); &.hide-bio { mask-size: 100% 40px; From 28524ab4a6c72d73292fc75d029ac1ed2969ca17 Mon Sep 17 00:00:00 2001 From: Tarteka Date: Wed, 30 Oct 2019 22:31:55 +0100 Subject: [PATCH 07/29] eu-translate update --- src/i18n/eu.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/eu.json b/src/i18n/eu.json index 90bc13a48..1c75bf754 100644 --- a/src/i18n/eu.json +++ b/src/i18n/eu.json @@ -558,6 +558,8 @@ "unmute": "Isiltasuna kendu", "unmute_progress": "Isiltasuna kentzen...", "mute_progress": "Isiltzen...", + "hide_repeats": "Ezkutatu errepikapenak", + "show_repeats": "Erakutsi errpekiapenak", "admin_menu": { "moderation": "Moderazioa", "grant_admin": "Administratzaile baimena", @@ -633,6 +635,8 @@ "return_home": "Itzuli hasierara", "not_found": "Ezin izan dugu helbide elektroniko edo erabiltzaile hori aurkitu.", "too_many_requests": "Saiakera gehiegi burutu ditzu, saiatu berriro geroxeago.", - "password_reset_disabled": "Pasahitza berrezartzea debekatuta dago. Mesedez, jarri harremanetan instantzia administratzailearekin." + "password_reset_disabled": "Pasahitza berrezartzea debekatuta dago. Mesedez, jarri harremanetan instantzia administratzailearekin.", + "password_reset_required": "Pasahitza berrezarri behar duzu saioa hasteko.", + "password_reset_required_but_mailer_is_disabled": "Pasahitza berrezarri behar duzu, baina pasahitza berrezartzeko aukera desgaituta dago. Mesedez, jarri harremanetan instantziaren administratzailearekin." } } \ No newline at end of file From 18acc7af294a1d8989b3c0ba8b882dee2a265c16 Mon Sep 17 00:00:00 2001 From: Matrix-Sasuke Date: Fri, 8 Nov 2019 01:29:01 +0000 Subject: [PATCH 08/29] translations-de-batch-1 --- src/i18n/de.json | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/i18n/de.json b/src/i18n/de.json index fa9db16c7..a4b4c16f2 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -5,11 +5,11 @@ "features_panel": { "chat": "Chat", "gopher": "Gopher", - "media_proxy": "Media Proxy", + "media_proxy": "Medienproxy", "scope_options": "Reichweitenoptionen", "text_limit": "Textlimit", "title": "Features", - "who_to_follow": "Who to follow" + "who_to_follow": "Wem folgen?" }, "finder": { "error_fetching_user": "Fehler beim Suchen des Benutzers", @@ -29,15 +29,18 @@ "username": "Benutzername" }, "nav": { + "about": "Über", "back": "Zurück", "chat": "Lokaler Chat", "friend_requests": "Followanfragen", "mentions": "Erwähnungen", + "interactions": "Interaktionen", "dms": "Direktnachrichten", "public_tl": "Öffentliche Zeitleiste", "timeline": "Zeitleiste", "twkn": "Das gesamte bekannte Netzwerk", "user_search": "Benutzersuche", + "search": "Suche", "preferences": "Voreinstellungen" }, "notifications": { @@ -115,6 +118,9 @@ "delete_account_description": "Lösche deinen Account und alle deine Nachrichten unwiderruflich.", "delete_account_error": "Es ist ein Fehler beim Löschen deines Accounts aufgetreten. Tritt dies weiterhin auf, wende dich an den Administrator der Instanz.", "delete_account_instructions": "Tippe dein Passwort unten in das Feld ein, um die Löschung deines Accounts zu bestätigen.", + "discoverable": "Erlaubnis für automatisches Suchen nach diesem Account", + "avatar_size_instruction": "Die empfohlene minimale Größe für Avatare ist 150x150 Pixel.", + "pad_emoji": "Emojis mit Leerzeichen umrahmen", "export_theme": "Farbschema speichern", "filtering": "Filtern", "filtering_explanation": "Alle Beiträge die diese Wörter enthalten werden ausgeblendet. Ein Wort pro Zeile.", @@ -128,8 +134,11 @@ "general": "Allgemein", "hide_attachments_in_convo": "Anhänge in Unterhaltungen ausblenden", "hide_attachments_in_tl": "Anhänge in der Zeitleiste ausblenden", + "hide_muted_posts": "Verberge Beiträge stummgeschalteter Nutzer", + "max_thumbnails": "Maximale Anzahl von Vorschaubildern pro Beitrag", "hide_isp": "Instanz-spezifisches Panel ausblenden", "preload_images": "Bilder vorausladen", + "use_one_click_nsfw": "Heikle Anhänge mit nur einem Klick öffnen", "hide_post_stats": "Beitragsstatistiken verbergen (z.B. die Anzahl der Favoriten)", "hide_user_stats": "Benutzerstatistiken verbergen (z.B. die Anzahl der Follower)", "hide_filtered_statuses": "Gefilterte Beiträge verbergen", @@ -147,6 +156,9 @@ "lock_account_description": "Sperre deinen Account, um neue Follower zu genehmigen oder abzulehnen", "loop_video": "Videos wiederholen", "loop_video_silent_only": "Nur Videos ohne Ton wiederholen (z.B. Mastodons \"gifs\")", + "mutes_tab": "Mutes", + "play_videos_in_modal": "Videos in größerem Medienfenster abspielen", + "use_contain_fit": "Vorschaubilder nicht zuschneiden", "name": "Name", "name_bio": "Name & Bio", "new_password": "Neues Passwort", @@ -158,6 +170,8 @@ "no_rich_text_description": "Rich-Text Formatierungen von allen Beiträgen entfernen", "hide_follows_description": "Zeige nicht, wem ich folge", "hide_followers_description": "Zeige nicht, wer mir folgt", + "hide_follows_count_description": "Verberge die Anzahl deiner Gefolgten", + "hide_followers_count_description": "Verberge die Anzahl deiner Folgenden", "nsfw_clickthrough": "Aktiviere ausblendbares Overlay für Anhänge, die als NSFW markiert sind", "oauth_tokens": "OAuth-Token", "token": "Zeichen", @@ -176,10 +190,12 @@ "reply_visibility_all": "Alle Antworten zeigen", "reply_visibility_following": "Zeige nur Antworten an mich oder an Benutzer, denen ich folge", "reply_visibility_self": "Nur Antworten an mich anzeigen", + "autohide_floating_post_button": "Automatisches Verbergen des Knopfs für neue Beiträge (mobil)", "saving_err": "Fehler beim Speichern der Einstellungen", "saving_ok": "Einstellungen gespeichert", "security_tab": "Sicherheit", "scope_copy": "Reichweite beim Antworten übernehmen (Direktnachrichten werden immer kopiert)", + "minimal_scopes_mode": "Minimiere Reichweitenoptionen", "set_new_avatar": "Setze einen neuen Avatar", "set_new_profile_background": "Setze einen neuen Hintergrund für dein Profil", "set_new_profile_banner": "Setze einen neuen Banner für dein Profil", @@ -189,7 +205,8 @@ "subject_line_email": "Wie Email: \"re: Betreff\"", "subject_line_mastodon": "Wie Mastodon: unverändert kopieren", "subject_line_noop": "Nicht kopieren", - "stop_gifs": "Play-on-hover GIFs", + "post_status_content_type": "Beitragsart", + "stop_gifs": "Animationen nur beim Darüberfahren abspielen", "streaming": "Aktiviere automatisches Laden (Streaming) von neuen Beiträgen", "text": "Text", "theme": "Farbschema", @@ -372,5 +389,25 @@ "GiB": "GiB", "TiB": "TiB" } + }, + "search": { + "people": "Leute", + "hashtags": "Hashtags", + "person_talking": "{count} Person spricht darüber", + "people_talking": "{count} Leute sprechen darüber", + "no_results": "Keine Ergebnisse" + }, + "password_reset": { + "forgot_password": "Passwort vergessen?", + "password_reset": "Password zurücksetzen", + "instruction": "Wenn du hier deinen Benutznamen oder die zugehörige E-Mail-Adresse eingibst, kann dir der Server einen Link zum Passwortzurücksetzen zuschicken.", + "placeholder": "Dein Benutzername oder die zugehörige E-Mail-Adresse", + "check_email": "Im E-Mail-Posteingang des angebenen Kontos müsste sich jetzt (oder zumindest in Kürze) die E-Mail mit dem Link zum Passwortzurücksetzen befinden.", + "return_home": "Zurück zur Heimseite", + "not_found": "Benutzername/E-Mail-Adresse nicht gefunden. Vertippt?", + "too_many_requests": "Kurze Pause. Zu viele Versuche. Bitte, später nochmal probieren.", + "password_reset_disabled": "Passwortzurücksetzen deaktiviert. Bitte Administrator kontaktieren.", + "password_reset_required": "Passwortzurücksetzen erforderlich", + "password_reset_required_but_mailer_is_disabled": "Passwortzurücksetzen wäre erforderlich, ist aber deaktiviert. Bitte Administrator kontaktieren." } } From e3381cdef1b410aafce15f2d2f1caeccbfae7c87 Mon Sep 17 00:00:00 2001 From: Sergey Suprunenko Date: Fri, 8 Nov 2019 02:21:19 +0000 Subject: [PATCH 09/29] Add ability to change user's email --- CHANGELOG.md | 5 +-- src/components/user_settings/user_settings.js | 20 +++++++++++ .../user_settings/user_settings.vue | 35 ++++++++++++++++++- src/i18n/en.json | 4 +++ src/i18n/ru.json | 4 +++ src/services/api/api.service.js | 16 +++++++++ .../backend_interactor_service.js | 2 ++ 7 files changed, 83 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d08da09e5..2719edcf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,15 @@ # Changelog 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/), +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added - Ability to hide/show repeats from user -- User profile button clutter organized into a menu +- User profile button clutter organized into a menu - Emoji picker - Started changelog anew +- Ability to change user's email ### Changed - changed the way fading effects for user profile/long statuses works, now uses css-mask instead of gradient background hacks which weren't exactly compatible with semi-transparent themes ### Fixed diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 32eb802e6..3fdc53403 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -35,6 +35,7 @@ const MuteList = withSubscription({ const UserSettings = { data () { return { + newEmail: '', newName: this.$store.state.users.currentUser.name, newBio: unescape(this.$store.state.users.currentUser.description), newLocked: this.$store.state.users.currentUser.locked, @@ -56,6 +57,9 @@ const UserSettings = { backgroundPreview: null, bannerUploadError: null, backgroundUploadError: null, + changeEmailError: false, + changeEmailPassword: '', + changedEmail: false, deletingAccount: false, deleteAccountConfirmPasswordInput: '', deleteAccountError: false, @@ -305,6 +309,22 @@ const UserSettings = { } }) }, + changeEmail () { + const params = { + email: this.newEmail, + password: this.changeEmailPassword + } + this.$store.state.api.backendInteractor.changeEmail(params) + .then((res) => { + if (res.status === 'success') { + this.changedEmail = true + this.changeEmailError = false + } else { + this.changedEmail = false + this.changeEmailError = res.error + } + }) + }, activateTab (tabName) { this.activeTab = tabName }, diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index adf119076..8c18cf499 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -85,7 +85,7 @@ + > {{ $t('settings.hide_follows_count_description') }}

@@ -233,6 +233,39 @@
+
+

{{ $t('settings.change_email') }}

+
+

{{ $t('settings.new_email') }}

+ +
+
+

{{ $t('settings.current_password') }}

+ +
+ +

+ {{ $t('settings.changed_email') }} +

+ +
+

{{ $t('settings.change_password') }}

diff --git a/src/i18n/en.json b/src/i18n/en.json index d11b2d14e..7afe78576 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -217,6 +217,9 @@ "cGreen": "Green (Retweet)", "cOrange": "Orange (Favorite)", "cRed": "Red (Cancel)", + "change_email": "Change Email", + "change_email_error": "There was an issue changing your email.", + "changed_email": "Email changed successfully!", "change_password": "Change Password", "change_password_error": "There was an issue changing your password.", "changed_password": "Password changed successfully!", @@ -275,6 +278,7 @@ "use_contain_fit": "Don't crop the attachment in thumbnails", "name": "Name", "name_bio": "Name & Bio", + "new_email": "New Email", "new_password": "New password", "notification_visibility": "Types of notifications to show", "notification_visibility_follows": "Follows", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 16268425a..f8bcd9969 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -127,6 +127,9 @@ "cGreen": "Повторить", "cOrange": "Нравится", "cRed": "Отменить", + "change_email": "Сменить email", + "change_email_error": "Произошла ошибка при попытке изменить email.", + "changed_email": "Email изменён успешно.", "change_password": "Сменить пароль", "change_password_error": "Произошла ошибка при попытке изменить пароль.", "changed_password": "Пароль изменён успешно.", @@ -169,6 +172,7 @@ "loop_video_silent_only": "Зацикливать только беззвучные видео (т.е. \"гифки\" с Mastodon)", "name": "Имя", "name_bio": "Имя и описание", + "new_email": "Новый email", "new_password": "Новый пароль", "notification_visibility": "Показывать уведомления", "notification_visibility_follows": "Подписки", diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 61cd4f16f..68c4939a8 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -8,6 +8,7 @@ const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' +const CHANGE_EMAIL_URL = '/api/pleroma/change_email' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' const TAG_USER_URL = '/api/pleroma/admin/users/tag' const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}` @@ -691,6 +692,20 @@ const deleteAccount = ({ credentials, password }) => { .then((response) => response.json()) } +const changeEmail = ({ credentials, email, password }) => { + const form = new FormData() + + form.append('email', email) + form.append('password', password) + + return fetch(CHANGE_EMAIL_URL, { + body: form, + method: 'POST', + headers: authHeaders(credentials) + }) + .then((response) => response.json()) +} + const changePassword = ({ credentials, password, newPassword, newPasswordConfirmation }) => { const form = new FormData() @@ -966,6 +981,7 @@ const apiService = { importBlocks, importFollows, deleteAccount, + changeEmail, changePassword, settingsMFA, mfaDisableOTP, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index cbf48ee41..d6617276d 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -131,6 +131,7 @@ const backendInteractorService = credentials => { const importFollows = (file) => apiService.importFollows({ file, credentials }) const deleteAccount = ({ password }) => apiService.deleteAccount({ credentials, password }) + const changeEmail = ({ email, password }) => apiService.changeEmail({ credentials, email, password }) const changePassword = ({ password, newPassword, newPasswordConfirmation }) => apiService.changePassword({ credentials, password, newPassword, newPasswordConfirmation }) @@ -195,6 +196,7 @@ const backendInteractorService = credentials => { importBlocks, importFollows, deleteAccount, + changeEmail, changePassword, fetchSettingsMFA, generateMfaBackupCodes, From ded022a1d295d98413a2e7039e73a5d328ae7e9c Mon Sep 17 00:00:00 2001 From: Maksim Date: Fri, 8 Nov 2019 02:42:32 +0000 Subject: [PATCH 10/29] '/api/pleroma/profile/mfa' -> '/api/pleroma/accounts/mfa' --- src/services/api/api.service.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 68c4939a8..8f5eb4163 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -17,12 +17,12 @@ const ADMIN_USERS_URL = '/api/pleroma/admin/users' const SUGGESTIONS_URL = '/api/v1/suggestions' const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings' -const MFA_SETTINGS_URL = '/api/pleroma/profile/mfa' -const MFA_BACKUP_CODES_URL = '/api/pleroma/profile/mfa/backup_codes' +const MFA_SETTINGS_URL = '/api/pleroma/accounts/mfa' +const MFA_BACKUP_CODES_URL = '/api/pleroma/accounts/mfa/backup_codes' -const MFA_SETUP_OTP_URL = '/api/pleroma/profile/mfa/setup/totp' -const MFA_CONFIRM_OTP_URL = '/api/pleroma/profile/mfa/confirm/totp' -const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp' +const MFA_SETUP_OTP_URL = '/api/pleroma/accounts/mfa/setup/totp' +const MFA_CONFIRM_OTP_URL = '/api/pleroma/accounts/mfa/confirm/totp' +const MFA_DISABLE_OTP_URL = '/api/pleroma/account/mfa/totp' const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials' const MASTODON_REGISTRATION_URL = '/api/v1/accounts' From f66026bf20638662ab50b3982337fe69a8171cf3 Mon Sep 17 00:00:00 2001 From: Wyatt Benno Date: Fri, 8 Nov 2019 06:16:26 +0000 Subject: [PATCH 11/29] Lightbox/modal multi image improvements - #381 --- src/components/media_modal/media_modal.js | 21 +++++++++++++++++++++ src/components/media_modal/media_modal.vue | 22 +++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/components/media_modal/media_modal.js b/src/components/media_modal/media_modal.js index 4832abda3..abb18c7de 100644 --- a/src/components/media_modal/media_modal.js +++ b/src/components/media_modal/media_modal.js @@ -2,6 +2,7 @@ import StillImage from '../still-image/still-image.vue' import VideoAttachment from '../video_attachment/video_attachment.vue' import Modal from '../modal/modal.vue' import fileTypeService from '../../services/file_type/file_type.service.js' +import GestureService from '../../services/gesture_service/gesture_service' const MediaModal = { components: { @@ -29,7 +30,27 @@ const MediaModal = { return this.currentMedia ? fileTypeService.fileType(this.currentMedia.mimetype) : null } }, + created () { + this.mediaSwipeGestureRight = GestureService.swipeGesture( + GestureService.DIRECTION_RIGHT, + this.goPrev, + 50 + ) + this.mediaSwipeGestureLeft = GestureService.swipeGesture( + GestureService.DIRECTION_LEFT, + this.goNext, + 50 + ) + }, methods: { + mediaTouchStart (e) { + GestureService.beginSwipe(e, this.mediaSwipeGestureRight) + GestureService.beginSwipe(e, this.mediaSwipeGestureLeft) + }, + mediaTouchMove (e) { + GestureService.updateSwipe(e, this.mediaSwipeGestureRight) + GestureService.updateSwipe(e, this.mediaSwipeGestureLeft) + }, hide () { this.$store.dispatch('closeMediaViewer') }, diff --git a/src/components/media_modal/media_modal.vue b/src/components/media_modal/media_modal.vue index 2597f4e30..49e3143e4 100644 --- a/src/components/media_modal/media_modal.vue +++ b/src/components/media_modal/media_modal.vue @@ -8,6 +8,8 @@ v-if="type === 'image'" class="modal-image" :src="currentMedia.url" + @touchstart.stop="mediaTouchStart" + @touchmove.stop="mediaTouchMove" > Date: Fri, 8 Nov 2019 11:14:01 -0500 Subject: [PATCH 12/29] fix eslint warnings --- src/components/checkbox/checkbox.vue | 2 +- src/components/tab_switcher/tab_switcher.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index 5917598af..1113f81d8 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -12,8 +12,8 @@ > diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 3ca316b9f..008e1e954 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -12,11 +12,13 @@ export default Vue.component('tab-switcher', { }, onSwitch: { required: false, - type: Function + type: Function, + default: undefined }, activeTab: { required: false, - type: String + type: String, + default: undefined }, scrollableTabs: { required: false, From a38d16273d19e6d6ee4b8066039bc3658f8db9b5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 8 Nov 2019 20:12:01 +0200 Subject: [PATCH 13/29] fix search not working, use computer property instead of state --- src/components/emoji_picker/emoji_picker.js | 24 ++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 76d1f26bd..a31adb635 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -24,10 +24,8 @@ const EmojiPicker = { showingStickers: false, groupsScrolledClass: 'scrolled-top', keepOpen: false, - customEmojiBuffer: (this.$store.state.instance.customEmoji || []) - .slice(0, LOAD_EMOJI_BY), + customEmojiBufferSlice: LOAD_EMOJI_BY, customEmojiTimeout: null, - customEmojiCounter: LOAD_EMOJI_BY, customEmojiLoadAllConfirmed: false } }, @@ -81,32 +79,21 @@ const EmojiPicker = { return } - this.customEmojiBuffer.push( - ...this.filteredEmoji.slice( - this.customEmojiCounter, - this.customEmojiCounter + LOAD_EMOJI_BY - ) - ) + this.customEmojiBufferSlice += LOAD_EMOJI_BY this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) - this.customEmojiCounter += LOAD_EMOJI_BY }, startEmojiLoad (forceUpdate = false) { const bufferSize = this.customEmojiBuffer.length const bufferPrefilledSane = bufferSize === LOAD_EMOJI_SANE_AMOUNT && !this.customEmojiLoadAllConfirmed const bufferPrefilledAll = bufferSize === this.filteredEmoji.length - if (forceUpdate || bufferPrefilledSane || bufferPrefilledAll) { + if ((bufferPrefilledSane || bufferPrefilledAll) && !forceUpdate) { return } if (this.customEmojiTimeout) { window.clearTimeout(this.customEmojiTimeout) } - set( - this, - 'customEmojiBuffer', - this.filteredEmoji.slice(0, LOAD_EMOJI_BY) - ) - this.customEmojiCounter = LOAD_EMOJI_BY + this.customEmojiBufferSlice = LOAD_EMOJI_BY this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) }, continueEmojiLoad () { @@ -152,6 +139,9 @@ const EmojiPicker = { this.keyword ) }, + customEmojiBuffer () { + return this.filteredEmoji.slice(0, this.customEmojiBufferSlice) + }, askForSanity () { return this.customEmojiBuffer.length >= LOAD_EMOJI_SANE_AMOUNT && !this.customEmojiLoadAllConfirmed From 9338c81f4a68d217a70ffeefc4faab130d965df5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 8 Nov 2019 21:25:13 +0200 Subject: [PATCH 14/29] replace sanity button with loading on scroll --- src/components/emoji_picker/emoji_picker.js | 81 ++++++++++---------- src/components/emoji_picker/emoji_picker.vue | 17 +--- 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index a31adb635..92abf7a23 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -1,9 +1,12 @@ import { set } from 'vue' import Checkbox from '../checkbox/checkbox.vue' -const LOAD_EMOJI_BY = 50 -const LOAD_EMOJI_INTERVAL = 100 -const LOAD_EMOJI_SANE_AMOUNT = 500 +// At widest, approximately 20 emoji are visible in a row, +// loading 3 rows, could be overkill for narrow picker +const LOAD_EMOJI_BY = 60 + +// When to start loading new batch emoji, in pixels +const LOAD_EMOJI_MARGIN = 64 const filterByKeyword = (list, keyword = '') => { return list.filter(x => x.displayText.includes(keyword)) @@ -34,10 +37,22 @@ const EmojiPicker = { Checkbox }, methods: { + onStickerUploaded (e) { + this.$emit('sticker-uploaded', e) + }, + onStickerUploadFailed (e) { + this.$emit('sticker-upload-failed', e) + }, onEmoji (emoji) { const value = emoji.imageUrl ? `:${emoji.displayText}:` : emoji.replacement this.$emit('emoji', { insertion: value, keepOpen: this.keepOpen }) }, + onScroll (e) { + const target = (e && e.target) || this.$refs['emoji-groups'] + this.updateScrolledClass(target) + this.scrolledGroup(target) + this.triggerLoadMore(target) + }, highlight (key) { const ref = this.$refs['group-' + key] const top = ref[0].offsetTop @@ -47,9 +62,7 @@ const EmojiPicker = { this.$refs['emoji-groups'].scrollTop = top + 1 }) }, - scrolledGroup (e) { - const target = (e && e.target) || this.$refs['emoji-groups'] - const top = target.scrollTop + 5 + updateScrolledClass (target) { if (target.scrollTop <= 5) { this.groupsScrolledClass = 'scrolled-top' } else if (target.scrollTop >= target.scrollTopMax - 5) { @@ -57,6 +70,26 @@ const EmojiPicker = { } else { this.groupsScrolledClass = 'scrolled-middle' } + }, + triggerLoadMore (target) { + const ref = this.$refs['group-end-custom'][0] + const bottom = ref.offsetTop + ref.offsetHeight + + const scrollerBottom = target.scrollTop + target.clientHeight + const scrollerTop = target.scrollTop + + // Loads more emoji when they come into view + const approachingBottom = bottom - scrollerBottom < LOAD_EMOJI_MARGIN + // Always load when at the very top in case there's no scroll space yet + const atTop = scrollerTop < 5 + // Don't load when looking at unicode category + const bottomAboveViewport = bottom < scrollerTop + if (!bottomAboveViewport && (approachingBottom || atTop)) { + this.loadEmoji() + } + }, + scrolledGroup (target) { + const top = target.scrollTop + 5 this.$nextTick(() => { this.emojisView.forEach(group => { const ref = this.$refs['group-' + group.id] @@ -66,56 +99,34 @@ const EmojiPicker = { }) }) }, - loadEmojiInsane () { - this.customEmojiLoadAllConfirmed = true - this.continueEmojiLoad() - }, loadEmoji () { const allLoaded = this.customEmojiBuffer.length === this.filteredEmoji.length - const saneLoaded = this.customEmojiBuffer.length >= LOAD_EMOJI_SANE_AMOUNT && - !this.customEmojiLoadAllConfirmed - if (allLoaded || saneLoaded) { + if (allLoaded) { return } this.customEmojiBufferSlice += LOAD_EMOJI_BY - this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) }, startEmojiLoad (forceUpdate = false) { const bufferSize = this.customEmojiBuffer.length - const bufferPrefilledSane = bufferSize === LOAD_EMOJI_SANE_AMOUNT && !this.customEmojiLoadAllConfirmed const bufferPrefilledAll = bufferSize === this.filteredEmoji.length - if ((bufferPrefilledSane || bufferPrefilledAll) && !forceUpdate) { + if (bufferPrefilledAll && !forceUpdate) { return } - if (this.customEmojiTimeout) { - window.clearTimeout(this.customEmojiTimeout) - } - this.customEmojiBufferSlice = LOAD_EMOJI_BY - this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) - }, - continueEmojiLoad () { - this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) }, toggleStickers () { this.showingStickers = !this.showingStickers }, setShowStickers (value) { this.showingStickers = value - }, - onStickerUploaded (e) { - this.$emit('sticker-uploaded', e) - }, - onStickerUploadFailed (e) { - this.$emit('sticker-upload-failed', e) } }, watch: { keyword () { this.customEmojiLoadAllConfirmed = false - this.scrolledGroup() + this.onScroll() this.startEmojiLoad(true) } }, @@ -129,10 +140,6 @@ const EmojiPicker = { } return 0 }, - saneAmount () { - // for UI - return LOAD_EMOJI_SANE_AMOUNT - }, filteredEmoji () { return filterByKeyword( this.$store.state.instance.customEmoji || [], @@ -142,10 +149,6 @@ const EmojiPicker = { customEmojiBuffer () { return this.filteredEmoji.slice(0, this.customEmojiBufferSlice) }, - askForSanity () { - return this.customEmojiBuffer.length >= LOAD_EMOJI_SANE_AMOUNT && - !this.customEmojiLoadAllConfirmed - }, emojis () { const standardEmojis = this.$store.state.instance.emoji || [] const customEmojis = this.customEmojiBuffer diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue index 43da6aa23..9998131d2 100644 --- a/src/components/emoji_picker/emoji_picker.vue +++ b/src/components/emoji_picker/emoji_picker.vue @@ -47,7 +47,7 @@ ref="emoji-groups" class="emoji-groups" :class="groupsScrolledClass" - @scroll="scrolledGroup" + @scroll="onScroll" >
+
@@ -80,20 +81,6 @@ {{ $t('emoji.keep_open') }}
-
-
- {{ $t('emoji.load_all_hint', { saneAmount } ) }} -
- -
Date: Fri, 8 Nov 2019 21:28:51 +0200 Subject: [PATCH 15/29] fix not being able to see unicode emojis when there few of them when searching on emoji-a-ton instances --- src/components/emoji_picker/emoji_picker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 92abf7a23..782c4dfcd 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -77,13 +77,14 @@ const EmojiPicker = { const scrollerBottom = target.scrollTop + target.clientHeight const scrollerTop = target.scrollTop + const scrollerMax = target.scrollHeight // Loads more emoji when they come into view const approachingBottom = bottom - scrollerBottom < LOAD_EMOJI_MARGIN // Always load when at the very top in case there's no scroll space yet const atTop = scrollerTop < 5 - // Don't load when looking at unicode category - const bottomAboveViewport = bottom < scrollerTop + // Don't load when looking at unicode category or at the very bottom + const bottomAboveViewport = bottom < scrollerTop || scrollerBottom === scrollerMax if (!bottomAboveViewport && (approachingBottom || atTop)) { this.loadEmoji() } @@ -126,6 +127,7 @@ const EmojiPicker = { watch: { keyword () { this.customEmojiLoadAllConfirmed = false + this.$refs['emoji-groups'].scrollTop = 0 this.onScroll() this.startEmojiLoad(true) } From a69946923b3931a8308e44a7d1ad254e6b95855b Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 8 Nov 2019 21:35:58 +0200 Subject: [PATCH 16/29] eslint fix --- src/components/checkbox/checkbox.vue | 2 +- src/components/emoji_picker/emoji_picker.js | 1 - src/components/emoji_picker/emoji_picker.vue | 2 +- src/components/post_status_form/post_status_form.vue | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index 5917598af..1113f81d8 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -12,8 +12,8 @@ > diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 782c4dfcd..d46dbaa59 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -1,4 +1,3 @@ -import { set } from 'vue' import Checkbox from '../checkbox/checkbox.vue' // At widest, approximately 20 emoji are visible in a row, diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue index 9998131d2..191b9fa1b 100644 --- a/src/components/emoji_picker/emoji_picker.vue +++ b/src/components/emoji_picker/emoji_picker.vue @@ -73,7 +73,7 @@ :src="emoji.imageUrl" > - +
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 13e8b0aac..0094b1aaf 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -163,7 +163,7 @@
+ >
Date: Fri, 8 Nov 2019 21:44:36 +0200 Subject: [PATCH 17/29] reset position when reopening emoji picker --- src/components/emoji_picker/emoji_picker.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index d46dbaa59..432816bea 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -109,6 +109,9 @@ const EmojiPicker = { this.customEmojiBufferSlice += LOAD_EMOJI_BY }, startEmojiLoad (forceUpdate = false) { + this.$nextTick(() => { + this.$refs['emoji-groups'].scrollTop = 0 + }) const bufferSize = this.customEmojiBuffer.length const bufferPrefilledAll = bufferSize === this.filteredEmoji.length if (bufferPrefilledAll && !forceUpdate) { @@ -126,7 +129,6 @@ const EmojiPicker = { watch: { keyword () { this.customEmojiLoadAllConfirmed = false - this.$refs['emoji-groups'].scrollTop = 0 this.onScroll() this.startEmojiLoad(true) } From a3501d58d8703379d5f60e1bb53dfb0dbb1022b2 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 8 Nov 2019 23:57:20 +0200 Subject: [PATCH 18/29] clear filter on reopen, fix error message in console --- src/components/emoji_picker/emoji_picker.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 432816bea..0f397b59f 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -72,6 +72,7 @@ const EmojiPicker = { }, triggerLoadMore (target) { const ref = this.$refs['group-end-custom'][0] + if (!ref) return const bottom = ref.offsetTop + ref.offsetHeight const scrollerBottom = target.scrollTop + target.clientHeight @@ -109,6 +110,9 @@ const EmojiPicker = { this.customEmojiBufferSlice += LOAD_EMOJI_BY }, startEmojiLoad (forceUpdate = false) { + if (!forceUpdate) { + this.keyword = '' + } this.$nextTick(() => { this.$refs['emoji-groups'].scrollTop = 0 }) From e4820012a3573ad02846d254fedb0cfa36582fdf Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Fri, 8 Nov 2019 22:27:25 +0000 Subject: [PATCH 19/29] redirect /remote-users/:username@:hostname -> /users/:id, /remote-users/:hostname/:username -> /users/:id --- src/boot/routes.js | 11 +++++++ .../remote_user_resolver.js | 31 +++++++++++++++++++ .../remote_user_resolver.vue | 20 ++++++++++++ src/i18n/en.json | 5 +++ 4 files changed, 67 insertions(+) create mode 100644 src/components/remote_user_resolver/remote_user_resolver.js create mode 100644 src/components/remote_user_resolver/remote_user_resolver.vue diff --git a/src/boot/routes.js b/src/boot/routes.js index 5670236c7..7400a682c 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -18,6 +18,7 @@ import AuthForm from 'components/auth_form/auth_form.js' 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' export default (store) => { const validateAuthenticatedRoute = (to, from, next) => { @@ -42,6 +43,16 @@ export default (store) => { { name: 'friends', path: '/main/friends', component: FriendsTimeline, beforeEnter: validateAuthenticatedRoute }, { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline }, { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } }, + { name: 'remote-user-profile-acct', + path: '/remote-users/(@?):username([^/@]+)@:hostname([^/@]+)', + component: RemoteUserResolver, + beforeEnter: validateAuthenticatedRoute + }, + { name: 'remote-user-profile', + path: '/remote-users/:hostname/:username', + component: RemoteUserResolver, + beforeEnter: validateAuthenticatedRoute + }, { name: 'external-user-profile', path: '/users/:id', component: UserProfile }, { name: 'interactions', path: '/users/:username/interactions', component: Interactions, beforeEnter: validateAuthenticatedRoute }, { name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute }, diff --git a/src/components/remote_user_resolver/remote_user_resolver.js b/src/components/remote_user_resolver/remote_user_resolver.js new file mode 100644 index 000000000..9b5e511e0 --- /dev/null +++ b/src/components/remote_user_resolver/remote_user_resolver.js @@ -0,0 +1,31 @@ +const RemoteUserResolver = { + data: () => ({ + error: false + }), + mounted () { + this.redirect() + }, + methods: { + redirect () { + const acct = this.$route.params.username + '@' + this.$route.params.hostname + this.$store.state.api.backendInteractor.fetchUser({ id: acct }) + .then((externalUser) => { + if (externalUser.error) { + this.error = true + } else { + this.$store.commit('addNewUsers', [externalUser]) + const id = externalUser.id + this.$router.replace({ + name: 'external-user-profile', + params: { id } + }) + } + }) + .catch(() => { + this.error = true + }) + } + } +} + +export default RemoteUserResolver diff --git a/src/components/remote_user_resolver/remote_user_resolver.vue b/src/components/remote_user_resolver/remote_user_resolver.vue new file mode 100644 index 000000000..f8945225e --- /dev/null +++ b/src/components/remote_user_resolver/remote_user_resolver.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index 8ecb3f3db..483432ffc 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -172,6 +172,11 @@ "password_confirmation_match": "should be the same as password" } }, + "remote_user_resolver": { + "remote_user_resolver": "Remote user resolver", + "searching_for": "Searching for", + "error": "Not found." + }, "selectable_list": { "select_all": "Select all" }, From 6cede475bec01755d168586b4a2a2241a8bc18ab Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 21:53:53 -0600 Subject: [PATCH 20/29] nav panel: add link to about page --- src/components/nav_panel/nav_panel.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 614fadf4b..28589bb14 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -38,6 +38,11 @@ {{ $t("nav.twkn") }} +
  • + + {{ $t("nav.about") }} + +
  • From 5db77c839bcf2ec433c8618c5b2ef1ff850df613 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 21:57:09 -0600 Subject: [PATCH 21/29] about page: fix hiding of instance-specific panel, flow ToS and ISP better --- src/components/about/about.js | 7 ++++++- src/components/about/about.vue | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/about/about.js b/src/components/about/about.js index ae1cb1821..92856b21e 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -9,7 +9,12 @@ const About = { TermsOfServicePanel }, computed: { - showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel } + showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, + showInstanceSpecificPanel () { + return this.$store.state.instance.showInstanceSpecificPanel && + !this.$store.getters.mergedConfig.hideISP && + this.$store.state.instance.instanceSpecificPanelContent + } } } diff --git a/src/components/about/about.vue b/src/components/about/about.vue index 62ae16ea3..10dad4bb6 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -1,8 +1,8 @@ From 20ccd93a176f911a43b3db3d595f3fdb3491934f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 23:21:07 -0600 Subject: [PATCH 22/29] about: add staff panel --- src/boot/after_store.js | 17 +++++++++++++++++ src/components/about/about.js | 4 +++- src/components/about/about.vue | 1 + src/components/staff_panel/staff_panel.js | 15 +++++++++++++++ src/components/staff_panel/staff_panel.vue | 22 ++++++++++++++++++++++ src/i18n/en.json | 3 +++ 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/components/staff_panel/staff_panel.js create mode 100644 src/components/staff_panel/staff_panel.vue diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 80a558497..e96baaf0e 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -184,6 +184,20 @@ const getAppSecret = async ({ store }) => { }) } +const resolveStaffAccounts = async ({ store, accounts }) => { + let nicknames = accounts.map(uri => uri.split('/').pop()) + const backendInteractor = store.state.api.backendInteractor + + nicknames = nicknames.map(id => { + console.log('resolving staff account:', id) + return backendInteractor.fetchUser({ id }) + }) + + nicknames = await Promise.all(nicknames) + + store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames }) +} + const getNodeInfo = async ({ store }) => { try { const res = await window.fetch('/nodeinfo/2.0.json') @@ -212,6 +226,9 @@ const getNodeInfo = async ({ store }) => { const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) + + const accounts = metadata.staffAccounts + await resolveStaffAccounts({ store, accounts }) } else { throw (res) } diff --git a/src/components/about/about.js b/src/components/about/about.js index 92856b21e..5c95c0795 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -1,12 +1,14 @@ import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_panel.vue' import FeaturesPanel from '../features_panel/features_panel.vue' import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue' +import StaffPanel from '../staff_panel/staff_panel.vue' const About = { components: { InstanceSpecificPanel, FeaturesPanel, - TermsOfServicePanel + TermsOfServicePanel, + StaffPanel }, computed: { showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, diff --git a/src/components/about/about.vue b/src/components/about/about.vue index 10dad4bb6..ad520d11e 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -1,6 +1,7 @@ diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js new file mode 100644 index 000000000..3791dd123 --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -0,0 +1,33 @@ +const MRFTransparencyPanel = { + components: { + }, + computed: { + federationPolicy() { + return this.$store.state.instance.federationPolicy + }, + mrfPolicies() { + return this.$store.state.instance.federationPolicy.mrf_policies + }, + acceptInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.accept + }, + rejectInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.reject + }, + quarantineInstances() { + return this.$store.state.instance.federationPolicy.quarantined_instances + }, + ftlRemovalInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.federated_timeline_removal + }, + mediaNsfwInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.media_nsfw + }, + mediaRemovalInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.media_removal + } + } +} + +export default MRFTransparencyPanel + diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue new file mode 100644 index 000000000..f3507591f --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index 4cd661774..ead333c13 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1,6 +1,22 @@ { "about": { - "staff": "Staff" + "staff": "Staff", + "federation": "Federation", + "mrf_policies": "Enabled MRF Policies", + "mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance. The following policies are enabled:", + "mrf_policy_simple": "Instance-specific Policies", + "mrf_policy_simple_accept": "Accept", + "mrf_policy_simple_accept_desc": "This instance only accepts messages from the following instances:", + "mrf_policy_simple_reject": "Reject", + "mrf_policy_simple_reject_desc": "This instance will not accept messages from the following instances:", + "mrf_policy_simple_quarantine": "Quarantine", + "mrf_policy_simple_quarantine_desc": "This instance will send only public posts to the following instances:", + "mrf_policy_simple_ftl_removal": "Removal from \"The Whole Known Network\" Timeline", + "mrf_policy_simple_ftl_removal_desc": "This instance removes these instances from \"The Whole Known Network\" timeline:", + "mrf_policy_simple_media_removal": "Media Removal", + "mrf_policy_simple_media_removal_desc": "This instance removes media from posts on the following instances:", + "mrf_policy_simple_media_nsfw": "Media Force-set As Sensitive", + "mrf_policy_simple_media_nsfw_desc": "This instance forces media to be set sensitive in posts on the following instances:" }, "chat": { "title": "Chat" From 6dfe3cc911e748767368cc920cac2d91b4805992 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 00:23:22 -0600 Subject: [PATCH 24/29] lint --- .../mrf_transparency_panel.js | 17 ++++--- .../mrf_transparency_panel.vue | 47 +++++++++++++++---- src/components/staff_panel/staff_panel.js | 3 +- src/components/staff_panel/staff_panel.vue | 3 +- 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js index 3791dd123..d4e583b0c 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -2,32 +2,31 @@ const MRFTransparencyPanel = { components: { }, computed: { - federationPolicy() { + federationPolicy () { return this.$store.state.instance.federationPolicy }, - mrfPolicies() { + mrfPolicies () { return this.$store.state.instance.federationPolicy.mrf_policies }, - acceptInstances() { + acceptInstances () { return this.$store.state.instance.federationPolicy.mrf_simple.accept }, - rejectInstances() { + rejectInstances () { return this.$store.state.instance.federationPolicy.mrf_simple.reject }, - quarantineInstances() { + quarantineInstances () { return this.$store.state.instance.federationPolicy.quarantined_instances }, - ftlRemovalInstances() { + ftlRemovalInstances () { return this.$store.state.instance.federationPolicy.mrf_simple.federated_timeline_removal }, - mediaNsfwInstances() { + mediaNsfwInstances () { return this.$store.state.instance.federationPolicy.mrf_simple.media_nsfw }, - mediaRemovalInstances() { + mediaRemovalInstances () { return this.$store.state.instance.federationPolicy.mrf_simple.media_removal } } } export default MRFTransparencyPanel - diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue index f3507591f..2640d68c7 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -1,5 +1,8 @@