Esempio n. 1
0
        public async Task ProcessAsync(ModerationTypeEnum type)
        {
            if (type == ModerationTypeEnum.None)
            {
                return;
            }

            var twitterUsers = await _twitterUserDal.GetAllTwitterUsersAsync();

            foreach (var user in twitterUsers)
            {
                var userHandle = user.Acct.ToLowerInvariant().Trim();
                var status     = _moderationRepository.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, userHandle);

                if (type == ModerationTypeEnum.WhiteListing && status != ModeratedTypeEnum.WhiteListed ||
                    type == ModerationTypeEnum.BlackListing && status == ModeratedTypeEnum.BlackListed)
                {
                    await _removeTwitterAccountAction.ProcessAsync(user);
                }
            }
        }
Esempio n. 2
0
        public async Task ProcessAsync(ModerationTypeEnum type)
        {
            if (type == ModerationTypeEnum.None)
            {
                return;
            }

            var followers = await _followersDal.GetAllFollowersAsync();

            foreach (var follower in followers)
            {
                var followerHandle = $"@{follower.Acct.Trim()}@{follower.Host.Trim()}".ToLowerInvariant();
                var status         = _moderationRepository.CheckStatus(ModerationEntityTypeEnum.Follower, followerHandle);

                if (type == ModerationTypeEnum.WhiteListing && status != ModeratedTypeEnum.WhiteListed ||
                    type == ModerationTypeEnum.BlackListing && status == ModeratedTypeEnum.BlackListed)
                {
                    Console.WriteLine($"Remove {followerHandle}");
                    await _removeFollowerAction.ProcessAsync(follower);
                }
            }
        }