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

View File

@ -85,6 +85,9 @@
<option value="followers">{{ $t('@.note-visibility.followers') }}</option> <option value="followers">{{ $t('@.note-visibility.followers') }}</option>
<option value="specified">{{ $t('@.note-visibility.specified') }}</option> <option value="specified">{{ $t('@.note-visibility.specified') }}</option>
<option value="private">{{ $t('@.note-visibility.private') }}</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> </ui-select>
</section> </section>
</section> </section>

View File

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

View File

@ -80,6 +80,9 @@
<option value="followers">{{ $t('@.note-visibility.followers') }}</option> <option value="followers">{{ $t('@.note-visibility.followers') }}</option>
<option value="specified">{{ $t('@.note-visibility.specified') }}</option> <option value="specified">{{ $t('@.note-visibility.specified') }}</option>
<option value="private">{{ $t('@.note-visibility.private') }}</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> </ui-select>
</section> </section>
</section> </section>