Merge c5d5ed813a
into 8b1a61c197
This commit is contained in:
commit
d74663dcdf
32
VARIABLES.md
32
VARIABLES.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
You can configure some of BirdsiteLIVE's settings via environment variables (those are optionnals):
|
||||
|
||||
## Blacklisting & Whitelisting
|
||||
## Blocklisting & Allowlisting
|
||||
|
||||
### Fediverse users and instances
|
||||
|
||||
|
@ -12,14 +12,14 @@ Here are the supported patterns to describe Fediverse users and/or instances:
|
|||
* `instance.ext` to describe an instance under a domain name
|
||||
* `*.instance.ext` to describe instances from all subdomains of a domain name (this doesn't include the instance.ext, if you want both you need to add both)
|
||||
|
||||
You can whitelist or blacklist fediverses users by settings the followings variables with the above patterns separated by `;`:
|
||||
You can allowlist or blocklist fediverses users by settings the followings variables with the above patterns separated by `;`:
|
||||
|
||||
* `Moderation:FollowersWhiteListing` Fediverse Whitelisting
|
||||
* `Moderation:FollowersBlackListing` Fediverse Blacklisting
|
||||
* `Moderation:FollowersAllowListing` Fediverse Allowlisting
|
||||
* `Moderation:FollowersBlockListing` Fediverse Blocklisting
|
||||
|
||||
If the whitelisting is set, only given patterns can follow twitter accounts on the instance.
|
||||
If blacklisted, the given patterns can't follow twitter accounts on the instance.
|
||||
If both whitelisting and blacklisting are set, only the whitelisting will be active.
|
||||
If the allowlisting is set, only given patterns can follow twitter accounts on the instance.
|
||||
If blocklisted, the given patterns can't follow twitter accounts on the instance.
|
||||
If both allowlisting and blocklisting are set, only the allowlisting will be active.
|
||||
|
||||
### Twitter users
|
||||
|
||||
|
@ -27,14 +27,14 @@ Here is the supported pattern to describe Twitter users:
|
|||
|
||||
* `twitter_handle` to describe a Twitter user
|
||||
|
||||
You can whitelist or blacklist twitter users by settings the followings variables with the above pattern separated by `;`:
|
||||
You can allowlist or blocklist twitter users by settings the followings variables with the above pattern separated by `;`:
|
||||
|
||||
* `Moderation:TwitterAccountsWhiteListing` Twitter Whitelisting
|
||||
* `Moderation:TwitterAccountsBlackListing` Twitter Blacklisting
|
||||
* `Moderation:TwitterAccountsAllowListing` Twitter Allowlisting
|
||||
* `Moderation:TwitterAccountsBlockListing` Twitter Blocklisting
|
||||
|
||||
If the whitelisting is set, only given patterns can be followed on the instance.
|
||||
If blacklisted, the given patterns can't be followed on the instance.
|
||||
If both whitelisting and blacklisting are set, only the whitelisting will be active.
|
||||
If the allowlisting is set, only given patterns can be followed on the instance.
|
||||
If blocklisted, the given patterns can't be followed on the instance.
|
||||
If both allowlisting and blocklisting are set, only the allowlisting will be active.
|
||||
|
||||
## Logging
|
||||
|
||||
|
@ -76,8 +76,8 @@ services:
|
|||
- Db:Password=birdsitelive
|
||||
- Twitter:ConsumerKey=twitter.api.key
|
||||
- Twitter:ConsumerSecret=twitter.api.key
|
||||
+ - Moderation:FollowersWhiteListing=@me@my-instance.ca;friend-instance.com;*.friend-instance.com
|
||||
+ - Moderation:TwitterAccountsBlackListing=douchebag;jerk_88;theRealIdiot
|
||||
+ - Moderation:FollowersAllowListing=@me@my-instance.ca;friend-instance.com;*.friend-instance.com
|
||||
+ - Moderation:TwitterAccountsBlockListing=douchebag;jerk_88;theRealIdiot
|
||||
+ - Instance:Name=MyTwitterRelay
|
||||
+ - Instance:ResolveMentionsInProfiles=false
|
||||
+ - Instance:PublishReplies=true
|
||||
|
@ -85,7 +85,7 @@ services:
|
|||
+ - Instance:SensitiveTwitterAccounts=archillect
|
||||
networks:
|
||||
[...]
|
||||
|
||||
~~~~
|
||||
db:
|
||||
image: postgres:9.6
|
||||
[...]
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
{
|
||||
public class ModerationSettings
|
||||
{
|
||||
public string FollowersWhiteListing { get; set; }
|
||||
public string FollowersBlackListing { get; set; }
|
||||
public string TwitterAccountsWhiteListing { get; set; }
|
||||
public string TwitterAccountsBlackListing { get; set; }
|
||||
public string FollowersAllowListing { get; set; }
|
||||
public string FollowersBlockListing { get; set; }
|
||||
public string TwitterAccountsAllowListing { get; set; }
|
||||
public string TwitterAccountsBlockListing { get; set; }
|
||||
}
|
||||
}
|
|
@ -15,10 +15,10 @@ namespace BirdsiteLive.Domain.Repository
|
|||
|
||||
public class ModerationRepository : IModerationRepository
|
||||
{
|
||||
private readonly Regex[] _followersWhiteListing;
|
||||
private readonly Regex[] _followersBlackListing;
|
||||
private readonly Regex[] _twitterAccountsWhiteListing;
|
||||
private readonly Regex[] _twitterAccountsBlackListing;
|
||||
private readonly Regex[] _followersAllowListing;
|
||||
private readonly Regex[] _followersBlockListing;
|
||||
private readonly Regex[] _twitterAccountsAllowListing;
|
||||
private readonly Regex[] _twitterAccountsBlockListing;
|
||||
|
||||
private readonly Dictionary<ModerationEntityTypeEnum, ModerationTypeEnum> _modMode =
|
||||
new Dictionary<ModerationEntityTypeEnum, ModerationTypeEnum>();
|
||||
|
@ -26,37 +26,37 @@ namespace BirdsiteLive.Domain.Repository
|
|||
#region Ctor
|
||||
public ModerationRepository(ModerationSettings settings)
|
||||
{
|
||||
var parsedFollowersWhiteListing = PatternsParser.Parse(settings.FollowersWhiteListing);
|
||||
var parsedFollowersBlackListing = PatternsParser.Parse(settings.FollowersBlackListing);
|
||||
var parsedTwitterAccountsWhiteListing = PatternsParser.Parse(settings.TwitterAccountsWhiteListing);
|
||||
var parsedTwitterAccountsBlackListing = PatternsParser.Parse(settings.TwitterAccountsBlackListing);
|
||||
var parsedFollowersAllowListing = PatternsParser.Parse(settings.FollowersAllowListing);
|
||||
var parsedFollowersBlockListing = PatternsParser.Parse(settings.FollowersBlockListing);
|
||||
var parsedTwitterAccountsAllowListing = PatternsParser.Parse(settings.TwitterAccountsAllowListing);
|
||||
var parsedTwitterAccountsBlockListing = PatternsParser.Parse(settings.TwitterAccountsBlockListing);
|
||||
|
||||
_followersWhiteListing = parsedFollowersWhiteListing
|
||||
_followersAllowListing = parsedFollowersAllowListing
|
||||
.Select(x => ModerationRegexParser.Parse(ModerationEntityTypeEnum.Follower, x))
|
||||
.ToArray();
|
||||
_followersBlackListing = parsedFollowersBlackListing
|
||||
_followersBlockListing = parsedFollowersBlockListing
|
||||
.Select(x => ModerationRegexParser.Parse(ModerationEntityTypeEnum.Follower, x))
|
||||
.ToArray();
|
||||
_twitterAccountsWhiteListing = parsedTwitterAccountsWhiteListing
|
||||
_twitterAccountsAllowListing = parsedTwitterAccountsAllowListing
|
||||
.Select(x => ModerationRegexParser.Parse(ModerationEntityTypeEnum.TwitterAccount, x))
|
||||
.ToArray();
|
||||
_twitterAccountsBlackListing = parsedTwitterAccountsBlackListing
|
||||
_twitterAccountsBlockListing = parsedTwitterAccountsBlockListing
|
||||
.Select(x => ModerationRegexParser.Parse(ModerationEntityTypeEnum.TwitterAccount, x))
|
||||
.ToArray();
|
||||
|
||||
// Set Follower moderation politic
|
||||
if (_followersWhiteListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.Follower, ModerationTypeEnum.WhiteListing);
|
||||
else if (_followersBlackListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.Follower, ModerationTypeEnum.BlackListing);
|
||||
if (_followersAllowListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.Follower, ModerationTypeEnum.AllowListing);
|
||||
else if (_followersBlockListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.Follower, ModerationTypeEnum.BlockListing);
|
||||
else
|
||||
_modMode.Add(ModerationEntityTypeEnum.Follower, ModerationTypeEnum.None);
|
||||
|
||||
// Set Twitter account moderation politic
|
||||
if (_twitterAccountsWhiteListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.TwitterAccount, ModerationTypeEnum.WhiteListing);
|
||||
else if (_twitterAccountsBlackListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.TwitterAccount, ModerationTypeEnum.BlackListing);
|
||||
if (_twitterAccountsAllowListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.TwitterAccount, ModerationTypeEnum.AllowListing);
|
||||
else if (_twitterAccountsBlockListing.Any())
|
||||
_modMode.Add(ModerationEntityTypeEnum.TwitterAccount, ModerationTypeEnum.BlockListing);
|
||||
else
|
||||
_modMode.Add(ModerationEntityTypeEnum.TwitterAccount, ModerationTypeEnum.None);
|
||||
}
|
||||
|
@ -90,13 +90,13 @@ namespace BirdsiteLive.Domain.Repository
|
|||
{
|
||||
case ModerationTypeEnum.None:
|
||||
return ModeratedTypeEnum.None;
|
||||
case ModerationTypeEnum.BlackListing:
|
||||
if (_followersBlackListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.BlackListed;
|
||||
case ModerationTypeEnum.BlockListing:
|
||||
if (_followersBlockListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.BlockListed;
|
||||
return ModeratedTypeEnum.None;
|
||||
case ModerationTypeEnum.WhiteListing:
|
||||
if (_followersWhiteListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.WhiteListed;
|
||||
case ModerationTypeEnum.AllowListing:
|
||||
if (_followersAllowListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.AllowListed;
|
||||
return ModeratedTypeEnum.None;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
@ -111,13 +111,13 @@ namespace BirdsiteLive.Domain.Repository
|
|||
{
|
||||
case ModerationTypeEnum.None:
|
||||
return ModeratedTypeEnum.None;
|
||||
case ModerationTypeEnum.BlackListing:
|
||||
if (_twitterAccountsBlackListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.BlackListed;
|
||||
case ModerationTypeEnum.BlockListing:
|
||||
if (_twitterAccountsBlockListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.BlockListed;
|
||||
return ModeratedTypeEnum.None;
|
||||
case ModerationTypeEnum.WhiteListing:
|
||||
if (_twitterAccountsWhiteListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.WhiteListed;
|
||||
case ModerationTypeEnum.AllowListing:
|
||||
if (_twitterAccountsAllowListing.Any(x => x.IsMatch(entity)))
|
||||
return ModeratedTypeEnum.AllowListed;
|
||||
return ModeratedTypeEnum.None;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
@ -135,14 +135,14 @@ namespace BirdsiteLive.Domain.Repository
|
|||
public enum ModerationTypeEnum
|
||||
{
|
||||
None = 0,
|
||||
BlackListing = 1,
|
||||
WhiteListing = 2
|
||||
BlockListing = 1,
|
||||
AllowListing = 2
|
||||
}
|
||||
|
||||
public enum ModeratedTypeEnum
|
||||
{
|
||||
None = 0,
|
||||
BlackListed = 1,
|
||||
WhiteListed = 2
|
||||
BlockListed = 1,
|
||||
AllowListed = 2
|
||||
}
|
||||
}
|
|
@ -161,8 +161,8 @@ namespace BirdsiteLive.Domain
|
|||
{
|
||||
var followerStatus = _moderationRepository.CheckStatus(ModerationEntityTypeEnum.Follower, $"@{followerUserName}@{followerHost}");
|
||||
|
||||
if(followerModPolicy == ModerationTypeEnum.WhiteListing && followerStatus != ModeratedTypeEnum.WhiteListed ||
|
||||
followerModPolicy == ModerationTypeEnum.BlackListing && followerStatus == ModeratedTypeEnum.BlackListed)
|
||||
if(followerModPolicy == ModerationTypeEnum.AllowListing && followerStatus != ModeratedTypeEnum.AllowListed ||
|
||||
followerModPolicy == ModerationTypeEnum.BlockListing && followerStatus == ModeratedTypeEnum.BlockListed)
|
||||
return await SendRejectFollowAsync(activity, followerHost);
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,8 @@ namespace BirdsiteLive.Domain
|
|||
if (twitterAccountModPolicy != ModerationTypeEnum.None)
|
||||
{
|
||||
var twitterUserStatus = _moderationRepository.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, twitterUser);
|
||||
if (twitterAccountModPolicy == ModerationTypeEnum.WhiteListing && twitterUserStatus != ModeratedTypeEnum.WhiteListed ||
|
||||
twitterAccountModPolicy == ModerationTypeEnum.BlackListing && twitterUserStatus == ModeratedTypeEnum.BlackListed)
|
||||
if (twitterAccountModPolicy == ModerationTypeEnum.AllowListing && twitterUserStatus != ModeratedTypeEnum.AllowListed ||
|
||||
twitterAccountModPolicy == ModerationTypeEnum.BlockListing && twitterUserStatus == ModeratedTypeEnum.BlockListed)
|
||||
return await SendRejectFollowAsync(activity, followerHost);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace BirdsiteLive.Moderation.Processors
|
|||
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)
|
||||
if (type == ModerationTypeEnum.AllowListing && status != ModeratedTypeEnum.AllowListed ||
|
||||
type == ModerationTypeEnum.BlockListing && status == ModeratedTypeEnum.BlockListed)
|
||||
{
|
||||
Console.WriteLine($"Remove {followerHandle}");
|
||||
await _removeFollowerAction.ProcessAsync(follower);
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace BirdsiteLive.Moderation.Processors
|
|||
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)
|
||||
if (type == ModerationTypeEnum.AllowListing && status != ModeratedTypeEnum.AllowListed ||
|
||||
type == ModerationTypeEnum.BlockListing && status == ModeratedTypeEnum.BlockListed)
|
||||
await _removeTwitterAccountAction.ProcessAsync(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,17 +33,17 @@ namespace BirdsiteLive.Component
|
|||
|
||||
var viewModel = new NodeInfoViewModel
|
||||
{
|
||||
BlacklistingEnabled = followerPolicy == ModerationTypeEnum.BlackListing ||
|
||||
twitterAccountPolicy == ModerationTypeEnum.BlackListing,
|
||||
WhitelistingEnabled = followerPolicy == ModerationTypeEnum.WhiteListing ||
|
||||
twitterAccountPolicy == ModerationTypeEnum.WhiteListing,
|
||||
BlocklistingEnabled = followerPolicy == ModerationTypeEnum.BlockListing ||
|
||||
twitterAccountPolicy == ModerationTypeEnum.BlockListing,
|
||||
AllowlistingEnabled = followerPolicy == ModerationTypeEnum.AllowListing ||
|
||||
twitterAccountPolicy == ModerationTypeEnum.AllowListing,
|
||||
InstanceSaturation = statistics.Saturation
|
||||
};
|
||||
|
||||
//viewModel = new NodeInfoViewModel
|
||||
//{
|
||||
// BlacklistingEnabled = false,
|
||||
// WhitelistingEnabled = false,
|
||||
// BlocklistingEnabled = false,
|
||||
// AllowlistingEnabled = false,
|
||||
// InstanceSaturation = 175
|
||||
//};
|
||||
return View(viewModel);
|
||||
|
@ -52,8 +52,8 @@ namespace BirdsiteLive.Component
|
|||
|
||||
public class NodeInfoViewModel
|
||||
{
|
||||
public bool BlacklistingEnabled { get; set; }
|
||||
public bool WhitelistingEnabled { get; set; }
|
||||
public bool BlocklistingEnabled { get; set; }
|
||||
public bool AllowlistingEnabled { get; set; }
|
||||
public int InstanceSaturation { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,16 +27,16 @@ namespace BirdsiteLive.Controllers
|
|||
return View(stats);
|
||||
}
|
||||
|
||||
public IActionResult Blacklisting()
|
||||
public IActionResult Blocklisting()
|
||||
{
|
||||
var status = GetModerationStatus();
|
||||
return View("Blacklisting", status);
|
||||
return View("Blocklisting", status);
|
||||
}
|
||||
|
||||
public IActionResult Whitelisting()
|
||||
public IActionResult Allowlisting()
|
||||
{
|
||||
var status = GetModerationStatus();
|
||||
return View("Whitelisting", status);
|
||||
return View("Allowlisting", status);
|
||||
}
|
||||
|
||||
private ModerationStatus GetModerationStatus()
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BirdsiteLive.Controllers
|
|||
{
|
||||
var version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(3);
|
||||
var twitterUsersCount = await _twitterUserDal.GetTwitterUsersCountAsync();
|
||||
var isOpenRegistration = _moderationRepository.GetModerationType(ModerationEntityTypeEnum.Follower) != ModerationTypeEnum.WhiteListing;
|
||||
var isOpenRegistration = _moderationRepository.GetModerationType(ModerationEntityTypeEnum.Follower) != ModerationTypeEnum.AllowListing;
|
||||
|
||||
if (id == "2.0")
|
||||
{
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
@using BirdsiteLive.Domain.Repository
|
||||
@model BirdsiteLive.Controllers.ModerationStatus
|
||||
@{
|
||||
ViewData["Title"] = "Allowlisting";
|
||||
}
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-10 col-lg-8 mx-auto">
|
||||
<h2>Allowlisting</h2>
|
||||
|
||||
@if (Model.Followers == ModerationTypeEnum.AllowListing)
|
||||
{
|
||||
<p><br />This node is allowlisting some instances and/or Fediverse users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.TwitterAccounts == ModerationTypeEnum.AllowListing)
|
||||
{
|
||||
<p><br />This node is allowlisting some twitter users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.Followers != ModerationTypeEnum.AllowListing && Model.TwitterAccounts != ModerationTypeEnum.AllowListing)
|
||||
{
|
||||
<p><br />This node is not using an allowlist.<br /><br /></p>
|
||||
}
|
||||
|
||||
@*<h2>FAQ</h2>
|
||||
<p>TODO</p>*@
|
||||
</div>
|
|
@ -1,27 +0,0 @@
|
|||
@using BirdsiteLive.Domain.Repository
|
||||
@model BirdsiteLive.Controllers.ModerationStatus
|
||||
@{
|
||||
ViewData["Title"] = "Blacklisting";
|
||||
}
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-10 col-lg-8 mx-auto">
|
||||
<h2>Blacklisting</h2>
|
||||
|
||||
@if (Model.Followers == ModerationTypeEnum.BlackListing)
|
||||
{
|
||||
<p><br />This node is blacklisting some instances and/or Fediverse users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.TwitterAccounts == ModerationTypeEnum.BlackListing)
|
||||
{
|
||||
<p><br />This node is blacklisting some twitter users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.Followers != ModerationTypeEnum.BlackListing && Model.TwitterAccounts != ModerationTypeEnum.BlackListing)
|
||||
{
|
||||
<p><br />This node is not using blacklisting.<br /><br /></p>
|
||||
}
|
||||
|
||||
@*<h2>FAQ</h2>
|
||||
<p>TODO</p>*@
|
||||
</div>
|
|
@ -0,0 +1,27 @@
|
|||
@using BirdsiteLive.Domain.Repository
|
||||
@model BirdsiteLive.Controllers.ModerationStatus
|
||||
@{
|
||||
ViewData["Title"] = "Blocklisting";
|
||||
}
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-10 col-lg-8 mx-auto">
|
||||
<h2>Blocklisting</h2>
|
||||
|
||||
@if (Model.Followers == ModerationTypeEnum.BlockListing)
|
||||
{
|
||||
<p><br />This node is blocklisting some instances and/or Fediverse users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.TwitterAccounts == ModerationTypeEnum.BlockListing)
|
||||
{
|
||||
<p><br />This node is blocklisting some twitter users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.Followers != ModerationTypeEnum.BlockListing && Model.TwitterAccounts != ModerationTypeEnum.BlockListing)
|
||||
{
|
||||
<p><br />This node is not using a blocklist.<br /><br /></p>
|
||||
}
|
||||
|
||||
@*<h2>FAQ</h2>
|
||||
<p>TODO</p>*@
|
||||
</div>
|
|
@ -1,27 +0,0 @@
|
|||
@using BirdsiteLive.Domain.Repository
|
||||
@model BirdsiteLive.Controllers.ModerationStatus
|
||||
@{
|
||||
ViewData["Title"] = "Whitelisting";
|
||||
}
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-10 col-lg-8 mx-auto">
|
||||
<h2>Whitelisting</h2>
|
||||
|
||||
@if (Model.Followers == ModerationTypeEnum.WhiteListing)
|
||||
{
|
||||
<p><br />This node is whitelisting some instances and/or Fediverse users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.TwitterAccounts == ModerationTypeEnum.WhiteListing)
|
||||
{
|
||||
<p><br />This node is whitelisting some twitter users.<br /><br /></p>
|
||||
}
|
||||
|
||||
@if (Model.Followers != ModerationTypeEnum.WhiteListing && Model.TwitterAccounts != ModerationTypeEnum.WhiteListing)
|
||||
{
|
||||
<p><br />This node is not using whitelisting.<br /><br /></p>
|
||||
}
|
||||
|
||||
@*<h2>FAQ</h2>
|
||||
<p>TODO</p>*@
|
||||
</div>
|
|
@ -1,13 +1,13 @@
|
|||
@model BirdsiteLive.Component.NodeInfoViewModel
|
||||
|
||||
<div>
|
||||
@if (ViewData.Model.WhitelistingEnabled)
|
||||
@if (ViewData.Model.AllowlistingEnabled)
|
||||
{
|
||||
<a asp-controller="About" asp-action="Whitelisting" class="badge badge-light" title="What does this mean?">Whitelisting Enabled</a>
|
||||
<a asp-controller="About" asp-action="Allowlisting" class="badge badge-light" title="What does this mean?">Allowlist Enabled</a>
|
||||
}
|
||||
@if (ViewData.Model.BlacklistingEnabled)
|
||||
@if (ViewData.Model.BlocklistingEnabled)
|
||||
{
|
||||
<a asp-controller="About" asp-action="Blacklisting" class="badge badge-light" title="What does this mean?">Blacklisting Enabled</a>
|
||||
<a asp-controller="About" asp-action="Blocklisting" class="badge badge-light" title="What does this mean?">Blocklist Enabled</a>
|
||||
}
|
||||
|
||||
<div class="node-progress-bar">
|
||||
|
|
|
@ -9,30 +9,30 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
{
|
||||
#region GetModerationType
|
||||
[TestMethod]
|
||||
public void GetModerationType_Follower_WhiteListing_Test()
|
||||
public void GetModerationType_Follower_AllowListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "@me@domain.ext"
|
||||
FollowersAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing ,repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing ,repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetModerationType_TwitterAccount_WhiteListing_Test()
|
||||
public void GetModerationType_TwitterAccount_AllowListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsWhiteListing = "@me@domain.ext"
|
||||
TwitterAccountsAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
|
@ -40,54 +40,54 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetModerationType_FollowerTwitterAccount_WhiteListing_Test()
|
||||
public void GetModerationType_FollowerTwitterAccount_AllowListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "@me@domain.ext",
|
||||
TwitterAccountsWhiteListing = "@me@domain.ext"
|
||||
FollowersAllowListing = "@me@domain.ext",
|
||||
TwitterAccountsAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetModerationType_Follower_BlackListing_Test()
|
||||
public void GetModerationType_Follower_BlockListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersBlackListing = "@me@domain.ext"
|
||||
FollowersBlockListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.BlackListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlockListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetModerationType_TwitterAccount_BlackListing_Test()
|
||||
public void GetModerationType_TwitterAccount_BlockListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsBlackListing = "@me@domain.ext"
|
||||
TwitterAccountsBlockListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
|
@ -95,26 +95,26 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlackListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlockListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetModerationType_FollowerTwitterAccount_BlackListing_Test()
|
||||
public void GetModerationType_FollowerTwitterAccount_BlockListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersBlackListing = "@me@domain.ext",
|
||||
TwitterAccountsBlackListing = "@me@domain.ext"
|
||||
FollowersBlockListing = "@me@domain.ext",
|
||||
TwitterAccountsBlockListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.BlackListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlackListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlockListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.BlockListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -124,15 +124,15 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersBlackListing = "@me@domain.ext",
|
||||
FollowersWhiteListing = "@me@domain.ext",
|
||||
FollowersBlockListing = "@me@domain.ext",
|
||||
FollowersAllowListing = "@me@domain.ext",
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
@ -143,8 +143,8 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsBlackListing = "@me@domain.ext",
|
||||
TwitterAccountsWhiteListing = "@me@domain.ext"
|
||||
TwitterAccountsBlockListing = "@me@domain.ext",
|
||||
TwitterAccountsAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
|
@ -152,7 +152,7 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.None, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -162,130 +162,130 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersBlackListing = "@me@domain.ext",
|
||||
FollowersWhiteListing = "@me@domain.ext",
|
||||
TwitterAccountsBlackListing = "@me@domain.ext",
|
||||
TwitterAccountsWhiteListing = "@me@domain.ext"
|
||||
FollowersBlockListing = "@me@domain.ext",
|
||||
FollowersAllowListing = "@me@domain.ext",
|
||||
TwitterAccountsBlockListing = "@me@domain.ext",
|
||||
TwitterAccountsAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.WhiteListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.Follower));
|
||||
Assert.AreEqual(ModerationTypeEnum.AllowListing, repo.GetModerationType(ModerationEntityTypeEnum.TwitterAccount));
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CheckStatus
|
||||
[TestMethod]
|
||||
public void CheckStatus_Follower_WhiteListing_Test()
|
||||
public void CheckStatus_Follower_AllowListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "@me@domain.ext"
|
||||
FollowersAllowListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckStatus_Follower_WhiteListing_Instance_Test()
|
||||
public void CheckStatus_Follower_AllowListing_Instance_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "domain.ext"
|
||||
FollowersAllowListing = "domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain2.ext"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckStatus_Follower_WhiteListing_SubDomain_Test()
|
||||
public void CheckStatus_Follower_AllowListing_SubDomain_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "*.domain.ext"
|
||||
FollowersAllowListing = "*.domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@s.domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@s2.domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@s.domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@s2.domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain2.ext"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckStatus_TwitterAccount_WhiteListing_Test()
|
||||
public void CheckStatus_TwitterAccount_AllowListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsWhiteListing = "handle"
|
||||
TwitterAccountsAllowListing = "handle"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle2"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckStatus_Follower_BlackListing_Test()
|
||||
public void CheckStatus_Follower_BlockListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersBlackListing = "@me@domain.ext"
|
||||
FollowersBlockListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.BlackListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.BlockListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckStatus_TwitterAccount_BlackListing_Test()
|
||||
public void CheckStatus_TwitterAccount_BlockListing_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsBlackListing = "handle"
|
||||
TwitterAccountsBlockListing = "handle"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.BlackListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.BlockListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle2"));
|
||||
#endregion
|
||||
}
|
||||
|
@ -296,15 +296,15 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
FollowersWhiteListing = "@me@domain.ext",
|
||||
FollowersBlackListing = "@me@domain.ext"
|
||||
FollowersAllowListing = "@me@domain.ext",
|
||||
FollowersBlockListing = "@me@domain.ext"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me@domain.ext"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.Follower, "@me2@domain.ext"));
|
||||
#endregion
|
||||
}
|
||||
|
@ -315,15 +315,15 @@ namespace BirdsiteLive.Domain.Tests.Repository
|
|||
#region Stubs
|
||||
var settings = new ModerationSettings
|
||||
{
|
||||
TwitterAccountsWhiteListing = "handle",
|
||||
TwitterAccountsBlackListing = "handle"
|
||||
TwitterAccountsAllowListing = "handle",
|
||||
TwitterAccountsBlockListing = "handle"
|
||||
};
|
||||
#endregion
|
||||
|
||||
var repo = new ModerationRepository(settings);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(ModeratedTypeEnum.WhiteListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.AllowListed, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle"));
|
||||
Assert.AreEqual(ModeratedTypeEnum.None, repo.CheckStatus(ModerationEntityTypeEnum.TwitterAccount, "handle2"));
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -46,21 +46,21 @@ namespace BirdsiteLive.Moderation.Tests
|
|||
var moderationRepositoryMock = new Mock<IModerationRepository>(MockBehavior.Strict);
|
||||
moderationRepositoryMock
|
||||
.Setup(x => x.GetModerationType(ModerationEntityTypeEnum.Follower))
|
||||
.Returns(ModerationTypeEnum.WhiteListing);
|
||||
.Returns(ModerationTypeEnum.AllowListing);
|
||||
moderationRepositoryMock
|
||||
.Setup(x => x.GetModerationType(ModerationEntityTypeEnum.TwitterAccount))
|
||||
.Returns(ModerationTypeEnum.BlackListing);
|
||||
.Returns(ModerationTypeEnum.BlockListing);
|
||||
|
||||
var followerModerationProcessorMock = new Mock<IFollowerModerationProcessor>(MockBehavior.Strict);
|
||||
followerModerationProcessorMock
|
||||
.Setup(x => x.ProcessAsync(
|
||||
It.Is<ModerationTypeEnum>(y => y == ModerationTypeEnum.WhiteListing)))
|
||||
It.Is<ModerationTypeEnum>(y => y == ModerationTypeEnum.AllowListing)))
|
||||
.Returns(Task.CompletedTask);
|
||||
|
||||
var twitterAccountModerationProcessorMock = new Mock<ITwitterAccountModerationProcessor>(MockBehavior.Strict);
|
||||
twitterAccountModerationProcessorMock
|
||||
.Setup(x => x.ProcessAsync(
|
||||
It.Is<ModerationTypeEnum>(y => y == ModerationTypeEnum.BlackListing)))
|
||||
It.Is<ModerationTypeEnum>(y => y == ModerationTypeEnum.BlockListing)))
|
||||
.Returns(Task.CompletedTask);
|
||||
|
||||
var loggerMock = new Mock<ILogger<ModerationPipeline>>(MockBehavior.Strict);
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_WhiteListing_WhiteListed()
|
||||
public async Task ProcessAsync_AllowListing_AllowListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allFollowers = new List<Follower>
|
||||
|
@ -58,13 +58,13 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
.Setup(x => x.CheckStatus(
|
||||
It.Is<ModerationEntityTypeEnum>(y => y == ModerationEntityTypeEnum.Follower),
|
||||
It.Is<string>(y => y == "@acct@host")))
|
||||
.Returns(ModeratedTypeEnum.WhiteListed);
|
||||
.Returns(ModeratedTypeEnum.AllowListed);
|
||||
|
||||
var removeFollowerActionMock = new Mock<IRemoveFollowerAction>(MockBehavior.Strict);
|
||||
#endregion
|
||||
|
||||
var processor = new FollowerModerationProcessor(followersDalMock.Object, moderationRepositoryMock.Object, removeFollowerActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.WhiteListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.AllowListing);
|
||||
|
||||
#region Validations
|
||||
followersDalMock.VerifyAll();
|
||||
|
@ -74,7 +74,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_WhiteListing_NotWhiteListed()
|
||||
public async Task ProcessAsync_AllowListing_NotAllowListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allFollowers = new List<Follower>
|
||||
|
@ -108,7 +108,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new FollowerModerationProcessor(followersDalMock.Object, moderationRepositoryMock.Object, removeFollowerActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.WhiteListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.AllowListing);
|
||||
|
||||
#region Validations
|
||||
followersDalMock.VerifyAll();
|
||||
|
@ -118,7 +118,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_BlackListing_BlackListed()
|
||||
public async Task ProcessAsync_BlockListing_BlockListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allFollowers = new List<Follower>
|
||||
|
@ -142,7 +142,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
.Setup(x => x.CheckStatus(
|
||||
It.Is<ModerationEntityTypeEnum>(y => y == ModerationEntityTypeEnum.Follower),
|
||||
It.Is<string>(y => y == "@acct@host")))
|
||||
.Returns(ModeratedTypeEnum.BlackListed);
|
||||
.Returns(ModeratedTypeEnum.BlockListed);
|
||||
|
||||
var removeFollowerActionMock = new Mock<IRemoveFollowerAction>(MockBehavior.Strict);
|
||||
removeFollowerActionMock
|
||||
|
@ -152,7 +152,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new FollowerModerationProcessor(followersDalMock.Object, moderationRepositoryMock.Object, removeFollowerActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlackListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlockListing);
|
||||
|
||||
#region Validations
|
||||
followersDalMock.VerifyAll();
|
||||
|
@ -162,7 +162,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_BlackListing_NotBlackListed()
|
||||
public async Task ProcessAsync_BlockListing_NotBlockListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allFollowers = new List<Follower>
|
||||
|
@ -192,7 +192,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new FollowerModerationProcessor(followersDalMock.Object, moderationRepositoryMock.Object, removeFollowerActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlackListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlockListing);
|
||||
|
||||
#region Validations
|
||||
followersDalMock.VerifyAll();
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_WhiteListing_WhiteListed()
|
||||
public async Task ProcessAsync_AllowListing_AllowListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allUsers = new List<SyncTwitterUser>
|
||||
|
@ -56,13 +56,13 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
.Setup(x => x.CheckStatus(
|
||||
It.Is<ModerationEntityTypeEnum>(y => y == ModerationEntityTypeEnum.TwitterAccount),
|
||||
It.Is<string>(y => y == "acct")))
|
||||
.Returns(ModeratedTypeEnum.WhiteListed);
|
||||
.Returns(ModeratedTypeEnum.AllowListed);
|
||||
|
||||
var removeTwitterAccountActionMock = new Mock<IRemoveTwitterAccountAction>(MockBehavior.Strict);
|
||||
#endregion
|
||||
|
||||
var processor = new TwitterAccountModerationProcessor(twitterUserDalMock.Object, moderationRepositoryMock.Object, removeTwitterAccountActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.WhiteListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.AllowListing);
|
||||
|
||||
#region Validations
|
||||
twitterUserDalMock.VerifyAll();
|
||||
|
@ -72,7 +72,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_WhiteListing_NotWhiteListed()
|
||||
public async Task ProcessAsync_AllowListing_NotAllowListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allUsers = new List<SyncTwitterUser>
|
||||
|
@ -105,7 +105,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new TwitterAccountModerationProcessor(twitterUserDalMock.Object, moderationRepositoryMock.Object, removeTwitterAccountActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.WhiteListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.AllowListing);
|
||||
|
||||
#region Validations
|
||||
twitterUserDalMock.VerifyAll();
|
||||
|
@ -115,7 +115,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_BlackListing_BlackListed()
|
||||
public async Task ProcessAsync_BlockListing_BlockListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allUsers = new List<SyncTwitterUser>
|
||||
|
@ -138,7 +138,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
.Setup(x => x.CheckStatus(
|
||||
It.Is<ModerationEntityTypeEnum>(y => y == ModerationEntityTypeEnum.TwitterAccount),
|
||||
It.Is<string>(y => y == "acct")))
|
||||
.Returns(ModeratedTypeEnum.BlackListed);
|
||||
.Returns(ModeratedTypeEnum.BlockListed);
|
||||
|
||||
var removeTwitterAccountActionMock = new Mock<IRemoveTwitterAccountAction>(MockBehavior.Strict);
|
||||
removeTwitterAccountActionMock
|
||||
|
@ -148,7 +148,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new TwitterAccountModerationProcessor(twitterUserDalMock.Object, moderationRepositoryMock.Object, removeTwitterAccountActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlackListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlockListing);
|
||||
|
||||
#region Validations
|
||||
twitterUserDalMock.VerifyAll();
|
||||
|
@ -158,7 +158,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProcessAsync_BlackListing_NotBlackListed()
|
||||
public async Task ProcessAsync_BlockListing_NotBlockListed()
|
||||
{
|
||||
#region Stubs
|
||||
var allUsers = new List<SyncTwitterUser>
|
||||
|
@ -187,7 +187,7 @@ namespace BirdsiteLive.Moderation.Tests.Processors
|
|||
#endregion
|
||||
|
||||
var processor = new TwitterAccountModerationProcessor(twitterUserDalMock.Object, moderationRepositoryMock.Object, removeTwitterAccountActionMock.Object);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlackListing);
|
||||
await processor.ProcessAsync(ModerationTypeEnum.BlockListing);
|
||||
|
||||
#region Validations
|
||||
twitterUserDalMock.VerifyAll();
|
||||
|
|
Loading…
Reference in New Issue