-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show "You" for active account in mail rendering page (#566)
* Added account contact view model to handle "You" case. * fix namespaces again
- Loading branch information
Showing
9 changed files
with
337 additions
and
312 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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Wino.Core.Domain; | ||
using Wino.Core.Domain.Entities.Shared; | ||
|
||
namespace Wino.Mail.ViewModels.Data; | ||
|
||
public class AccountContactViewModel: AccountContact | ||
{ | ||
public AccountContactViewModel(AccountContact contact) | ||
{ | ||
Address = contact.Address; | ||
Name = contact.Name; | ||
Base64ContactPicture = contact.Base64ContactPicture; | ||
IsRootContact = contact.IsRootContact; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets whether the contact is the current account. | ||
/// </summary> | ||
public bool IsMe { get; set; } | ||
|
||
/// <summary> | ||
/// Provides a short name of the contact. | ||
/// <see cref="ShortDisplayName"/> or "You" | ||
/// </summary> | ||
public string ShortNameOrYou => IsMe ? Translator.AccountContactNameYou : ShortDisplayName; | ||
|
||
/// <summary> | ||
/// Short display name of the contact. | ||
/// Either Name or Address. | ||
/// </summary> | ||
public string ShortDisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? $"{Address.ToLowerInvariant()};" : $"{Name};"; | ||
|
||
/// <summary> | ||
/// Display name of the contact in a format: Name <Address>. | ||
/// </summary> | ||
public string DisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? Address.ToLowerInvariant() : $"{Name} <{Address.ToLowerInvariant()}>"; | ||
} |
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.