🐛 Fix post-reply will still create normal activities
🐛 Fix publisher get by name endpoint requires authorization
This commit is contained in:
parent
185ab13ec9
commit
68399dd371
@ -133,9 +133,11 @@ public class ActivityService(AppDatabase db)
|
|||||||
var identifier = $"posts/{post.Id}";
|
var identifier = $"posts/{post.Id}";
|
||||||
if (post.RepliedPostId is not null)
|
if (post.RepliedPostId is not null)
|
||||||
{
|
{
|
||||||
var ogPost = await db.Posts.Where(e => e.Id == post.RepliedPostId).Include(e => e.Publisher)
|
var ogPost = await db.Posts
|
||||||
|
.Where(e => e.Id == post.RepliedPostId)
|
||||||
|
.Include(e => e.Publisher)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (ogPost == null) return;
|
if (ogPost?.Publisher.AccountId == null) return;
|
||||||
await CreateActivity(
|
await CreateActivity(
|
||||||
user,
|
user,
|
||||||
"posts.new.replies",
|
"posts.new.replies",
|
||||||
@ -143,6 +145,7 @@ public class ActivityService(AppDatabase db)
|
|||||||
ActivityVisibility.Selected,
|
ActivityVisibility.Selected,
|
||||||
[ogPost.Publisher.AccountId!.Value]
|
[ogPost.Publisher.AccountId!.Value]
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await CreateActivity(
|
await CreateActivity(
|
||||||
|
@ -19,8 +19,6 @@ public class PublisherController(AppDatabase db, PublisherService ps, FileServic
|
|||||||
[HttpGet("{name}")]
|
[HttpGet("{name}")]
|
||||||
public async Task<ActionResult<Publisher>> GetPublisher(string name)
|
public async Task<ActionResult<Publisher>> GetPublisher(string name)
|
||||||
{
|
{
|
||||||
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
|
|
||||||
|
|
||||||
var publisher = await db.Publishers
|
var publisher = await db.Publishers
|
||||||
.Where(e => e.Name == name)
|
.Where(e => e.Name == name)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user