summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-12 14:34:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-12 14:34:54 +0900
commit9b253ccb3a122384ba3bfbdbe777b47c7a6b407c (patch)
treed32e4504f27a3eace542b00adaf718e4a04d38cc /src/client
parentRefactor and usability improvements (diff)
downloadsharkey-9b253ccb3a122384ba3bfbdbe777b47c7a6b407c.tar.gz
sharkey-9b253ccb3a122384ba3bfbdbe777b47c7a6b407c.tar.bz2
sharkey-9b253ccb3a122384ba3bfbdbe777b47c7a6b407c.zip
Refactor
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/scripts/note-mixin.ts20
-rw-r--r--src/client/app/desktop/api/post.ts8
-rw-r--r--src/client/app/desktop/views/components/notes.note.vue16
-rw-r--r--src/client/app/desktop/views/pages/deck/deck.note.vue16
-rw-r--r--src/client/app/mobile/api/post.ts1
-rw-r--r--src/client/app/mobile/views/components/note.vue20
6 files changed, 27 insertions, 54 deletions
diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts
index ac276dbe68..17182e2757 100644
--- a/src/client/app/common/scripts/note-mixin.ts
+++ b/src/client/app/common/scripts/note-mixin.ts
@@ -84,6 +84,26 @@ export default (opts: Opts = {}) => ({
},
methods: {
+ reply(viaKeyboard = false) {
+ (this as any).apis.post({
+ reply: this.appearNote,
+ animation: !viaKeyboard,
+ cb: () => {
+ this.focus();
+ }
+ });
+ },
+
+ renote(viaKeyboard = false) {
+ (this as any).apis.post({
+ renote: this.appearNote,
+ animation: !viaKeyboard,
+ cb: () => {
+ this.focus();
+ }
+ });
+ },
+
renoteDirectly() {
(this as any).api('notes/create', {
renoteId: this.appearNote.id
diff --git a/src/client/app/desktop/api/post.ts b/src/client/app/desktop/api/post.ts
index cfc78e50fa..77d6bc98ff 100644
--- a/src/client/app/desktop/api/post.ts
+++ b/src/client/app/desktop/api/post.ts
@@ -6,13 +6,17 @@ export default (os: OS) => opts => {
const o = opts || {};
if (o.renote) {
const vm = os.new(RenoteFormWindow, {
- note: o.renote
+ note: o.renote,
+ animation: o.animation == null ? true : o.animation
});
+ if (opts.cb) vm.$once('closed', opts.cb);
document.body.appendChild(vm.$el);
} else {
const vm = os.new(PostFormWindow, {
- reply: o.reply
+ reply: o.reply,
+ animation: o.animation == null ? true : o.animation
});
+ if (opts.cb) vm.$once('closed', opts.cb);
document.body.appendChild(vm.$el);
}
};
diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue
index a53759cf40..5df87406fc 100644
--- a/src/client/app/desktop/views/components/notes.note.vue
+++ b/src/client/app/desktop/views/components/notes.note.vue
@@ -82,22 +82,6 @@ export default Vue.extend({
type: Object,
required: true
}
- },
-
- methods: {
- reply(viaKeyboard = false) {
- (this as any).os.new(MkPostFormWindow, {
- reply: this.appearNote,
- animation: !viaKeyboard
- }).$once('closed', this.focus);
- },
-
- renote(viaKeyboard = false) {
- (this as any).os.new(MkRenoteFormWindow, {
- note: this.appearNote,
- animation: !viaKeyboard
- }).$once('closed', this.focus);
- },
}
});
</script>
diff --git a/src/client/app/desktop/views/pages/deck/deck.note.vue b/src/client/app/desktop/views/pages/deck/deck.note.vue
index 055bd71573..03cf3e2911 100644
--- a/src/client/app/desktop/views/pages/deck/deck.note.vue
+++ b/src/client/app/desktop/views/pages/deck/deck.note.vue
@@ -98,22 +98,6 @@ export default Vue.extend({
required: false,
default: false
}
- },
-
- methods: {
- reply(viaKeyboard = false) {
- (this as any).os.new(MkPostFormWindow, {
- reply: this.appearNote,
- animation: !viaKeyboard
- }).$once('closed', this.focus);
- },
-
- renote(viaKeyboard = false) {
- (this as any).os.new(MkRenoteFormWindow, {
- note: this.appearNote,
- animation: !viaKeyboard
- }).$once('closed', this.focus);
- },
}
});
</script>
diff --git a/src/client/app/mobile/api/post.ts b/src/client/app/mobile/api/post.ts
index 5c0f0af852..1077dc7a0d 100644
--- a/src/client/app/mobile/api/post.ts
+++ b/src/client/app/mobile/api/post.ts
@@ -18,6 +18,7 @@ export default (os) => (opts) => {
}).$mount();
vm.$once('cancel', recover);
vm.$once('posted', recover);
+ if (opts.cb) vm.$once('closed', opts.cb);
document.body.appendChild(vm.$el);
(vm as any).focus();
};
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index c68e6bf1aa..3ffa204472 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -89,26 +89,6 @@ export default Vue.extend({
type: Object,
required: true
}
- },
-
- data() {
- return {
- showContent: false
- };
- },
-
- methods: {
- reply() {
- (this as any).apis.post({
- reply: this.appearNote
- });
- },
-
- renote() {
- (this as any).apis.post({
- renote: this.appearNote
- });
- },
}
});
</script>