summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/desktop/views/components/follow-button.vue14
-rw-r--r--src/client/app/mobile/views/components/follow-button.vue22
2 files changed, 13 insertions, 23 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