Account flags

This commit is contained in:
2024-08-26 13:33:41 +03:00
parent 3e99c53fb3
commit 56feac7f9d
11 changed files with 631 additions and 25 deletions

View File

@ -136,7 +136,7 @@ public class NostrController : Controller
return NotFound();
}
if (patch.AcceptTos)
if (patch.AcceptTos.HasValue && patch.AcceptTos.Value)
{
await _userService.AcceptTos(user.PubKey);
}
@ -267,7 +267,7 @@ public class NostrController : Controller
var existing = await _db.PushSubscriptions.FirstOrDefaultAsync(a => a.Key == sub.Key);
if (existing != default)
{
return Json(new { id = existing.Id });
return Json(new {id = existing.Id});
}
var newId = Guid.NewGuid();
@ -298,7 +298,7 @@ public class NostrController : Controller
var sub = await _db.PushSubscriptionTargets
.Join(_db.PushSubscriptions, a => a.SubscriberPubkey, b => b.Pubkey,
(a, b) => new { a.SubscriberPubkey, a.TargetPubkey, b.Auth })
(a, b) => new {a.SubscriberPubkey, a.TargetPubkey, b.Auth})
.Where(a => a.SubscriberPubkey == userPubkey && a.Auth == auth)
.Select(a => a.TargetPubkey)
.ToListAsync();
@ -415,4 +415,4 @@ public class NostrController : Controller
var claim = HttpContext.User.Claims.FirstOrDefault(a => a.Type == ClaimTypes.Name);
return claim!.Value;
}
}
}