A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
Merge branch 'feat/ui-1.1.0' into feature-plugin
LinkinStars9bd9b475f4e1
diff --cc internal/base/reason/reason.goindex 555e8663,2e4c8c82..b03ad55c--- a/internal/base/reason/reason.go+++ b/internal/base/reason/reason.go@@@ -14,58 -14,59 +14,60 @@@ const)const (- EmailOrPasswordWrong = "error.object.email_or_password_incorrect"- CommentNotFound = "error.comment.not_found"- CommentCannotEditAfterDeadline = "error.comment.cannot_edit_after_deadline"- QuestionNotFound = "error.question.not_found"- QuestionCannotDeleted = "error.question.cannot_deleted"- QuestionCannotClose = "error.question.cannot_close"- QuestionCannotUpdate = "error.question.cannot_update"- QuestionAlreadyDeleted = "error.question.already_deleted"- AnswerNotFound = "error.answer.not_found"- AnswerCannotDeleted = "error.answer.cannot_deleted"- AnswerCannotUpdate = "error.answer.cannot_update"+ EmailOrPasswordWrong = "error.object.email_or_password_incorrect"+ CommentNotFound = "error.comment.not_found"+ CommentCannotEditAfterDeadline = "error.comment.cannot_edit_after_deadline"+ QuestionNotFound = "error.question.not_found"+ QuestionCannotDeleted = "error.question.cannot_deleted"+ QuestionCannotClose = "error.question.cannot_close"+ QuestionCannotUpdate = "error.question.cannot_update"+ QuestionAlreadyDeleted = "error.question.already_deleted"+ AnswerNotFound = "error.answer.not_found"+ AnswerCannotDeleted = "error.answer.cannot_deleted"+ AnswerCannotUpdate = "error.answer.cannot_update"+ AnswerCannotAddByClosedQuestion = "error.answer.question_closed_cannot_add"- CommentEditWithoutPermission = "error.comment.edit_without_permission"- DisallowVote = "error.object.disallow_vote"- DisallowFollow = "error.object.disallow_follow"- DisallowVoteYourSelf = "error.object.disallow_vote_your_self"- CaptchaVerificationFailed = "error.object.captcha_verification_failed"- OldPasswordVerificationFailed = "error.object.old_password_verification_failed"- NewPasswordSameAsPreviousSetting = "error.object.new_password_same_as_previous_setting"- UserNotFound = "error.user.not_found"- UsernameInvalid = "error.user.username_invalid"- UsernameDuplicate = "error.user.username_duplicate"- UserSetAvatar = "error.user.set_avatar"- EmailDuplicate = "error.email.duplicate"- EmailVerifyURLExpired = "error.email.verify_url_expired"- EmailNeedToBeVerified = "error.email.need_to_be_verified"- UserSuspended = "error.user.suspended"- ObjectNotFound = "error.object.not_found"- TagNotFound = "error.tag.not_found"- TagNotContainSynonym = "error.tag.not_contain_synonym_tags"- TagCannotUpdate = "error.tag.cannot_update"- TagIsUsedCannotDelete = "error.tag.is_used_cannot_delete"+ CommentEditWithoutPermission = "error.comment.edit_without_permission"+ DisallowVote = "error.object.disallow_vote"+ DisallowFollow = "error.object.disallow_follow"+ DisallowVoteYourSelf = "error.object.disallow_vote_your_self"+ CaptchaVerificationFailed = "error.object.captcha_verification_failed"+ OldPasswordVerificationFailed = "error.object.old_password_verification_failed"+ NewPasswordSameAsPreviousSetting = "error.object.new_password_same_as_previous_setting"+ UserNotFound = "error.user.not_found"+ UsernameInvalid = "error.user.username_invalid"+ UsernameDuplicate = "error.user.username_duplicate"+ UserSetAvatar = "error.user.set_avatar"+ EmailDuplicate = "error.email.duplicate"+ EmailVerifyURLExpired = "error.email.verify_url_expired"+ EmailNeedToBeVerified = "error.email.need_to_be_verified"+ UserSuspended = "error.user.suspended"+ ObjectNotFound = "error.object.not_found"+ TagNotFound = "error.tag.not_found"+ TagNotContainSynonym = "error.tag.not_contain_synonym_tags"+ TagCannotUpdate = "error.tag.cannot_update"+ TagIsUsedCannotDelete = "error.tag.is_used_cannot_delete"+ TagAlreadyExist = "error.tag.already_exist"- RankFailToMeetTheCondition = "error.rank.fail_to_meet_the_condition"- ThemeNotFound = "error.theme.not_found"- LangNotFound = "error.lang.not_found"- ReportHandleFailed = "error.report.handle_failed"- ReportNotFound = "error.report.not_found"- ReadConfigFailed = "error.config.read_config_failed"- DatabaseConnectionFailed = "error.database.connection_failed"- InstallCreateTableFailed = "error.database.create_table_failed"- InstallConfigFailed = "error.install.create_config_failed"- SiteInfoNotFound = "error.site_info.not_found"- UploadFileSourceUnsupported = "error.upload.source_unsupported"- UploadFileUnsupportedFileFormat = "error.upload.unsupported_file_format"- RecommendTagNotExist = "error.tag.recommend_tag_not_found"- RecommendTagEnter = "error.tag.recommend_tag_enter"- RevisionReviewUnderway = "error.revision.review_underway"- RevisionNoPermission = "error.revision.no_permission"- UserCannotUpdateYourRole = "error.user.cannot_update_your_role"- TagCannotSetSynonymAsItself = "error.tag.cannot_set_synonym_as_itself"- NotAllowedRegistration = "error.user.not_allowed_registration"- SMTPConfigFromNameCannotBeEmail = "error.smtp.config_from_name_cannot_be_email"- AdminCannotUpdateTheirPassword = "error.admin.cannot_update_their_password"- AdminCannotModifySelfStatus = "error.admin.cannot_modify_self_status"+ RankFailToMeetTheCondition = "error.rank.fail_to_meet_the_condition"+ ThemeNotFound = "error.theme.not_found"+ LangNotFound = "error.lang.not_found"+ ReportHandleFailed = "error.report.handle_failed"+ ReportNotFound = "error.report.not_found"+ ReadConfigFailed = "error.config.read_config_failed"+ DatabaseConnectionFailed = "error.database.connection_failed"+ InstallCreateTableFailed = "error.database.create_table_failed"+ InstallConfigFailed = "error.install.create_config_failed"+ SiteInfoNotFound = "error.site_info.not_found"+ UploadFileSourceUnsupported = "error.upload.source_unsupported"+ UploadFileUnsupportedFileFormat = "error.upload.unsupported_file_format"+ RecommendTagNotExist = "error.tag.recommend_tag_not_found"+ RecommendTagEnter = "error.tag.recommend_tag_enter"+ RevisionReviewUnderway = "error.revision.review_underway"+ RevisionNoPermission = "error.revision.no_permission"+ UserCannotUpdateYourRole = "error.user.cannot_update_your_role"+ TagCannotSetSynonymAsItself = "error.tag.cannot_set_synonym_as_itself"+ NotAllowedRegistration = "error.user.not_allowed_registration"+ SMTPConfigFromNameCannotBeEmail = "error.smtp.config_from_name_cannot_be_email"+ AdminCannotUpdateTheirPassword = "error.admin.cannot_update_their_password"+ AdminCannotModifySelfStatus = "error.admin.cannot_modify_self_status"+ UserExternalLoginUnbindingForbidden = "error.user.external_login_unbinding_forbidden")diff --cc internal/schema/user_schema.goindex 7111b043,64e01974..c761e6cb--- a/internal/schema/user_schema.go+++ b/internal/schema/user_schema.go@@@ -66,12 -68,10 +68,12 @@@ type GetUserResp structLanguage string `json:"language"`// access tokenAccessToken string `json:"access_token"`- // is admin- IsAdmin bool `json:"is_admin"`+ // role id+ RoleID int `json:"role_id"`// user statusStatus string `json:"status"`+ // user have password+ HavePassword bool `json:"have_password"`}func (r *GetUserResp) GetFromUserEntity(userInfo *entity.User) {@@@ -106,13 -108,13 +112,19 @@@ func (r *GetUserToSetShowResp) GetFromUr.Avatar = avatarInfo}+const (+ AvatarTypeDefault = "default"+ AvatarTypeGravatar = "gravatar"+ AvatarTypeCustom = "custom"+)+- func FormatAvatarInfo(avatarJson string) string {+ func FormatAvatarInfo(avatarJson, email string) (res string) {+ defer func() {+ if constant.DefaultAvatar == "gravatar" && len(res) == 0 {+ res = gravatar.GetAvatarURL(email)+ }+ }()+if avatarJson == "" {return ""}diff --cc internal/service/user_service.goindex b89d95a2,5aef83ef..3cbf62c8--- a/internal/service/user_service.go+++ b/internal/service/user_service.go@@@ -86,8 -81,7 +86,8 @@@ func (us *UserService) GetUserInfoByUseresp = &schema.GetUserToSetShowResp{}resp.GetFromUserEntity(userInfo)resp.AccessToken = token- resp.IsAdmin = roleID == role.RoleAdminID+ resp.RoleID = roleID+ resp.HavePassword = len(userInfo.Pass) > 0return resp, nil}