Unify StatusMessage handling

This commit is contained in:
nicolas.dorier
2019-11-07 18:59:51 +09:00
parent ff8de47e69
commit aab7c08500
8 changed files with 44 additions and 128 deletions

View File

@@ -10,32 +10,6 @@ namespace BTCPayServer.Models
{
}
public StatusMessageModel(string s)
{
if (string.IsNullOrEmpty(s))
return;
try
{
if (s.StartsWith("{", StringComparison.InvariantCultureIgnoreCase) &&
s.EndsWith("}", StringComparison.InvariantCultureIgnoreCase))
{
var model = JObject.Parse(s).ToObject<StatusMessageModel>();
Html = model.Html;
Message = model.Message;
Severity = model.Severity;
AllowDismiss = model.AllowDismiss;
}
else
{
ParseNonJsonStatus(s);
}
}
catch (Exception)
{
ParseNonJsonStatus(s);
}
}
public string Message { get; set; }
public string Html { get; set; }
public StatusSeverity Severity { get; set; }