From 455cd0d0289c7633aca22ad6e8737d449e361fce Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 14:47:02 +0300 Subject: [PATCH 1/6] settings for scope/subject --- src/components/settings/settings.js | 12 ++++++++++ src/components/settings/settings.vue | 35 ++++++++++++++++++++++++++++ src/i18n/en.json | 7 ++++++ src/i18n/fr.json | 1 + src/modules/config.js | 6 +++-- src/modules/instance.js | 2 ++ static/config.json | 4 +++- 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index a24bc265fa..a7c2c56563 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -26,6 +26,12 @@ const settings = { ? instance.collapseMessageWithSubject : user.collapseMessageWithSubject, collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.collapseMessageWithSubject), + subjectLineBehaviorLocal: typeof user.subjectLineBehavior === 'undefined' + ? instance.subjectLineBehavior + : user.subjectLineBehavior, + subjectLineBehaviorDefault: instance.subjectLineBehavior, + scopeCopyLocal: user.scopeCopy, + scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy), stopGifs: user.stopGifs, loopSilentAvailable: // Firefox @@ -99,6 +105,12 @@ const settings = { collapseMessageWithSubjectLocal (value) { this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value }) }, + scopeCopyLocal (value) { + this.$store.dispatch('setOption', { name: 'scopeCopy', value }) + }, + subjectLineBehaviorLocal (value) { + this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value }) + }, stopGifs (value) { this.$store.dispatch('setOption', { name: 'stopGifs', value }) } diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 42c660a3c3..f9e7d71172 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -53,6 +53,41 @@ + +
+

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

