summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-30 14:34:32 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-30 14:34:32 +0900
commit7afa541a53c1b00e8f7fb6f5d211789b3e4c52bb (patch)
treec436302533b1d4fdae91eb87b31cc003077a4294 /src
parentRefactor (diff)
downloadsharkey-7afa541a53c1b00e8f7fb6f5d211789b3e4c52bb.tar.gz
sharkey-7afa541a53c1b00e8f7fb6f5d211789b3e4c52bb.tar.bz2
sharkey-7afa541a53c1b00e8f7fb6f5d211789b3e4c52bb.zip
Fix #3040
Diffstat (limited to 'src')
-rw-r--r--src/client/app/desktop/views/components/follow-button.vue14
-rw-r--r--src/client/app/mobile/views/components/follow-button.vue22
-rw-r--r--src/services/blocking/create.ts8
-rw-r--r--src/services/following/create.ts4
-rw-r--r--src/services/following/delete.ts4
-rw-r--r--src/services/following/requests/accept.ts4
-rw-r--r--src/services/following/requests/reject.ts4
7 files changed, 31 insertions, 29 deletions
diff --git a/src/client/app/desktop/views/components/follow-button.vue b/src/client/app/desktop/views/components/follow-button.vue
index 4d3d61dfe0..11291a2f19 100644
--- a/src/client/app/desktop/views/components/follow-button.vue
+++ b/src/client/app/desktop/views/components/follow-button.vue
@@ -40,8 +40,8 @@ export default Vue.extend({
mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main');
- this.connection.on('follow', this.onFollow);
- this.connection.on('unfollow', this.onUnfollow);
+ this.connection.on('follow', this.onFollowChange);
+ this.connection.on('unfollow', this.onFollowChange);
},
beforeDestroy() {
@@ -49,17 +49,11 @@ export default Vue.extend({
},
methods: {
- onFollow(user) {
- if (user.id == this.u.id) {
- this.u.isFollowing = user.isFollowing;
- this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
- }
- },
-
- onUnfollow(user) {
+ onFollowChange(user) {
if (user.id == this.u.id) {
this.u.isFollowing = user.isFollowing;
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
+ this.$forceUpdate();
}
},
diff --git a/src/client/app/mobile/views/components/follow-button.vue b/src/client/app/mobile/views/components/follow-button.vue
index 3c8b2f98e6..1bf08802bd 100644
--- a/src/client/app/mobile/views/components/follow-button.vue
+++ b/src/client/app/mobile/views/components/follow-button.vue
@@ -17,6 +17,7 @@
<script lang="ts">
import Vue from 'vue';
+
export default Vue.extend({
props: {
user: {
@@ -24,6 +25,7 @@ export default Vue.extend({
required: true
}
},
+
data() {
return {
u: this.user,
@@ -31,28 +33,24 @@ export default Vue.extend({
connection: null
};
},
+
mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main');
- this.connection.on('follow', this.onFollow);
- this.connection.on('unfollow', this.onUnfollow);
+ this.connection.on('follow', this.onFollowChange);
+ this.connection.on('unfollow', this.onFollowChange);
},
+
beforeDestroy() {
this.connection.dispose();
},
- methods: {
-
- onFollow(user) {
- if (user.id == this.u.id) {
- this.u.isFollowing = user.isFollowing;
- this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
- }
- },
- onUnfollow(user) {
+ methods: {
+ onFollowChange(user) {
if (user.id == this.u.id) {
this.u.isFollowing = user.isFollowing;
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
+ this.$forceUpdate();
}
},
@@ -90,8 +88,6 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
-
-
.mk-follow-button
display block
user-select none
diff --git a/src/services/blocking/create.ts b/src/services/blocking/create.ts
index 11b2954af6..2998cdd78c 100644
--- a/src/services/blocking/create.ts
+++ b/src/services/blocking/create.ts
@@ -60,7 +60,9 @@ async function cancelRequest(follower: IUser, followee: IUser) {
}
if (isLocalUser(follower)) {
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'unfollow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'unfollow', packed));
}
// リモートにフォローリクエストをしていたらUndoFollow送信
@@ -110,7 +112,9 @@ async function unFollow(follower: IUser, followee: IUser) {
// Publish unfollow event
if (isLocalUser(follower)) {
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'unfollow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'unfollow', packed));
}
// リモートにフォローをしていたらUndoFollow送信
diff --git a/src/services/following/create.ts b/src/services/following/create.ts
index f35033a1cb..46b818f8bb 100644
--- a/src/services/following/create.ts
+++ b/src/services/following/create.ts
@@ -87,7 +87,9 @@ export default async function(follower: IUser, followee: IUser, requestId?: stri
// Publish follow event
if (isLocalUser(follower)) {
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'follow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'follow', packed));
}
// Publish followed event
diff --git a/src/services/following/delete.ts b/src/services/following/delete.ts
index 9f82af2bf4..dce178a927 100644
--- a/src/services/following/delete.ts
+++ b/src/services/following/delete.ts
@@ -42,7 +42,9 @@ export default async function(follower: IUser, followee: IUser) {
// Publish unfollow event
if (isLocalUser(follower)) {
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'unfollow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'unfollow', packed));
}
if (isLocalUser(follower) && isRemoteUser(followee)) {
diff --git a/src/services/following/requests/accept.ts b/src/services/following/requests/accept.ts
index 32453c74dc..97cd733b2e 100644
--- a/src/services/following/requests/accept.ts
+++ b/src/services/following/requests/accept.ts
@@ -70,5 +70,7 @@ export default async function(followee: IUser, follower: IUser) {
detail: true
}).then(packed => publishMainStream(followee._id, 'meUpdated', packed));
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'follow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'follow', packed));
}
diff --git a/src/services/following/requests/reject.ts b/src/services/following/requests/reject.ts
index 73dbbb92e0..694663f231 100644
--- a/src/services/following/requests/reject.ts
+++ b/src/services/following/requests/reject.ts
@@ -28,5 +28,7 @@ export default async function(followee: IUser, follower: IUser) {
}
});
- packUser(followee, follower).then(packed => publishMainStream(follower._id, 'unfollow', packed));
+ packUser(followee, follower, {
+ detail: true
+ }).then(packed => publishMainStream(follower._id, 'unfollow', packed));
}