Skip to content

Commit

Permalink
Added guards for empty results
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGershony committed Nov 14, 2023
1 parent e184be6 commit 293a60c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Angor/Client/Pages/Browse.razor
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
{
searchInProgress = true;
var blockchainProjects = await _IndexerService.GetProjectsAsync();

blockchainProjects = blockchainProjects.Where(_ => _.NostrPubKey != null).ToList();

var projectCreators = SessionStorage.GetProjectSubscribedList();

Expand Down
2 changes: 1 addition & 1 deletion src/Angor/Client/Pages/Create.razor
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@

if (!response.Success)
{
await _RelayService.DeleteProjectAsync(resultId, NBitcoin.DataEncoders.Encoders.Hex.EncodeData(nostrKey.ToBytes()));
await _RelayService.DeleteProjectAsync(resultId, nostrKeyHex);
//storage.AddFounderProject(project); TODO remove from storage
return response;
}
Expand Down
9 changes: 4 additions & 5 deletions src/Angor/Shared/Services/RelayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,13 @@ public Task<string> CreateNostrProfileAsync(NostrMetadata metadata, string hexPr
public Task<string> DeleteProjectAsync(string eventId, string hexPrivateKey)
{
var key = NostrPrivateKey.FromHex(hexPrivateKey);

var deleteEvent = new NostrEvent
{
Content = "Failed to publish the transaction to the blockchain",
CreatedAt = DateTime.UtcNow,
Kind = NostrKind.EventDeletion,
Tags = new NostrEventTags(new NostrEventTag("e", eventId),
new NostrEventTag("a",$"{NostrKind.Metadata}:{key.DerivePublicKey().Hex}"))
CreatedAt = DateTime.UtcNow,
Content = "Failed to publish the transaction to the blockchain",
Tags = new NostrEventTags(NostrEventTag.Event(eventId))
}.Sign(key);

_nostrClient.Send(deleteEvent);
Expand Down

0 comments on commit 293a60c

Please sign in to comment.