Skip to content

Commit

Permalink
Adjustments to #4382 (#4431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baas-hub authored Oct 24, 2022
1 parent 12236a2 commit dd39b04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public async Task<ActionResult> Update(string email, string[] languages, string
UserPreferenceModel preference = await _userPreferenceCache.GetUserPreferences(User);

preference.Theme = theme;

HashSet<string> Languages = new HashSet<string>(languages);
preference.Language = Languages;

HashSet<string> Languages = new HashSet<string>(languages);
preference.ApprovedLanguages = Languages;

if(profile.UserName == null)
{
await _userProfileManager.createUserProfileAsync(User, email, Languages, preference);
Expand Down
6 changes: 3 additions & 3 deletions src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
var anyChecked = false;
}
<div style="max-height:400px;width:max-content;overflow-y:auto">
@foreach (var approver in Model.approvers)
@foreach (var approver in Model.PreferredApprovers)
{
<span class="checkbox dropdown-item-text">
<label>
Expand Down Expand Up @@ -111,7 +111,7 @@
}
else
{
@if (Model.ActiveConversations > 0 && Model.approvers.Contains(User.GetGitHubLogin()))
@if (Model.ActiveConversations > 0 && Model.PreferredApprovers.Contains(User.GetGitHubLogin()))
{
<button type="button" class="btn btn-sm shadow-sm btn-success ml-2" data-toggle="modal" data-target="#approveModel">
<i class="far fa-thumbs-up" aria-hidden="true"></i>&nbsp;&nbsp;Approve
Expand Down Expand Up @@ -141,7 +141,7 @@
}
else
{
@if (Model.approvers.Contains(User.GetGitHubLogin()))
@if (Model.PreferredApprovers.Contains(User.GetGitHubLogin()))
{
<button type="submit" class="btn btn-sm shadow-sm btn-success ml-2">
<i class="far fa-thumbs-up" aria-hidden="true"></i>&nbsp;&nbsp;Approve
Expand Down
10 changes: 5 additions & 5 deletions src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ReviewPageModel(

public IEnumerable<ReviewModel> ReviewsForPackage { get; set; } = new List<ReviewModel>();

public readonly HashSet<string> approvers = new HashSet<string>();
public readonly HashSet<string> PreferredApprovers = new HashSet<string>();

public async Task<IActionResult> OnGetAsync(string id, string revisionId = null)
{
Expand Down Expand Up @@ -156,18 +156,18 @@ public async Task<IActionResult> OnGetAsync(string id, string revisionId = null)
userCache.ApprovedLanguages = langs;
_preferenceCache.UpdateUserPreference(userCache, User);
}
if (langs.Contains(Review.Language))
if (langs.Contains(Review.Language) || !langs.Any())
{
approvers.Add(username);
PreferredApprovers.Add(username);
}
}
else
{
UserProfileModel user = await _userProfileRepository.tryGetUserProfileAsync(username);
var langs = user.Languages;
if (langs.Contains(Review.Language))
if (langs.Contains(Review.Language) || !langs.Any())
{
approvers.Add(username);
PreferredApprovers.Add(username);
}
}
}
Expand Down

0 comments on commit dd39b04

Please sign in to comment.