diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index bd7a3b94a..cbd0dc891 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -1,6 +1,6 @@
- +
  • @@ -19,8 +19,8 @@

    のこり{ 1000 - refs.text.value.length }文字

    -
    @@ -323,6 +323,29 @@ // https://github.com/riot/riot/issues/2080 if (this.inReplyToPost == '') this.inReplyToPost = null; + this.repost = this.opts.repost; + + // https://github.com/riot/riot/issues/2080 + if (this.repost == '') this.repost = null; + + this.placeholder = this.repost + ? 'この投稿を引用...' + : this.inReplyToPost + ? 'この投稿への返信...' + : 'いまどうしてる?'; + + this.submitText = this.repost + ? 'Repost' + : this.inReplyToPost + ? '返信' + : '投稿'; + + this.draftId = this.repost + ? 'draft-repost-' + this.repost.id + : this.inReplyToPost + ? 'draft-reply-' + this.inReplyToPost.id + : 'draft'; + this.on('mount', () => { this.refs.uploader.on('uploaded', file => { this.addFile(file); @@ -336,7 +359,7 @@ this.autocomplete.attach(); // 書きかけの投稿を復元 - let draft = localStorage.getItem('post-draft'); + let draft = localStorage.getItem(this.draftId); if (draft) { draft = JSON.parse(draft); this.refs.text.value = draft.text; @@ -457,17 +480,26 @@ : undefined; this.api('posts/create', { - text: this.refs.text.value, + text: this.refs.text.value == '' ? undefined : this.refs.text.value, media_ids: files, reply_to_id: this.inReplyToPost ? this.inReplyToPost.id : undefined, + repost_id: this.repost ? this.repost.id : undefined, poll: this.poll ? this.refs.poll.get() : undefined }).then(data => { this.clear(); this.trigger('post'); - localStorage.removeItem('post-draft'); - this.notify(this.inReplyToPost ? '返信しました!' : '投稿しました!'); + localStorage.removeItem(this.draftId); + this.notify(this.repost + ? 'Repostしました!' + : this.inReplyToPost + ? '返信しました!' + : '投稿しました!'); }).catch(err => { - this.notify('投稿できませんでした'); + this.notify(this.repost + ? 'Repostできませんでした' + : this.inReplyToPost + ? '返信できませんでした' + : '投稿できませんでした'); }).then(() => { this.update({ wait: false @@ -485,12 +517,12 @@ this.save = () => { const context = { - text: this.refs.text.value == '' ? undefined : this.refs.text.value, + text: this.refs.text.value, files: this.files, poll: this.poll && this.refs.poll ? this.refs.poll.get() : undefined }; - localStorage.setItem('post-draft', JSON.stringify(context)); + localStorage.setItem(this.draftId, JSON.stringify(context)); }; diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag index e5101d9f2..2bbed8aca 100644 --- a/src/web/app/desktop/tags/repost-form.tag +++ b/src/web/app/desktop/tags/repost-form.tag @@ -1,50 +1,21 @@ -
    - -
    - + +
    + 引用する... + + +
    +
    + + +