Merge branch 'feature/scope_preferences' into 'develop'

Make visibility copying and subject copying configurable

Closes #135

See merge request pleroma/pleroma-fe!353
This commit is contained in:
Henry 2018-11-26 01:50:54 +00:00
commit 91272dc555
11 changed files with 82 additions and 7 deletions

View File

@ -56,6 +56,8 @@ const afterStoreSetup = ({store, i18n}) => {
var formattingOptionsEnabled = (config.formattingOptionsEnabled) var formattingOptionsEnabled = (config.formattingOptionsEnabled)
var collapseMessageWithSubject = (config.collapseMessageWithSubject) var collapseMessageWithSubject = (config.collapseMessageWithSubject)
var loginMethod = (config.loginMethod) var loginMethod = (config.loginMethod)
var scopeCopy = (config.scopeCopy)
var subjectLineBehavior = (config.subjectLineBehavior)
store.dispatch('setInstanceOption', { name: 'theme', value: theme }) store.dispatch('setInstanceOption', { name: 'theme', value: theme })
store.dispatch('setInstanceOption', { name: 'background', value: background }) store.dispatch('setInstanceOption', { name: 'background', value: background })
@ -71,6 +73,8 @@ const afterStoreSetup = ({store, i18n}) => {
store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled }) store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled })
store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject }) store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject })
store.dispatch('setInstanceOption', { name: 'loginMethod', value: loginMethod }) store.dispatch('setInstanceOption', { name: 'loginMethod', value: loginMethod })
store.dispatch('setInstanceOption', { name: 'scopeCopy', value: scopeCopy })
store.dispatch('setInstanceOption', { name: 'subjectLineBehavior', value: subjectLineBehavior })
if (chatDisabled) { if (chatDisabled) {
store.dispatch('disableChat') store.dispatch('disableChat')
} }

View File

@ -24,7 +24,7 @@ const PostStatusForm = {
'replyTo', 'replyTo',
'repliedUser', 'repliedUser',
'attentions', 'attentions',
'messageScope', 'copyMessageScope',
'subject' 'subject'
], ],
components: { components: {
@ -46,6 +46,10 @@ const PostStatusForm = {
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
} }
const scope = (this.copyMessageScope && this.$store.state.config.copyScope || this.copyMessageScope === 'direct')
? this.copyMessageScope
: this.$store.state.users.currentUser.default_scope
return { return {
dropFiles: [], dropFiles: [],
submitDisabled: false, submitDisabled: false,
@ -58,7 +62,7 @@ const PostStatusForm = {
contentType: 'text/plain', contentType: 'text/plain',
nsfw: false, nsfw: false,
files: [], files: [],
visibility: this.messageScope || this.$store.state.users.currentUser.default_scope visibility: scope
}, },
caret: 0 caret: 0
} }

View File

@ -34,6 +34,12 @@ const settings = {
? instance.collapseMessageWithSubject ? instance.collapseMessageWithSubject
: user.collapseMessageWithSubject, : user.collapseMessageWithSubject,
collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.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, stopGifs: user.stopGifs,
loopSilentAvailable: loopSilentAvailable:
// Firefox // Firefox
@ -113,6 +119,12 @@ const settings = {
collapseMessageWithSubjectLocal (value) { collapseMessageWithSubjectLocal (value) {
this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', 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) { stopGifs (value) {
this.$store.dispatch('setOption', { name: 'stopGifs', value }) this.$store.dispatch('setOption', { name: 'stopGifs', value })
} }

View File

@ -53,6 +53,41 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="setting-item">
<h2>{{$t('settings.composing')}}</h2>
<ul class="setting-list">
<li>
<input type="checkbox" id="scopeCopy" v-model="scopeCopyLocal">
<label for="scopeCopy">
{{$t('settings.scope_copy')}} {{$t('settings.instance_default', { value: scopeCopyDefault })}}
</label>
</li>
<li>
<div>
{{$t('settings.subject_line_behavior')}}
<label for="subjectLineBehavior" class="select">
<select id="subjectLineBehavior" v-model="subjectLineBehaviorLocal">
<option value="email">
{{$t('settings.subject_line_email')}}
{{subjectLineBehaviorDefault == 'email' ? $t('settings.instance_default_simple') : ''}}
</option>
<option value="masto">
{{$t('settings.subject_line_mastodon')}}
{{subjectLineBehaviorDefault == 'mastodon' ? $t('settings.instance_default_simple') : ''}}
</option>
<option value="noop">
{{$t('settings.subject_line_noop')}}
{{subjectLineBehaviorDefault == 'noop' ? $t('settings.instance_default_simple') : ''}}
</option>
</select>
<i class="icon-down-open"/>
</label>
</div>
</li>
</ul>
</div>
<div class="setting-item"> <div class="setting-item">
<h2>{{$t('settings.attachments')}}</h2> <h2>{{$t('settings.attachments')}}</h2>
<ul class="setting-list"> <ul class="setting-list">

View File

@ -181,10 +181,16 @@ const Status = {
return true return true
}, },
replySubject () { 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) return 're: '.concat(this.status.summary)
} else if (behavior === 'noop') {
return ''
} }
return this.status.summary
}, },
attachmentSize () { attachmentSize () {
if ((this.$store.state.config.hideAttachments && !this.inConversation) || if ((this.$store.state.config.hideAttachments && !this.inConversation) ||

View File

@ -106,7 +106,7 @@
</div> </div>
<div class="container" v-if="replying"> <div class="container" v-if="replying">
<div class="reply-left"/> <div class="reply-left"/>
<post-status-form class="reply-body" :reply-to="status.id" :attentions="status.attentions" :repliedUser="status.user" :message-scope="status.visibility" :subject="replySubject" v-on:posted="toggleReplying"/> <post-status-form class="reply-body" :reply-to="status.id" :attentions="status.attentions" :repliedUser="status.user" :copy-message-scope="status.visibility" :subject="replySubject" v-on:posted="toggleReplying"/>
</div> </div>
</template> </template>
</div> </div>

View File

@ -91,6 +91,7 @@
"change_password_error": "There was an issue changing your password.", "change_password_error": "There was an issue changing your password.",
"changed_password": "Password changed successfully!", "changed_password": "Password changed successfully!",
"collapse_subject": "Collapse posts with subjects", "collapse_subject": "Collapse posts with subjects",
"composing": "Composing",
"confirm_new_password": "Confirm new password", "confirm_new_password": "Confirm new password",
"current_avatar": "Your current avatar", "current_avatar": "Your current avatar",
"current_password": "Current password", "current_password": "Current password",
@ -120,6 +121,7 @@
"import_theme": "Load preset", "import_theme": "Load preset",
"inputRadius": "Input fields", "inputRadius": "Input fields",
"instance_default": "(default: {value})", "instance_default": "(default: {value})",
"instance_default_simple" : "(default)",
"interfaceLanguage": "Interface language", "interfaceLanguage": "Interface language",
"invalid_theme_imported": "The selected file is not a supported Pleroma theme. No changes to your theme were made.", "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", "limited_availability": "Unavailable in your browser",
@ -152,10 +154,15 @@
"saving_err": "Error saving settings", "saving_err": "Error saving settings",
"saving_ok": "Settings saved", "saving_ok": "Settings saved",
"security_tab": "Security", "security_tab": "Security",
"scope_copy": "Copy scope when replying (DMs are always copied)",
"set_new_avatar": "Set new avatar", "set_new_avatar": "Set new avatar",
"set_new_profile_background": "Set new profile background", "set_new_profile_background": "Set new profile background",
"set_new_profile_banner": "Set new profile banner", "set_new_profile_banner": "Set new profile banner",
"settings": "Settings", "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", "stop_gifs": "Play-on-hover GIFs",
"streaming": "Enable automatic streaming of new posts when scrolled to the top", "streaming": "Enable automatic streaming of new posts when scrolled to the top",
"text": "Text", "text": "Text",

View File

@ -119,6 +119,7 @@
"import_theme": "Charger le thème", "import_theme": "Charger le thème",
"inputRadius": "Champs de texte", "inputRadius": "Champs de texte",
"instance_default": "(default: {value})", "instance_default": "(default: {value})",
"instance_default_simple" : "(default)",
"interfaceLanguage": "Langue de l'interface", "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.", "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", "limited_availability": "Non disponible dans votre navigateur",

View File

@ -5,7 +5,7 @@ const browserLocale = (window.navigator.language || 'en').split('-')[0]
const defaultState = { const defaultState = {
colors: {}, colors: {},
collapseMessageWithSubject: undefined, collapseMessageWithSubject: undefined, // instance default
hideAttachments: false, hideAttachments: false,
hideAttachmentsInConv: false, hideAttachmentsInConv: false,
hideNsfw: true, hideNsfw: true,
@ -25,7 +25,9 @@ const defaultState = {
}, },
muteWords: [], muteWords: [],
highlight: {}, highlight: {},
interfaceLanguage: browserLocale interfaceLanguage: browserLocale,
scopeCopy: undefined, // instance default
subjectLineBehavior: undefined // instance default
} }
const config = { const config = {

View File

@ -21,6 +21,8 @@ const defaultState = {
hidePostStats: false, hidePostStats: false,
hideUserStats: false, hideUserStats: false,
disableChat: false, disableChat: false,
scopeCopy: true,
subjectLineBehavior: 'email',
loginMethod: 'password', loginMethod: 'password',
// Nasty stuff // Nasty stuff

View File

@ -11,6 +11,8 @@
"scopeOptionsEnabled": false, "scopeOptionsEnabled": false,
"formattingOptionsEnabled": false, "formattingOptionsEnabled": false,
"collapseMessageWithSubject": false, "collapseMessageWithSubject": false,
"scopeCopy": false,
"subjectLineBehavior": "email",
"hidePostStats": false, "hidePostStats": false,
"hideUserStats": false, "hideUserStats": false,
"loginMethod": "password" "loginMethod": "password"