mirror of https://gitee.com/answerdev/answer.git
feat(notification): add notification translation
This commit is contained in:
parent
01bd603570
commit
674d98e983
|
@ -388,6 +388,8 @@ backend:
|
||||||
other: downvoted answer
|
other: downvoted answer
|
||||||
up_voted_comment:
|
up_voted_comment:
|
||||||
other: upvoted comment
|
other: upvoted comment
|
||||||
|
invited_you_to_answer:
|
||||||
|
other: invited you to answer
|
||||||
email_tpl:
|
email_tpl:
|
||||||
change_email:
|
change_email:
|
||||||
title:
|
title:
|
||||||
|
|
|
@ -232,30 +232,9 @@ func (qc *QuestionController) GetQuestion(ctx *gin.Context) {
|
||||||
// @Success 200 {string} string ""
|
// @Success 200 {string} string ""
|
||||||
// @Router /answer/api/v1/question/invite [get]
|
// @Router /answer/api/v1/question/invite [get]
|
||||||
func (qc *QuestionController) GetQuestionInviteUserInfo(ctx *gin.Context) {
|
func (qc *QuestionController) GetQuestionInviteUserInfo(ctx *gin.Context) {
|
||||||
id := ctx.Query("id")
|
questionID := uid.DeShortID(ctx.Query("id"))
|
||||||
id = uid.DeShortID(id)
|
resp, err := qc.questionService.InviteUserInfo(ctx, questionID)
|
||||||
userID := middleware.GetLoginUserIDFromContext(ctx)
|
handler.HandleResponse(ctx, err, resp)
|
||||||
req := schema.QuestionPermission{}
|
|
||||||
canList, err := qc.rankService.CheckOperationPermissions(ctx, userID, []string{
|
|
||||||
permission.QuestionEdit,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
handler.HandleResponse(ctx, err, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
objectOwner := qc.rankService.CheckOperationObjectOwner(ctx, userID, id)
|
|
||||||
|
|
||||||
req.CanEdit = canList[0] || objectOwner
|
|
||||||
if !req.CanEdit {
|
|
||||||
handler.HandleResponse(ctx, errors.Forbidden(reason.RankFailToMeetTheCondition), nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
list, err := qc.questionService.InviteUserInfo(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
handler.HandleResponse(ctx, err, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
handler.HandleResponse(ctx, nil, list)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +537,7 @@ func (qc *QuestionController) UpdateQuestionInviteUser(ctx *gin.Context) {
|
||||||
req.UserID = middleware.GetLoginUserIDFromContext(ctx)
|
req.UserID = middleware.GetLoginUserIDFromContext(ctx)
|
||||||
|
|
||||||
canList, err := qc.rankService.CheckOperationPermissions(ctx, req.UserID, []string{
|
canList, err := qc.rankService.CheckOperationPermissions(ctx, req.UserID, []string{
|
||||||
permission.QuestionEdit,
|
permission.AnswerInviteSomeoneToAnswer,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handler.HandleResponse(ctx, err, nil)
|
handler.HandleResponse(ctx, err, nil)
|
||||||
|
|
Loading…
Reference in New Issue