Пример #1
0
    def follow(self, user_to_follow):
        if self == user_to_follow:
            raise ValueError("Can't follow self.")

        from canvas.notifications.actions import Actions
        Actions.followed_by_user(self, user_to_follow)

        self.redis.following.sadd(user_to_follow.id)
        user_to_follow.redis.followers.sadd(self.id)
Пример #2
0
    def follow(self, user_to_follow):
        if self == user_to_follow:
            raise ValueError("Can't follow self.")

        from canvas.notifications.actions import Actions
        Actions.followed_by_user(self, user_to_follow)

        self.redis.following.sadd(user_to_follow.id)
        user_to_follow.redis.followers.sadd(self.id)
Пример #3
0
    def follow(self, user_to_follow):
        from canvas.notifications.actions import Actions

        if self == user_to_follow:
            raise ValueError("Can't follow self.")

        if user_to_follow.id in self.redis.new_following:
            return

        self.redis.following.sadd(user_to_follow.id)
        self.redis.new_following.bump(user_to_follow.id)

        user_to_follow.redis.followers.sadd(self.id)
        user_to_follow.redis.new_followers.bump(self.id)

        Actions.followed_by_user(self, user_to_follow)

        user_to_follow.userinfo.refresh_follower_count()
        self._followed_or_unfollowed()
Пример #4
0
    def follow(self, user_to_follow):
        from canvas.notifications.actions import Actions

        if self == user_to_follow:
            raise ValueError("Can't follow self.")

        if user_to_follow.id in self.redis.new_following:
            return

        self.redis.following.sadd(user_to_follow.id)
        self.redis.new_following.bump(user_to_follow.id)

        user_to_follow.redis.followers.sadd(self.id)
        user_to_follow.redis.new_followers.bump(self.id)

        Actions.followed_by_user(self, user_to_follow)

        user_to_follow.userinfo.refresh_follower_count()
        self._followed_or_unfollowed()