Beispiel #1
0
        public async Task UnfollowUserId(long userId)
        {
            if (logger.IsVerbose)
            {
                logger.Verbose("{0} UnfollowUserId({1}).", Me, userId);
            }
            IMsgPublisher userToUnfollow = GrainFactory.GetGrain <IMsgPublisher>(userId);
            string        alias          = await userToUnfollow.GetUserAlias();

            await UnfollowUser(userId, alias, userToUnfollow);
        }
Beispiel #2
0
        private async Task UnfollowUser(long userId, string userAlias, IMsgPublisher userToUnfollow)
        {
            await userToUnfollow.RemoveFollower(State.UserAlias, this);

            ConnectorInfo userInfo = ConnectorInfo.GetUserInfo(userId, userAlias);

            State.Subscriptions.Remove(userInfo);

            await WriteStateAsync();

            // Notify any viewers that a subscription has been removed for this user
            viewers.Notify(
                v => v.SubscriptionRemoved(userInfo)
                );
        }
Beispiel #3
0
        private async Task FollowUser(long userId, string userAlias, IMsgPublisher userToFollow)
        {
            if (logger.IsVerbose)
            {
                logger.Verbose("{0} FollowUser({1}).", Me, userAlias);
            }
            await userToFollow.AddFollower(State.UserAlias, State.UserId, this);

            ConnectorInfo userInfo = ConnectorInfo.GetUserInfo(userId, userAlias);

            State.Subscriptions[userInfo] = userToFollow;

            await WriteStateAsync();

            // Notify any viewers that a subscription has been added for this user
            viewers.Notify(
                v => v.SubscriptionAdded(userInfo)
                );
        }