2022-06-23 06:41:52 +02:00
|
|
|
using System;
|
2021-12-31 08:59:02 +01:00
|
|
|
using System.Linq;
|
2021-11-26 15:13:41 +01:00
|
|
|
using BTCPayServer.Data;
|
|
|
|
using BTCPayServer.Services.Invoices;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
namespace BTCPayServer
|
|
|
|
{
|
|
|
|
public static class UserExtensions
|
|
|
|
{
|
2022-06-23 06:41:52 +02:00
|
|
|
public static MimeKit.MailboxAddress GetMailboxAddress(this ApplicationUser user)
|
|
|
|
{
|
|
|
|
if (user is null)
|
|
|
|
throw new ArgumentNullException(nameof(user));
|
|
|
|
var name = user.UserName ?? String.Empty;
|
|
|
|
if (user.Email == user.UserName)
|
|
|
|
name = String.Empty;
|
|
|
|
return new MimeKit.MailboxAddress(name, user.Email);
|
|
|
|
}
|
2021-11-26 15:13:41 +01:00
|
|
|
}
|
|
|
|
}
|