Пример #1
0
        internal async Task <Boolean> CheckShouldBanAsync(ModeratableThing thing, IEnumerable <String> bannedGroups)
        {
            if (IsUnbannable(thing))
            {
                return(false);
            }

            // flair bypass only applies to authors that can have flair
            if (thing is VotableThing votableThing)
            {
                if (!String.IsNullOrWhiteSpace(votableThing.AuthorFlairCssClass) &&
                    ignoreAuthorCssClasses.Any(cssClass => votableThing.AuthorFlairCssClass.Contains(cssClass)))
                {
                    return(false);
                }
            }
            if (UserLookup is CacheableBackedBotDatabase cacheable)
            {
                if (cacheable.IsStale)
                {
                    IncrementStatisticIfExists("requestRate");
                }
            }
            IEnumerable <String> groupNames = (await UserLookup.GetGroupsForUserAsync(thing.AuthorName)).Select(group => group.Name);

            return(groupNames.Any(groupName => bannedGroups.Contains(groupName)));
        }