+ +
+

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

    diff --git a/src/i18n/en.json b/src/i18n/en.json index 2dc6493ec0..cd87240bce 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -88,6 +88,7 @@ "change_password_error": "There was an issue changing your password.", "changed_password": "Password changed successfully!", "collapse_subject": "Collapse posts with subjects", + "composing": "Composing", "confirm_new_password": "Confirm new password", "current_avatar": "Your current avatar", "current_password": "Current password", @@ -115,6 +116,7 @@ "import_theme": "Load preset", "inputRadius": "Input fields", "instance_default: (default": "{value})", + "instance_default_simple" : "(default)", "interfaceLanguage": "Interface language", "invalid_theme_imported": "The selected file is not a supported Pleroma theme. No changes to your theme were made.", "limited_availability": "Unavailable in your browser", @@ -147,10 +149,15 @@ "saving_err": "Error saving settings", "saving_ok": "Settings saved", "security_tab": "Security", + "scope_copy": "Copy scope when replying (DMs are always copied)", "set_new_avatar": "Set new avatar", "set_new_profile_background": "Set new profile background", "set_new_profile_banner": "Set new profile banner", "settings": "Settings", + "subject_line_behavior": "Copy subject when replying", + "subject_line_email": "Like email: \"re: subject\"", + "subject_line_mastodon": "Like mastodon: copy as is", + "subject_line_noop": "Do not copy", "stop_gifs": "Play-on-hover GIFs", "streaming": "Enable automatic streaming of new posts when scrolled to the top", "text": "Text", diff --git a/src/i18n/fr.json b/src/i18n/fr.json index cf45d9af0d..b76db32ac2 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -115,6 +115,7 @@ "import_theme": "Charger le thème", "inputRadius": "Champs de texte", "instance_default: (default": "{value})", + "instance_default_simple" : "(default)", "interfaceLanguage": "Langue de l'interface", "invalid_theme_imported": "Le fichier sélectionné n'est pas un thème Pleroma pris en charge. Aucun changement n'a été apporté à votre thème.", "limited_availability": "Non disponible dans votre navigateur", diff --git a/src/modules/config.js b/src/modules/config.js index 375d016796..0d36e9bf97 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -5,7 +5,7 @@ const browserLocale = (window.navigator.language || 'en').split('-')[0] const defaultState = { colors: {}, - collapseMessageWithSubject: false, + collapseMessageWithSubject: undefined, // instance default hideAttachments: false, hideAttachmentsInConv: false, hideNsfw: true, @@ -25,7 +25,9 @@ const defaultState = { }, muteWords: [], highlight: {}, - interfaceLanguage: browserLocale + interfaceLanguage: browserLocale, + scopeCopy: undefined, // instance default + subjectLineBehavior: undefined // instance default } const config = { diff --git a/src/modules/instance.js b/src/modules/instance.js index cb724821ea..0e67e4d179 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -19,6 +19,8 @@ const defaultState = { formattingOptionsEnabled: false, collapseMessageWithSubject: false, disableChat: false, + scopeCopy: false, + subjectLineBehavior: 'email', // Nasty stuff pleromaBackend: true, diff --git a/static/config.json b/static/config.json index 144fe951c2..988d1cf445 100644 --- a/static/config.json +++ b/static/config.json @@ -10,5 +10,7 @@ "showInstanceSpecificPanel": false, "scopeOptionsEnabled": false, "formattingOptionsEnabled": false, - "collapseMessageWithSubject": false + "collapseMessageWithSubject": false, + "scopeCopy": false, + "subjectLineBehavior": "email" } From ef968d8e1e4f3194a0856fd93bc03d8030112b12 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 15:16:26 +0300 Subject: [PATCH 2/6] now it actually works --- src/components/post_status_form/post_status_form.js | 10 ++++++++-- src/components/settings/settings.vue | 6 +++--- src/components/status/status.js | 10 ++++++++-- src/components/status/status.vue | 2 +- src/modules/instance.js | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index a84e764c18..804c4bc22f 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -24,7 +24,7 @@ const PostStatusForm = { 'replyTo', 'repliedUser', 'attentions', - 'messageScope', + 'copyMessageScope', 'subject' ], components: { @@ -46,6 +46,12 @@ const PostStatusForm = { statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) } + console.log(this.copyMessageScope) + const scope = (this.copyMessageScope && this.$store.state.config.copyScope || this.copyMessageScope === 'direct') + ? this.copyMessageScope + : this.$store.state.users.currentUser.default_scope + + console.log(this) return { dropFiles: [], submitDisabled: false, @@ -58,7 +64,7 @@ const PostStatusForm = { contentType: 'text/plain', nsfw: false, files: [], - visibility: this.messageScope || this.$store.state.users.currentUser.default_scope + visibility: scope }, caret: 0 } diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index f9e7d71172..5a5b2fb441 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -70,15 +70,15 @@ diff --git a/src/components/status/status.js b/src/components/status/status.js index 45f5ccac78..38cfc5ae57 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -174,10 +174,16 @@ const Status = { return true }, replySubject () { - if (this.status.summary && !this.status.summary.match(/^re[: ]/i)) { + if (!this.status.summary) return ''; + const behavior = this.$store.state.config.subjectLineBehavior + const startsWithRe = this.status.summary.match(/^re[: ]/i) + if (behavior !== 'noop' && startsWithRe || behavior === 'masto') { + return this.status.summary + } else if (behavior === 'email') { return 're: '.concat(this.status.summary) + } else if (behavior === 'noop') { + return '' } - return this.status.summary }, attachmentSize () { if ((this.$store.state.config.hideAttachments && !this.inConversation) || diff --git a/src/components/status/status.vue b/src/components/status/status.vue index eb52128046..8087d39213 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -106,7 +106,7 @@
- +
diff --git a/src/modules/instance.js b/src/modules/instance.js index 0e67e4d179..58913060c1 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -19,7 +19,7 @@ const defaultState = { formattingOptionsEnabled: false, collapseMessageWithSubject: false, disableChat: false, - scopeCopy: false, + scopeCopy: true, subjectLineBehavior: 'email', // Nasty stuff From d5e82625d3e14ed22224de871e732f8b6db9df59 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 15:21:47 +0300 Subject: [PATCH 3/6] lint fix --- src/components/status/status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 38cfc5ae57..9c224ce362 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -174,7 +174,7 @@ const Status = { return true }, replySubject () { - if (!this.status.summary) return ''; + if (!this.status.summary) return '' const behavior = this.$store.state.config.subjectLineBehavior const startsWithRe = this.status.summary.match(/^re[: ]/i) if (behavior !== 'noop' && startsWithRe || behavior === 'masto') { From b66d7901f175fcc415f1979dc8fd776dcda9ba79 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 16:31:06 +0300 Subject: [PATCH 4/6] forgot to actually handle the instance config. this part needs a rewrite... --- src/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.js b/src/main.js index 367db88152..76a32bf218 100644 --- a/src/main.js +++ b/src/main.js @@ -110,6 +110,8 @@ window.fetch('/api/statusnet/config.json') var scopeOptionsEnabled = (config.scopeOptionsEnabled) var formattingOptionsEnabled = (config.formattingOptionsEnabled) var collapseMessageWithSubject = (config.collapseMessageWithSubject) + var scopeCopy = (config.scopeCopy) + var subjectLineBehavior = (config.subjectLineBehavior) store.dispatch('setInstanceOption', { name: 'theme', value: theme }) store.dispatch('setInstanceOption', { name: 'background', value: background }) @@ -122,6 +124,8 @@ window.fetch('/api/statusnet/config.json') store.dispatch('setInstanceOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled }) store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject }) + store.dispatch('setInstanceOption', { name: 'scopeCopy', value: scopeCopy }) + store.dispatch('setInstanceOption', { name: 'subjectLineBehavior', value: subjectLineBehavior }) if (chatDisabled) { store.dispatch('disableChat') } From 2dbc5f757d4e84e210a45ea99a64b79df6778b77 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 26 Nov 2018 04:42:25 +0300 Subject: [PATCH 5/6] whoops --- config/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/index.js b/config/index.js index 395d130645..7b0ef26cf3 100644 --- a/config/index.js +++ b/config/index.js @@ -23,17 +23,17 @@ module.exports = { assetsPublicPath: '/', proxyTable: { '/api': { - target: 'https://shigusegubu.club/', + target: 'http://localhost:4000/', changeOrigin: true, cookieDomainRewrite: 'localhost' }, '/nodeinfo': { - target: 'https://shigusegubu.club/', + target: 'http://localhost:4000/', changeOrigin: true, cookieDomainRewrite: 'localhost' }, '/socket': { - target: 'https://shigusegubu.club/', + target: 'http://localhost:4000/', changeOrigin: true, cookieDomainRewrite: 'localhost', ws: true From b948234aec2ec1d140a46303c09d24424262bd66 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 26 Nov 2018 04:44:54 +0300 Subject: [PATCH 6/6] whoops --- src/components/post_status_form/post_status_form.js | 2 -- src/main.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index e49c3ccc11..fa86ee5993 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -46,12 +46,10 @@ const PostStatusForm = { statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) } - console.log(this.copyMessageScope) const scope = (this.copyMessageScope && this.$store.state.config.copyScope || this.copyMessageScope === 'direct') ? this.copyMessageScope : this.$store.state.users.currentUser.default_scope - console.log(this) return { dropFiles: [], submitDisabled: false, diff --git a/src/main.js b/src/main.js index 5f459d46ae..9f094adac8 100644 --- a/src/main.js +++ b/src/main.js @@ -43,7 +43,6 @@ const i18n = new VueI18n({ messages }) -======= const persistedStateOptions = { paths: [ 'config', @@ -67,7 +66,6 @@ createPersistedState(persistedStateOptions).then((persistedState) => { plugins: [persistedState], strict: false // Socket modifies itself, let's ignore this for now. // strict: process.env.NODE_ENV !== 'production' ->>>>>>> upstream/develop }) afterStoreSetup({store, i18n})