mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
fix(ui): allow unreacting from comment popover
- fix selectors for hasReacted - don't send empty HTML on reaction errors - add E2E test
This commit is contained in:
parent
633406704c
commit
b8a5ca2c40
3 changed files with 80 additions and 27 deletions
|
@ -3363,12 +3363,6 @@ func ChangeIssueReaction(ctx *context.Context) {
|
|||
log.Info("CreateIssueReaction: %s", err)
|
||||
break
|
||||
}
|
||||
// Reload new reactions
|
||||
issue.Reactions = nil
|
||||
if err = issue.LoadAttributes(ctx); err != nil {
|
||||
log.Info("issue.LoadAttributes: %s", err)
|
||||
break
|
||||
}
|
||||
|
||||
log.Trace("Reaction for issue created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, reaction.ID)
|
||||
case "unreact":
|
||||
|
@ -3377,19 +3371,19 @@ func ChangeIssueReaction(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Reload new reactions
|
||||
issue.Reactions = nil
|
||||
if err := issue.LoadAttributes(ctx); err != nil {
|
||||
log.Info("issue.LoadAttributes: %s", err)
|
||||
break
|
||||
}
|
||||
|
||||
log.Trace("Reaction for issue removed: %d/%d", ctx.Repo.Repository.ID, issue.ID)
|
||||
default:
|
||||
ctx.NotFound(fmt.Sprintf("Unknown action %s", ctx.Params(":action")), nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Reload new reactions
|
||||
issue.Reactions = nil
|
||||
if err := issue.LoadAttributes(ctx); err != nil {
|
||||
ctx.ServerError("ChangeIssueReaction.LoadAttributes", err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(issue.Reactions) == 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"empty": true,
|
||||
|
@ -3470,12 +3464,6 @@ func ChangeCommentReaction(ctx *context.Context) {
|
|||
log.Info("CreateCommentReaction: %s", err)
|
||||
break
|
||||
}
|
||||
// Reload new reactions
|
||||
comment.Reactions = nil
|
||||
if err = comment.LoadReactions(ctx, ctx.Repo.Repository); err != nil {
|
||||
log.Info("comment.LoadReactions: %s", err)
|
||||
break
|
||||
}
|
||||
|
||||
log.Trace("Reaction for comment created: %d/%d/%d/%d", ctx.Repo.Repository.ID, comment.Issue.ID, comment.ID, reaction.ID)
|
||||
case "unreact":
|
||||
|
@ -3484,19 +3472,19 @@ func ChangeCommentReaction(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Reload new reactions
|
||||
comment.Reactions = nil
|
||||
if err = comment.LoadReactions(ctx, ctx.Repo.Repository); err != nil {
|
||||
log.Info("comment.LoadReactions: %s", err)
|
||||
break
|
||||
}
|
||||
|
||||
log.Trace("Reaction for comment removed: %d/%d/%d", ctx.Repo.Repository.ID, comment.Issue.ID, comment.ID)
|
||||
default:
|
||||
ctx.NotFound(fmt.Sprintf("Unknown action %s", ctx.Params(":action")), nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Reload new reactions
|
||||
comment.Reactions = nil
|
||||
if err = comment.LoadReactions(ctx, ctx.Repo.Repository); err != nil {
|
||||
ctx.ServerError("ChangeCommentReaction.LoadReactions", err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(comment.Reactions) == 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"empty": true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue