示例#1
0
    def notify_followers_of_signup(self, access_token, access_token_secret):
        from canvas.models import FriendJoinedNotificationReceipt

        if self.user is None:
            raise ValueError("This TwitterUser instance isn't yet associated with a DrawQuest User.")

        followers = self.followers_on_drawquest(access_token, access_token_secret)
        Actions.twitter_friend_joined(self.user, followers)

        FriendJoinedNotificationReceipt.create_receipts_in_bulk(self.user,
                                                                [follower.user for follower in followers])
示例#2
0
    def notify_followers_of_signup(self, access_token, access_token_secret):
        from canvas.models import FriendJoinedNotificationReceipt

        if self.user is None:
            raise ValueError(
                "This TwitterUser instance isn't yet associated with a DrawQuest User."
            )

        followers = self.followers_on_drawquest(access_token,
                                                access_token_secret)
        Actions.twitter_friend_joined(self.user, followers)

        FriendJoinedNotificationReceipt.create_receipts_in_bulk(
            self.user, [follower.user for follower in followers])
    def decide_recipients(self, pending_notification):
        from canvas.models import FriendJoinedNotificationReceipt

        recipients = []
        old_recipient_ids = FriendJoinedNotificationReceipt.objects.filter(
                                actor=pending_notification.actor).values_list('recipient_id', flat=True)

        followers = pending_notification.twitter_friends

        for follower in followers:
            if follower.user_id in old_recipient_ids:
                continue

            if (follower.user
                    and not follower.user.is_following(pending_notification.actor)):
                recipients.append(follower.user)

        FriendJoinedNotificationReceipt.create_receipts_in_bulk(pending_notification.actor,
                                                                [follower.user for follower in followers])

        return recipients
    def decide_recipients(self, pending_notification):
        from canvas.models import FriendJoinedNotificationReceipt

        recipients = []
        old_recipient_ids = FriendJoinedNotificationReceipt.objects.filter(
            actor=pending_notification.actor).values_list('recipient_id',
                                                          flat=True)

        followers = pending_notification.twitter_friends

        for follower in followers:
            if follower.user_id in old_recipient_ids:
                continue

            if (follower.user and not follower.user.is_following(
                    pending_notification.actor)):
                recipients.append(follower.user)

        FriendJoinedNotificationReceipt.create_receipts_in_bulk(
            pending_notification.actor,
            [follower.user for follower in followers])

        return recipients