To able to store local only visibilities (#3298)

This commit is contained in:
MeiMei 2018-11-17 13:21:40 +09:00 committed by syuilo
parent 6c72545fc8
commit 35db61f1b4
4 changed files with 36 additions and 27 deletions

View file

@ -111,7 +111,7 @@ export default Vue.extend({
useCw: false,
cw: null,
geo: null,
visibility: this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility,
visibility: 'public',
visibleUsers: [],
localOnly: false,
autocomplete: null,
@ -195,6 +195,9 @@ export default Vue.extend({
});
}
//
this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility);
//
if (this.reply && ['home', 'followers', 'specified', 'private'].includes(this.reply.visibility)) {
this.visibility = this.reply.visibility;
@ -365,17 +368,21 @@ export default Vue.extend({
source: this.$refs.visibilityButton
});
w.$once('chosen', v => {
const m = v.match(/^local-(.+)/);
if (m) {
this.localOnly = true;
this.visibility = m[1];
} else {
this.localOnly = false;
this.visibility = v;
}
this.applyVisibility(v);
});
},
applyVisibility(v :string) {
const m = v.match(/^local-(.+)/);
if (m) {
this.localOnly = true;
this.visibility = m[1];
} else {
this.localOnly = false;
this.visibility = v;
}
},
addVisibleUser() {
this.$input({
title: this.$t('enter-username')

View file

@ -85,6 +85,9 @@
<option value="followers">{{ $t('@.note-visibility.followers') }}</option>
<option value="specified">{{ $t('@.note-visibility.specified') }}</option>
<option value="private">{{ $t('@.note-visibility.private') }}</option>
<option value="local-public">{{ $t('@.note-visibility.local-public') }}</option>
<option value="local-home">{{ $t('@.note-visibility.local-home') }}</option>
<option value="local-followers">{{ $t('@.note-visibility.local-followers') }}</option>
</ui-select>
</section>
</section>

View file

@ -100,7 +100,7 @@ export default Vue.extend({
files: [],
poll: false,
geo: null,
visibility: this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility,
visibility: 'public',
visibleUsers: [],
localOnly: false,
useCw: false,
@ -184,6 +184,9 @@ export default Vue.extend({
});
}
//
this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility);
//
if (this.reply && ['home', 'followers', 'specified', 'private'].includes(this.reply.visibility)) {
this.visibility = this.reply.visibility;
@ -275,26 +278,19 @@ export default Vue.extend({
compact: true
});
w.$once('chosen', v => {
const m = v.match(/^local-(.+)/);
if (m) {
this.localOnly = true;
this.visibility = m[1];
} else {
this.localOnly = false;
this.visibility = v;
}
this.applyVisibility(v);
});
},
addVisibleUser() {
this.$input({
title: this.$t('username-prompt')
}).then(acct => {
if (acct.startsWith('@')) acct = acct.substr(1);
this.$root.api('users/show', parseAcct(acct)).then(user => {
this.visibleUsers.push(user);
});
});
applyVisibility(v :string) {
const m = v.match(/^local-(.+)/);
if (m) {
this.localOnly = true;
this.visibility = m[1];
} else {
this.localOnly = false;
this.visibility = v;
}
},
removeVisibleUser(user) {

View file

@ -80,6 +80,9 @@
<option value="followers">{{ $t('@.note-visibility.followers') }}</option>
<option value="specified">{{ $t('@.note-visibility.specified') }}</option>
<option value="private">{{ $t('@.note-visibility.private') }}</option>
<option value="local-public">{{ $t('@.note-visibility.local-public') }}</option>
<option value="local-home">{{ $t('@.note-visibility.local-home') }}</option>
<option value="local-followers">{{ $t('@.note-visibility.local-followers') }}</option>
</ui-select>
</section>
</section>