Merge branch 'hide_network' into 'develop'

FE part of pleroma!490

See merge request pleroma/pleroma-fe!415
This commit is contained in:
Shpuld Shpludson 2018-12-13 14:40:49 +00:00
commit ad905576fc
4 changed files with 46 additions and 25 deletions

View file

@ -4,11 +4,12 @@ import StyleSwitcher from '../style_switcher/style_switcher.vue'
const UserSettings = { const UserSettings = {
data () { data () {
return { return {
newname: this.$store.state.users.currentUser.name, newName: this.$store.state.users.currentUser.name,
newbio: this.$store.state.users.currentUser.description, newBio: this.$store.state.users.currentUser.description,
newlocked: this.$store.state.users.currentUser.locked, newLocked: this.$store.state.users.currentUser.locked,
newnorichtext: this.$store.state.users.currentUser.no_rich_text, newNoRichText: this.$store.state.users.currentUser.no_rich_text,
newdefaultScope: this.$store.state.users.currentUser.default_scope, newDefaultScope: this.$store.state.users.currentUser.default_scope,
newHideNetwork: this.$store.state.users.currentUser.hide_network,
followList: null, followList: null,
followImportError: false, followImportError: false,
followsImported: false, followsImported: false,
@ -40,31 +41,45 @@ const UserSettings = {
}, },
vis () { vis () {
return { return {
public: { selected: this.newdefaultScope === 'public' }, public: { selected: this.newDefaultScope === 'public' },
unlisted: { selected: this.newdefaultScope === 'unlisted' }, unlisted: { selected: this.newDefaultScope === 'unlisted' },
private: { selected: this.newdefaultScope === 'private' }, private: { selected: this.newDefaultScope === 'private' },
direct: { selected: this.newdefaultScope === 'direct' } direct: { selected: this.newDefaultScope === 'direct' }
} }
} }
}, },
methods: { methods: {
updateProfile () { updateProfile () {
const name = this.newname const name = this.newname
const description = this.newbio const description = this.newBio
const locked = this.newlocked const locked = this.newLocked
// Backend notation.
/* eslint-disable camelcase */ /* eslint-disable camelcase */
const default_scope = this.newdefaultScope const default_scope = this.newDefaultScope
const no_rich_text = this.newnorichtext const no_rich_text = this.newNoRichText
this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked, default_scope, no_rich_text}}).then((user) => { const hide_network = this.newHideNetwork
if (!user.error) {
this.$store.commit('addNewUsers', [user])
this.$store.commit('setCurrentUser', user)
}
})
/* eslint-enable camelcase */ /* eslint-enable camelcase */
this.$store.state.api.backendInteractor
.updateProfile({
params: {
name,
description,
locked,
// Backend notation.
/* eslint-disable camelcase */
default_scope,
no_rich_text,
hide_network
/* eslint-enable camelcase */
}}).then((user) => {
if (!user.error) {
this.$store.commit('addNewUsers', [user])
this.$store.commit('setCurrentUser', user)
}
})
}, },
changeVis (visibility) { changeVis (visibility) {
this.newdefaultScope = visibility this.newDefaultScope = visibility
}, },
uploadFile (slot, e) { uploadFile (slot, e) {
const file = e.target.files[0] const file = e.target.files[0]

View file

@ -9,11 +9,11 @@
<div class="setting-item" > <div class="setting-item" >
<h2>{{$t('settings.name_bio')}}</h2> <h2>{{$t('settings.name_bio')}}</h2>
<p>{{$t('settings.name')}}</p> <p>{{$t('settings.name')}}</p>
<input class='name-changer' id='username' v-model="newname"></input> <input class='name-changer' id='username' v-model="newName"></input>
<p>{{$t('settings.bio')}}</p> <p>{{$t('settings.bio')}}</p>
<textarea class="bio" v-model="newbio"></textarea> <textarea class="bio" v-model="newBio"></textarea>
<p> <p>
<input type="checkbox" v-model="newlocked" id="account-locked"> <input type="checkbox" v-model="newLocked" id="account-locked">
<label for="account-locked">{{$t('settings.lock_account_description')}}</label> <label for="account-locked">{{$t('settings.lock_account_description')}}</label>
</p> </p>
<div v-if="scopeOptionsEnabled"> <div v-if="scopeOptionsEnabled">
@ -26,10 +26,14 @@
</div> </div>
</div> </div>
<p> <p>
<input type="checkbox" v-model="newnorichtext" id="account-no-rich-text"> <input type="checkbox" v-model="newNoRichText" id="account-no-rich-text">
<label for="account-no-rich-text">{{$t('settings.no_rich_text_description')}}</label> <label for="account-no-rich-text">{{$t('settings.no_rich_text_description')}}</label>
</p> </p>
<button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button> <p>
<input type="checkbox" v-model="newHideNetwork" id="account-hide-network">
<label for="account-no-rich-text">{{$t('settings.hide_network_description')}}</label>
</p>
<button :disabled='newName.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<h2>{{$t('settings.avatar')}}</h2> <h2>{{$t('settings.avatar')}}</h2>

View file

@ -151,6 +151,7 @@
"notification_visibility_mentions": "Mentions", "notification_visibility_mentions": "Mentions",
"notification_visibility_repeats": "Repeats", "notification_visibility_repeats": "Repeats",
"no_rich_text_description": "Strip rich text formatting from all posts", "no_rich_text_description": "Strip rich text formatting from all posts",
"hide_network_description": "Don't show who I'm following and who's following me",
"nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding", "nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding",
"panelRadius": "Panels", "panelRadius": "Panels",
"pause_on_unfocused": "Pause streaming when tab is not focused", "pause_on_unfocused": "Pause streaming when tab is not focused",

View file

@ -126,6 +126,7 @@
"notification_visibility_mentions": "Упоминания", "notification_visibility_mentions": "Упоминания",
"notification_visibility_repeats": "Повторы", "notification_visibility_repeats": "Повторы",
"no_rich_text_description": "Убрать форматирование из всех постов", "no_rich_text_description": "Убрать форматирование из всех постов",
"hide_network_description": "Не показывать кого я читаю и кто меня читает",
"nsfw_clickthrough": "Включить скрытие NSFW вложений", "nsfw_clickthrough": "Включить скрытие NSFW вложений",
"panelRadius": "Панели", "panelRadius": "Панели",
"pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе", "pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе",