diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index c9771dcdf..930dd8875 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -122,6 +122,7 @@ export default { const [emotionsCount] = transactionRes.records.map(record => { return record.get('emotionsCount').low }) + return emotionsCount }, postsEmotionsCountByCurrentUser: async (object, params, context, resolveInfo) => { diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 1d63e1958..13ad5fbf4 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -492,6 +492,36 @@ import Factory from './factories' to: 'p15', data: 'surprised', }), + f.emote({ + from: 'u2', + to: 'p15', + data: 'surprised', + }), + f.emote({ + from: 'u3', + to: 'p15', + data: 'surprised', + }), + f.emote({ + from: 'u4', + to: 'p15', + data: 'surprised', + }), + f.emote({ + from: 'u5', + to: 'p15', + data: 'surprised', + }), + f.emote({ + from: 'u6', + to: 'p15', + data: 'surprised', + }), + f.emote({ + from: 'u7', + to: 'p15', + data: 'surprised', + }), f.emote({ from: 'u2', to: 'p14', diff --git a/webapp/components/EmotionsButtons/EmotionsButtons.vue b/webapp/components/EmotionsButtons/EmotionsButtons.vue index 8f4774d26..c8a1b9f86 100644 --- a/webapp/components/EmotionsButtons/EmotionsButtons.vue +++ b/webapp/components/EmotionsButtons/EmotionsButtons.vue @@ -38,7 +38,7 @@ export default { currentUser: 'auth/user', }), }, - mounted() { + created() { Object.keys(this.postsEmotionsCountByEmotion).map(emotion => { this.emotionsCount(emotion) }) @@ -66,6 +66,7 @@ export default { this.isActive(emotion) ? this.postsEmotionsCountByEmotion[emotion]-- : this.postsEmotionsCountByEmotion[emotion]++ + const index = this.selectedEmotions.indexOf(emotion) if (index > -1) { this.selectedEmotions.splice(index, 1) @@ -90,6 +91,7 @@ export default { } `, variables: { postId: this.post.id, data: { emotion } }, + fetchPolicy: 'no-cache', }) .then(({ data: { postsEmotionsCountByEmotion } }) => { this.postsEmotionsCountByEmotion[emotion] = postsEmotionsCountByEmotion diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js index ed0bce548..8c67125b4 100644 --- a/webapp/graphql/PostMutations.js +++ b/webapp/graphql/PostMutations.js @@ -64,6 +64,12 @@ export default () => { mutation($from: _UserInput!, $to: _PostInput!, $data: _EMOTEDInput!) { AddPostEmotions(from: $from, to: $to, data: $data) { emotion + from { + id + } + to { + id + } } } `, diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 5aaea93ca..550602748 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -221,8 +221,5 @@ export default { .shout-button { float: left; } - // .emotions-buttons-mobile { - // margin-top: -80px; - // } }