Fix #3040
This commit is contained in:
parent
d399241e65
commit
7afa541a53
@ -40,8 +40,8 @@ export default Vue.extend({
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||||
this.connection.on('follow', this.onFollow);
|
this.connection.on('follow', this.onFollowChange);
|
||||||
this.connection.on('unfollow', this.onUnfollow);
|
this.connection.on('unfollow', this.onFollowChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
@ -49,17 +49,11 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onFollow(user) {
|
onFollowChange(user) {
|
||||||
if (user.id == this.u.id) {
|
|
||||||
this.u.isFollowing = user.isFollowing;
|
|
||||||
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onUnfollow(user) {
|
|
||||||
if (user.id == this.u.id) {
|
if (user.id == this.u.id) {
|
||||||
this.u.isFollowing = user.isFollowing;
|
this.u.isFollowing = user.isFollowing;
|
||||||
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
||||||
|
this.$forceUpdate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
@ -24,6 +25,7 @@ export default Vue.extend({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
u: this.user,
|
u: this.user,
|
||||||
@ -31,28 +33,24 @@ export default Vue.extend({
|
|||||||
connection: null
|
connection: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||||
|
|
||||||
this.connection.on('follow', this.onFollow);
|
this.connection.on('follow', this.onFollowChange);
|
||||||
this.connection.on('unfollow', this.onUnfollow);
|
this.connection.on('unfollow', this.onFollowChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.connection.dispose();
|
this.connection.dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onFollowChange(user) {
|
||||||
onFollow(user) {
|
|
||||||
if (user.id == this.u.id) {
|
|
||||||
this.u.isFollowing = user.isFollowing;
|
|
||||||
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onUnfollow(user) {
|
|
||||||
if (user.id == this.u.id) {
|
if (user.id == this.u.id) {
|
||||||
this.u.isFollowing = user.isFollowing;
|
this.u.isFollowing = user.isFollowing;
|
||||||
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
this.u.hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
||||||
|
this.$forceUpdate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -90,8 +88,6 @@ export default Vue.extend({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
|
|
||||||
|
|
||||||
.mk-follow-button
|
.mk-follow-button
|
||||||
display block
|
display block
|
||||||
user-select none
|
user-select none
|
||||||
|
@ -60,7 +60,9 @@ async function cancelRequest(follower: IUser, followee: IUser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLocalUser(follower)) {
|
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送信
|
// リモートにフォローリクエストをしていたらUndoFollow送信
|
||||||
@ -110,7 +112,9 @@ async function unFollow(follower: IUser, followee: IUser) {
|
|||||||
|
|
||||||
// Publish unfollow event
|
// Publish unfollow event
|
||||||
if (isLocalUser(follower)) {
|
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送信
|
// リモートにフォローをしていたらUndoFollow送信
|
||||||
|
@ -87,7 +87,9 @@ export default async function(follower: IUser, followee: IUser, requestId?: stri
|
|||||||
|
|
||||||
// Publish follow event
|
// Publish follow event
|
||||||
if (isLocalUser(follower)) {
|
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
|
// Publish followed event
|
||||||
|
@ -42,7 +42,9 @@ export default async function(follower: IUser, followee: IUser) {
|
|||||||
|
|
||||||
// Publish unfollow event
|
// Publish unfollow event
|
||||||
if (isLocalUser(follower)) {
|
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)) {
|
if (isLocalUser(follower) && isRemoteUser(followee)) {
|
||||||
|
@ -70,5 +70,7 @@ export default async function(followee: IUser, follower: IUser) {
|
|||||||
detail: true
|
detail: true
|
||||||
}).then(packed => publishMainStream(followee._id, 'meUpdated', packed));
|
}).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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user