mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(dir): ♻ FilterList.CreateWithApproval()
This commit is contained in:
parent
1bed7cd864
commit
5cdd64ef41
3 changed files with 6 additions and 5 deletions
|
|
@ -56,7 +56,7 @@ public async Task<Response> Handle(Command request, CancellationToken cancellati
|
|||
.WhereIsDefaultForFilterList()
|
||||
.SingleAsync(cancellationToken);
|
||||
|
||||
var filterList = FilterList.Create(
|
||||
var filterList = FilterList.CreatePendingApproval(
|
||||
request.Name,
|
||||
request.Description,
|
||||
license,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,5 @@ public interface IRequireChangeApproval<out TChange> where TChange : Change
|
|||
public IReadOnlyCollection<TChange> PendingChanges => (IReadOnlyCollection<TChange>)Changes.Where(c => c.ApprovedAt == null && c.RejectedAt == null);
|
||||
public IReadOnlyCollection<TChange> ApprovedChanges => (IReadOnlyCollection<TChange>)Changes.Where(c => c.ApprovedAt != null);
|
||||
public IReadOnlyCollection<TChange> RejectedChanges => (IReadOnlyCollection<TChange>)Changes.Where(c => c.RejectedAt != null);
|
||||
public bool IsLegacyApproved => Changes.Count == 0;
|
||||
public bool IsApproved => IsLegacyApproved || ApprovedChanges.Count > 0;
|
||||
public bool IsApproved { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ protected FilterList() { }
|
|||
public string? EmailAddress { get; private init; }
|
||||
public Uri? DonateUrl { get; private init; }
|
||||
public virtual IReadOnlyCollection<FilterListChange> Changes => (IReadOnlyCollection<FilterListChange>)_changes;
|
||||
public bool IsApproved { get; private init; }
|
||||
|
||||
public static FilterList Create(
|
||||
public static FilterList CreatePendingApproval(
|
||||
string name,
|
||||
string? description,
|
||||
License license,
|
||||
|
|
@ -61,7 +62,8 @@ public static FilterList Create(
|
|||
ChatUrl = chatUrl,
|
||||
EmailAddress = emailAddress,
|
||||
DonateUrl = donateUrl,
|
||||
ViewUrls = urls
|
||||
ViewUrls = urls,
|
||||
IsApproved = false
|
||||
};
|
||||
list._changes = new HashSet<FilterListChange>(new[] { FilterListChange.Create(list, createReason) });
|
||||
return list;
|
||||
|
|
|
|||
Loading…
Reference in a new issue