Skip to content

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 remote-tracking branch 'github/feat/1.1.2/ui' into feat/1.1.2/user-center

LinkinStarse280358b7cbe
diff --cc i18n/en_US.yaml
index b6da8a38,4d1a5bb6..59b7f70b
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@@ -12,8 -12,17 +12,19 @@@ backend
other: Unauthorized.
database_error:
other: Data server error.
+ action:
+ report:
+ other: Flag
+ edit:
+ other: Edit
+ delete:
+ other: Delete
+ close:
+ other: Close
+ reopen:
+ other: Reopen
+ forbidden_error:
+ other: Forbidden.
role:
name:
user:
diff --cc internal/base/reason/reason.go
index 22895048,5f9e316a..999534a6
--- a/internal/base/reason/reason.go
+++ b/internal/base/reason/reason.go
@@@ -16,61 -14,60 +16,61 @@@ 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"
- 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"
- EmailIllegalDomainError = "error.email.illegal_email_domain_error"
- 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"
+ 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"
+ TagAlreadyExist = "error.tag.already_exist"
+ RankFailToMeetTheCondition = "error.rank.fail_to_meet_the_condition"
+ VoteRankFailToMeetTheCondition = "error.rank.vote_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/siteinfo_schema.go
index 70e52921,4f786009..d23699a4
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@@ -185,8 -169,8 +185,9 @@@ type SiteInfoResp struct
Theme *SiteThemeResp `json:"theme"`
CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
SiteSeo *SiteSeoReq `json:"site_seo"`
+ SiteUsers *SiteUsersResp `json:"site_users"`
Version string `json:"version"`
+ Revision string `json:"revision"`
}
type TemplateSiteInfoResp struct {
General *SiteGeneralResp `json:"general"`
diff --cc internal/service/uploader/upload.go
index fdff50dd,980e82e2..3de12ff2
--- a/internal/service/uploader/upload.go
+++ b/internal/service/uploader/upload.go
@@@ -17,11 -18,10 +18,12 @@@ import
"github.com/answerdev/answer/pkg/checker"
"github.com/answerdev/answer/pkg/dir"
"github.com/answerdev/answer/pkg/uid"
+ "github.com/answerdev/answer/plugin"
"github.com/disintegration/imaging"
"github.com/gin-gonic/gin"
+ exifremove "github.com/scottleedavis/go-exif-remove"
"github.com/segmentfault/pacman/errors"
+ "github.com/segmentfault/pacman/log"
)
const (
@@@ -227,17 -204,18 +230,33 @@@ func (us *UploaderService) uploadFile(c
return url, nil
}
+func (us *UploaderService) tryToUploadByPlugin(ctx *gin.Context, source plugin.UploadSource) (
+ url string, err error) {
+ _ = plugin.CallStorage(func(fn plugin.Storage) error {
+ resp := fn.UploadFile(ctx, source)
+ if resp.OriginalError != nil {
+ log.Errorf("upload file by plugin failed, err: %v", resp.OriginalError)
+ err = errors.BadRequest("").WithMsg(resp.DisplayErrorMsg.Translate(ctx)).WithError(err)
+ } else {
+ url = resp.FullURL
+ }
+ return nil
+ })
+ return url, err
+}
++
+ func Dexif(filepath string, destpath string) error {
+ img, err := ioutil.ReadFile(filepath)
+ if err != nil {
+ return err
+ }
+ noExifBytes, err := exifremove.Remove(img)
+ if err != nil {
+ return err
+ }
+ err = os.WriteFile(destpath, noExifBytes, 0644)
+ if err != nil {
+ return err
+ }
+ return nil
+ }