Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
acid-chicken authored and mei23 committed Aug 8, 2019
1 parent 1d83540 commit e0f2012
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 43 deletions.
1 change: 1 addition & 0 deletions src/client/app/common/views/components/note-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default Vue.extend({
this.destroyDom();
});
this.$post({
initialText: this.note.text,
initialNote: this.note,
reply: this.note.reply,
});
Expand Down
53 changes: 31 additions & 22 deletions src/client/app/desktop/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,32 +294,41 @@ export default Vue.extend({
}
}
this.$nextTick(() => this.watch());
});
this.$nextTick(() => {
if (this.initialNote) {
// 削除して編集
const init = this.initialNote;
this.text =
this.normalizedText(this.initialText) ||
this.normalizedText(this.text) ||
this.normalizedText(init.text) || '';
this.files = init.files;
this.cw = init.cw;
this.useCw = init.cw != null;
if (init.poll) {
this.poll = true;
this.$nextTick(() => {
(this.$refs.poll as any).set({
choices: init.poll.choices.map(c => c.text),
multiple: init.poll.multiple
});
});
}
this.visibility = init.visibility;
this.localOnly = init.localOnly;
this.quoteId = init.renote ? init.renote.id : null;
}
if (this.initialNote) {
// 削除して編集
const init = this.initialNote;
this.text = init.text ? init.text : '';
this.files = init.files;
this.cw = init.cw;
this.useCw = init.cw != null;
if (init.poll) {
this.poll = true;
this.$nextTick(() => {
(this.$refs.poll as any).set({
choices: init.poll.choices.map(c => c.text),
multiple: init.poll.multiple
});
});
}
this.visibility = init.visibility;
this.localOnly = init.localOnly;
this.quoteId = init.renote ? init.renote.id : null;
}
this.$nextTick(() => this.watch());
});
});
},
methods: {
normalizedText(maybeText?: string | null) {
return typeof maybeText === 'string' && this.trimmedLength(maybeText) ? maybeText : null;
},
trimmedLength(text: string) {
return length(text.trim());
},
Expand Down
49 changes: 28 additions & 21 deletions src/client/app/mobile/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,32 +242,39 @@ export default Vue.extend({
this.focus();
this.$nextTick(() => {
this.focus();
});
if (this.initialNote) {
// 削除して編集
const init = this.initialNote;
this.text = init.text ? init.text : '';
this.files = init.files;
this.cw = init.cw;
this.useCw = init.cw != null;
if (init.poll) {
this.poll = true;
this.$nextTick(() => {
(this.$refs.poll as any).set({
choices: init.poll.choices.map(c => c.text),
multiple: init.poll.multiple
if (this.initialNote) {
// 削除して編集
const init = this.initialNote;
this.text =
this.normalizedText(this.initialText) ||
this.normalizedText(this.text) ||
this.normalizedText(init.text) || '';
this.files = init.files;
this.cw = init.cw;
this.useCw = init.cw != null;
if (init.poll) {
this.poll = true;
this.$nextTick(() => {
(this.$refs.poll as any).set({
choices: init.poll.choices.map(c => c.text),
multiple: init.poll.multiple
});
});
});
}
this.visibility = init.visibility;
this.localOnly = init.localOnly;
this.quoteId = init.renote ? init.renote.id : null;
}
this.visibility = init.visibility;
this.localOnly = init.localOnly;
this.quoteId = init.renote ? init.renote.id : null;
}
this.$nextTick(this.focus);
});
},
methods: {
normalizedText(maybeText?: string | null) {
return typeof maybeText === 'string' && this.trimmedLength(maybeText) ? maybeText : null;
},
trimmedLength(text: string) {
return length(text.trim());
},
Expand Down

0 comments on commit e0f2012

Please sign in to comment.