summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-10-19 14:46:55 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-10-19 14:46:55 +0900
commit190d1bbf3c5aadc2d929c99056928b33e4834d5a (patch)
treeb34f8275781bd0df9e3fd5db51c1d70304f5e0b4 /src
parentAdd note (diff)
downloadsharkey-190d1bbf3c5aadc2d929c99056928b33e4834d5a.tar.gz
sharkey-190d1bbf3c5aadc2d929c99056928b33e4834d5a.tar.bz2
sharkey-190d1bbf3c5aadc2d929c99056928b33e4834d5a.zip
デフォルト公開範囲が機能していない問題を修正
Diffstat (limited to 'src')
-rw-r--r--src/client/components/post-form-dialog.vue2
-rw-r--r--src/client/components/post-form.vue56
-rw-r--r--src/client/components/visibility-picker.vue9
3 files changed, 29 insertions, 38 deletions
diff --git a/src/client/components/post-form-dialog.vue b/src/client/components/post-form-dialog.vue
index f2563a9bec..ae1cd7f01e 100644
--- a/src/client/components/post-form-dialog.vue
+++ b/src/client/components/post-form-dialog.vue
@@ -1,6 +1,6 @@
<template>
<MkModal ref="modal" @click="$refs.modal.close()" @closed="$emit('closed')" :position="'top'">
- <MkPostForm @done="$refs.modal.close()" @esc="$refs.modal.close()" v-bind="$attrs"/>
+ <MkPostForm @posted="$refs.modal.close()" @cancel="$refs.modal.close()" @esc="$refs.modal.close()" v-bind="$attrs"/>
</MkModal>
</template>
diff --git a/src/client/components/post-form.vue b/src/client/components/post-form.vue
index ba7770345a..ccca4b54a6 100644
--- a/src/client/components/post-form.vue
+++ b/src/client/components/post-form.vue
@@ -125,7 +125,7 @@ export default defineComponent({
},
},
- emits: ['posted', 'done', 'esc'],
+ emits: ['posted', 'cancel', 'esc'],
data() {
return {
@@ -135,8 +135,8 @@ export default defineComponent({
poll: null,
useCw: false,
cw: null,
- localOnly: false,
- visibility: 'public',
+ localOnly: this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.localOnly : this.$store.state.settings.defaultNoteLocalOnly,
+ visibility: this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.visibility : this.$store.state.settings.defaultNoteVisibility,
visibleUsers: [],
autocomplete: null,
draghover: false,
@@ -202,12 +202,6 @@ export default defineComponent({
}
},
- watch: {
- localOnly() {
- this.$store.commit('deviceUser/setLocalOnly', this.localOnly);
- }
- },
-
mounted() {
if (this.initialText) {
this.text = this.initialText;
@@ -239,11 +233,9 @@ export default defineComponent({
}
}
- // デフォルト公開範囲
- if (this.channel == null) {
- this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.visibility : this.$store.state.settings.defaultNoteVisibility);
-
- this.localOnly = this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.localOnly : this.$store.state.settings.defaultNoteLocalOnly;
+ if (this.channel) {
+ this.visibility = 'public';
+ this.localOnly = true; // TODO: チャンネルが連合するようになった折には消す
}
// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
@@ -295,7 +287,7 @@ export default defineComponent({
this.text = draft.data.text;
this.useCw = draft.data.useCw;
this.cw = draft.data.cw;
- this.applyVisibility(draft.data.visibility);
+ this.visibility = draft.data.visibility;
this.localOnly = draft.data.localOnly;
this.files = (draft.data.files || []).filter(e => e);
if (draft.data.poll) {
@@ -398,18 +390,20 @@ export default defineComponent({
src: this.$refs.visibilityButton
}, {
changeVisibility: visibility => {
- this.applyVisibility(visibility);
+ this.visibility = visibility;
+ if (this.$store.state.settings.rememberNoteVisibility) {
+ this.$store.commit('deviceUser/setVisibility', visibility);
+ }
},
changeLocalOnly: localOnly => {
this.localOnly = localOnly;
+ if (this.$store.state.settings.rememberNoteVisibility) {
+ this.$store.commit('deviceUser/setLocalOnly', localOnly);
+ }
}
}, 'closed');
},
- applyVisibility(v: string) {
- this.visibility = (noteVisibilities as unknown as string[]).includes(v) ? v : 'public'; // v11互換性のため
- },
-
addVisibleUser() {
os.selectUser().then(user => {
this.visibleUsers.push(user);
@@ -556,23 +550,23 @@ export default defineComponent({
this.posting = true;
os.api('notes/create', data).then(() => {
this.clear();
- this.deleteDraft();
- this.$emit('posted');
+ this.$nextTick(() => {
+ this.deleteDraft();
+ this.$emit('posted');
+ if (this.text && this.text != '') {
+ const hashtags = parse(this.text).filter(x => x.node.type === 'hashtag').map(x => x.node.props.hashtag);
+ const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
+ localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
+ }
+ this.posting = false;
+ });
}).catch(err => {
- }).then(() => {
this.posting = false;
- this.$emit('done');
});
-
- if (this.text && this.text != '') {
- const hashtags = parse(this.text).filter(x => x.node.type === 'hashtag').map(x => x.node.props.hashtag);
- const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
- localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
- }
},
cancel() {
- this.$emit('done');
+ this.$emit('cancel');
},
insertMention() {
diff --git a/src/client/components/visibility-picker.vue b/src/client/components/visibility-picker.vue
index 06901378b7..f0cff5db63 100644
--- a/src/client/components/visibility-picker.vue
+++ b/src/client/components/visibility-picker.vue
@@ -55,11 +55,11 @@ export default defineComponent({
props: {
currentVisibility: {
type: String,
- required: false
+ required: true
},
currentLocalOnly: {
type: Boolean,
- required: false
+ required: true
},
src: {
required: false
@@ -68,7 +68,7 @@ export default defineComponent({
emits: ['change-visibility', 'change-local-only', 'closed'],
data() {
return {
- v: this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.visibility : (this.currentVisibility || this.$store.state.settings.defaultNoteVisibility),
+ v: this.currentVisibility,
localOnly: this.currentLocalOnly,
faGlobe, faUnlock, faEnvelope, faHome, faBiohazard, faToggleOn, faToggleOff
}
@@ -81,9 +81,6 @@ export default defineComponent({
methods: {
choose(visibility) {
this.v = visibility;
- if (this.$store.state.settings.rememberNoteVisibility) {
- this.$store.commit('deviceUser/setVisibility', visibility);
- }
this.$emit('change-visibility', visibility);
this.$nextTick(() => {
this.$refs.modal.close();