summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-20 05:43:27 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-20 05:43:27 +0900
commit95440dffb5015539e11cf4107472f6793efae120 (patch)
tree3a8450e57e6dad14f1c5da91fc267bb539d3aa27 /src/web
parent[Client] 良い感じに (diff)
downloadmisskey-95440dffb5015539e11cf4107472f6793efae120.tar.gz
misskey-95440dffb5015539e11cf4107472f6793efae120.tar.bz2
misskey-95440dffb5015539e11cf4107472f6793efae120.zip
[Client] 良い感じに
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/common/tags/reactions-viewer.tag6
-rw-r--r--src/web/app/desktop/tags/timeline-post.tag33
-rw-r--r--src/web/app/mobile/tags/timeline-post.tag33
3 files changed, 55 insertions, 17 deletions
diff --git a/src/web/app/common/tags/reactions-viewer.tag b/src/web/app/common/tags/reactions-viewer.tag
index b289d89e85..f32f5466a3 100644
--- a/src/web/app/common/tags/reactions-viewer.tag
+++ b/src/web/app/common/tags/reactions-viewer.tag
@@ -24,6 +24,10 @@
</style>
<script>
- this.reactions = this.opts.post.reaction_counts;
+ this.post = this.opts.post;
+
+ this.on('update', () => {
+ this.reactions = this.post.reaction_counts;
+ });
</script>
</mk-reactions-viewer>
diff --git a/src/web/app/desktop/tags/timeline-post.tag b/src/web/app/desktop/tags/timeline-post.tag
index 998def6e42..8c3b7c9be1 100644
--- a/src/web/app/desktop/tags/timeline-post.tag
+++ b/src/web/app/desktop/tags/timeline-post.tag
@@ -46,7 +46,7 @@
</div>
</div>
<footer>
- <mk-reactions-viewer post={ p }></mk-reactions-viewer>
+ <mk-reactions-viewer post={ p } ref="reactionsViewer"></mk-reactions-viewer>
<button onclick={ reply } title="返信"><i class="fa fa-reply"></i>
<p class="count" if={ p.replies_count > 0 }>{ p.replies_count }</p>
</button>
@@ -336,12 +336,28 @@
this.isDetailOpened = false;
- this.post = this.opts.post;
- this.isRepost = this.post.repost && this.post.text == null && this.post.media_ids == null && this.post.poll == null;
- this.p = this.isRepost ? this.post.repost : this.post;
- this.p.reactions_count = this.p.reaction_counts ? Object.keys(this.p.reaction_counts).map(key => this.p.reaction_counts[key]).reduce((a, b) => a + b) : 0;
- this.title = dateStringify(this.p.created_at);
- this.url = `/${this.p.user.username}/${this.p.id}`;
+ this.set = post => {
+ this.post = post;
+ this.isRepost = this.post.repost && this.post.text == null && this.post.media_ids == null && this.post.poll == null;
+ this.p = this.isRepost ? this.post.repost : this.post;
+ this.p.reactions_count = this.p.reaction_counts ? Object.keys(this.p.reaction_counts).map(key => this.p.reaction_counts[key]).reduce((a, b) => a + b) : 0;
+ this.title = dateStringify(this.p.created_at);
+ this.url = `/${this.p.user.username}/${this.p.id}`;
+ };
+
+ this.set(this.opts.post);
+
+ this.refresh = () => {
+ this.api('posts/show', {
+ post_id: this.post.id
+ }).then(post => {
+ this.set(post);
+ this.update();
+ if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
+ post
+ });
+ });
+ };
this.on('mount', () => {
if (this.p.text) {
@@ -379,7 +395,8 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
- post: this.p
+ post: this.p,
+ cb: this.refresh
});
};
diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag
index 064cdcda90..71d00128b4 100644
--- a/src/web/app/mobile/tags/timeline-post.tag
+++ b/src/web/app/mobile/tags/timeline-post.tag
@@ -43,7 +43,7 @@
</div>
</div>
<footer>
- <mk-reactions-viewer post={ p }></mk-reactions-viewer>
+ <mk-reactions-viewer post={ p } ref="reactionsViewer"></mk-reactions-viewer>
<button onclick={ reply }><i class="fa fa-reply"></i>
<p class="count" if={ p.replies_count > 0 }>{ p.replies_count }</p>
</button>
@@ -312,12 +312,28 @@
import getPostSummary from '../../common/scripts/get-post-summary';
import openPostForm from '../scripts/open-post-form';
- this.post = this.opts.post;
- this.isRepost = this.post.repost != null && this.post.text == null;
- this.p = this.isRepost ? this.post.repost : this.post;
- this.p.reactions_count = this.p.reaction_counts ? Object.keys(this.p.reaction_counts).map(key => this.p.reaction_counts[key]).reduce((a, b) => a + b) : 0;
- this.summary = getPostSummary(this.p);
- this.url = `/${this.p.user.username}/${this.p.id}`;
+ this.set = post => {
+ this.post = post;
+ this.isRepost = this.post.repost != null && this.post.text == null;
+ this.p = this.isRepost ? this.post.repost : this.post;
+ this.p.reactions_count = this.p.reaction_counts ? Object.keys(this.p.reaction_counts).map(key => this.p.reaction_counts[key]).reduce((a, b) => a + b) : 0;
+ this.summary = getPostSummary(this.p);
+ this.url = `/${this.p.user.username}/${this.p.id}`;
+ };
+
+ this.set(this.opts.post);
+
+ this.refresh = () => {
+ this.api('posts/show', {
+ post_id: this.post.id
+ }).then(post => {
+ this.set(post);
+ this.update();
+ if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
+ post
+ });
+ });
+ };
this.on('mount', () => {
if (this.p.text) {
@@ -358,7 +374,8 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
- post: this.p
+ post: this.p,
+ cb: this.refresh
});
};
</script>