mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-27 14:55:25 +08:00
Add ShouldShowCommentType function when rendering pull review conversation
This commit is contained in:
parent
0d65d7140b
commit
5b9049dec0
@ -6,6 +6,7 @@ package repo
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
issues_model "code.gitea.io/gitea/models/issues"
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
@ -198,6 +199,19 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
|
|||||||
ctx.ServerError("comment.Issue.LoadAttributes", err)
|
ctx.ServerError("comment.Issue.LoadAttributes", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hiddenCommentTypes *big.Int
|
||||||
|
if ctx.IsSigned {
|
||||||
|
val, err := user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyHiddenCommentTypes)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("GetUserSetting", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hiddenCommentTypes, _ = new(big.Int).SetString(val, 10) // we can safely ignore the failed conversion here
|
||||||
|
}
|
||||||
|
ctx.Data["ShouldShowCommentType"] = func(commentType issues_model.CommentType) bool {
|
||||||
|
return hiddenCommentTypes == nil || hiddenCommentTypes.Bit(int(commentType)) == 0
|
||||||
|
}
|
||||||
ctx.Data["Issue"] = comment.Issue
|
ctx.Data["Issue"] = comment.Issue
|
||||||
ctx.Data["IsIssue"] = true
|
ctx.Data["IsIssue"] = true
|
||||||
ctx.Data["Comments"] = comment.Issue.Comments
|
ctx.Data["Comments"] = comment.Issue.Comments
|
||||||
|
Loading…
x
Reference in New Issue
Block a user