mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 11:01:49 +01:00
SendLikeActivity to api
It might not be a good idea to start a possibly long lasting http call during a running DB transaction. I.E. in the case of failing transaction we already sent some data into the world which might not be valid.
This commit is contained in:
parent
bbe5096307
commit
b2105de36f
1 changed files with 9 additions and 1 deletions
|
@ -156,13 +156,21 @@ func Star(ctx *context.APIContext) {
|
|||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
userID := ctx.Doer.ID
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
|
||||
// TODO: why is this *context.APIContext passed, where a context.Context is expected?
|
||||
err := repo_model.StarRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, true)
|
||||
err := repo_model.StarRepo(ctx, userID, repoID, true)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "StarRepo", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := repo_model.SendLikeActivities(ctx, userID, repoID); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "StarRepo", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Status(http.StatusNoContent)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue