Signaling reference pass, bugfixing reference to deserialized blob

This commit is contained in:
rockstardev
2020-06-15 00:36:50 -05:00
parent f072ec3a8c
commit 2c44c25b25
3 changed files with 4 additions and 5 deletions

View File

@@ -36,9 +36,8 @@ namespace BTCPayServer.Models.NotificationViewModels
var fullTypeName = baseType.FullName.Replace(nameof(BaseNotification), data.NotificationType, StringComparison.OrdinalIgnoreCase); var fullTypeName = baseType.FullName.Replace(nameof(BaseNotification), data.NotificationType, StringComparison.OrdinalIgnoreCase);
var parsedType = baseType.Assembly.GetType(fullTypeName); var parsedType = baseType.Assembly.GetType(fullTypeName);
var instance = Activator.CreateInstance(parsedType) as BaseNotification;
var casted = JsonConvert.DeserializeObject(ZipUtils.Unzip(data.Blob), parsedType); var casted = (BaseNotification)JsonConvert.DeserializeObject(ZipUtils.Unzip(data.Blob), parsedType);
var obj = new NotificationViewModel var obj = new NotificationViewModel
{ {
Id = data.Id, Id = data.Id,
@@ -46,7 +45,7 @@ namespace BTCPayServer.Models.NotificationViewModels
Seen = data.Seen Seen = data.Seen
}; };
instance.FillViewModel(obj); casted.FillViewModel(ref obj);
return obj; return obj;
} }

View File

@@ -27,6 +27,6 @@ namespace BTCPayServer.Services.Notifications.Blobs
return data; return data;
} }
public abstract void FillViewModel(NotificationViewModel data); public abstract void FillViewModel(ref NotificationViewModel data);
} }
} }

View File

@@ -10,7 +10,7 @@ namespace BTCPayServer.Services.Notifications.Blobs
public string Version { get; set; } public string Version { get; set; }
public override void FillViewModel(NotificationViewModel vm) public override void FillViewModel(ref NotificationViewModel vm)
{ {
vm.Body = $"New version {Version} released!"; vm.Body = $"New version {Version} released!";
vm.ActionLink = $"https://github.com/btcpayserver/btcpayserver/releases/tag/v{Version}"; vm.ActionLink = $"https://github.com/btcpayserver/btcpayserver/releases/tag/v{Version}";