-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor showing of player links so that it will be honored at schedule
- Loading branch information
Showing
21 changed files
with
121 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/JoinRpg.Portal/Views/Shared/DisplayTemplates/IPlayerCharacter.cshtml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
namespace JoinRpg.WebComponents; | ||
|
||
public record UserLinkViewModel(int UserId, string DisplayName); | ||
public enum ViewMode | ||
{ | ||
Show, | ||
ShowAsPrivate, | ||
Hide | ||
} | ||
public record UserLinkViewModel(int UserId, string DisplayName, ViewMode ViewMode) | ||
{ | ||
public static UserLinkViewModel Hidden = new(-1, "ñêðûòî", ViewMode.Hide); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/JoinRpg.WebPortal.Models/Characters/CharacterViewModeExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using JoinRpg.DataModel; | ||
using JoinRpg.Domain; | ||
using JoinRpg.Web.Models.UserProfile; | ||
using JoinRpg.WebComponents; | ||
|
||
|
||
namespace JoinRpg.Web.Models.Characters; | ||
public static class CharacterViewModeExtensions | ||
{ | ||
public static ViewMode GetViewModeForCharacter(this Character character, int? currentUserIdOrDefault) | ||
{ | ||
var hasAccess = character.HasAnyAccess(currentUserIdOrDefault); | ||
return (character.HidePlayerForCharacter, hasAccess, character.Project.Details.PublishPlot) | ||
switch | ||
{ | ||
(false, _, _) => ViewMode.Show, | ||
(true, false, false) => ViewMode.Hide, | ||
(true, _, true) => ViewMode.ShowAsPrivate, | ||
(true, true, _) => ViewMode.ShowAsPrivate, | ||
}; | ||
} | ||
|
||
public static UserLinkViewModel? GetCharacterPlayerLinkViewModel(this Character character, int? currentUserIdOrDefault) | ||
{ | ||
return UserLinks.Create(character.ApprovedClaim?.Player, character.GetViewModeForCharacter(currentUserIdOrDefault)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.