chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
type ActivityTypeKey string
|
||||
|
||||
const (
|
||||
ActEdited = "edited"
|
||||
ActClosed = "closed"
|
||||
ActVotedDown = "voted_down"
|
||||
ActVotedUp = "voted_up"
|
||||
ActVoteDown = "vote_down"
|
||||
ActVoteUp = "vote_up"
|
||||
ActUpVote = "upvote"
|
||||
ActDownVote = "downvote"
|
||||
ActFollow = "follow"
|
||||
ActAccepted = "accepted"
|
||||
ActAccept = "accept"
|
||||
ActPin = "pin"
|
||||
ActUnPin = "unpin"
|
||||
ActShow = "show"
|
||||
ActHide = "hide"
|
||||
)
|
||||
|
||||
const (
|
||||
ActQuestionAsked ActivityTypeKey = "question.asked"
|
||||
ActQuestionClosed ActivityTypeKey = "question.closed"
|
||||
ActQuestionReopened ActivityTypeKey = "question.reopened"
|
||||
ActQuestionAnswered ActivityTypeKey = "question.answered"
|
||||
ActQuestionCommented ActivityTypeKey = "question.commented"
|
||||
ActQuestionAccept ActivityTypeKey = "question.accept"
|
||||
ActQuestionUpvote ActivityTypeKey = "question.upvote"
|
||||
ActQuestionDownVote ActivityTypeKey = "question.downvote"
|
||||
ActQuestionEdited ActivityTypeKey = "question.edited"
|
||||
ActQuestionRollback ActivityTypeKey = "question.rollback"
|
||||
ActQuestionDeleted ActivityTypeKey = "question.deleted"
|
||||
ActQuestionUndeleted ActivityTypeKey = "question.undeleted"
|
||||
ActQuestionPin ActivityTypeKey = "question.pin"
|
||||
ActQuestionUnPin ActivityTypeKey = "question.unpin"
|
||||
ActQuestionHide ActivityTypeKey = "question.hide"
|
||||
ActQuestionShow ActivityTypeKey = "question.show"
|
||||
)
|
||||
|
||||
const (
|
||||
ActAnswerAnswered ActivityTypeKey = "answer.answered"
|
||||
ActAnswerCommented ActivityTypeKey = "answer.commented"
|
||||
ActAnswerAccept ActivityTypeKey = "answer.accept"
|
||||
ActAnswerUpvote ActivityTypeKey = "answer.upvote"
|
||||
ActAnswerDownVote ActivityTypeKey = "answer.downvote"
|
||||
ActAnswerEdited ActivityTypeKey = "answer.edited"
|
||||
ActAnswerRollback ActivityTypeKey = "answer.rollback"
|
||||
ActAnswerDeleted ActivityTypeKey = "answer.deleted"
|
||||
ActAnswerUndeleted ActivityTypeKey = "answer.undeleted"
|
||||
)
|
||||
|
||||
const (
|
||||
ActTagCreated ActivityTypeKey = "tag.created"
|
||||
ActTagEdited ActivityTypeKey = "tag.edited"
|
||||
ActTagRollback ActivityTypeKey = "tag.rollback"
|
||||
ActTagDeleted ActivityTypeKey = "tag.deleted"
|
||||
ActTagUndeleted ActivityTypeKey = "tag.undeleted"
|
||||
)
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
AIConfigProvider = "ai_config.provider"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultAIPromptConfigZhCN = `你是一个智能助手,可以帮助用户查询系统中的信息。用户问题:%s
|
||||
|
||||
你可以使用以下工具来查询系统信息:
|
||||
- get_questions: 搜索系统中已存在的问题,使用这个工具可以获取问题列表后注意需要使用 get_answers_by_question_id 获取问题的答案
|
||||
- get_answers_by_question_id: 根据问题ID获取该问题的所有答案
|
||||
- get_comments: 搜索评论信息
|
||||
- get_tags: 搜索标签信息
|
||||
- get_tag_detail: 获取特定标签的详细信息
|
||||
- get_user: 搜索用户信息
|
||||
- semantic_search: 通过语义相似度搜索问题和答案。当用户的问题与现有内容概念相关但可能不匹配确切关键词时使用此工具。当 get_questions 关键词搜索返回较差结果时,请使用 semantic_search。
|
||||
|
||||
请根据用户的问题智能地使用这些工具来提供准确的答案。如果需要查询系统信息,请先使用相应的工具获取数据。`
|
||||
DefaultAIPromptConfigEnUS = `You are an intelligent assistant that can help users query information in the system. User question: %s
|
||||
|
||||
You can use the following tools to query system information:
|
||||
- get_questions: Search for existing questions in the system. After using this tool to get the question list, you need to use get_answers_by_question_id to get the answers to the questions
|
||||
- get_answers_by_question_id: Get all answers for a question based on question ID
|
||||
- get_comments: Search for comment information
|
||||
- get_tags: Search for tag information
|
||||
- get_tag_detail: Get detailed information about a specific tag
|
||||
- get_user: Search for user information
|
||||
- semantic_search: Search questions and answers by semantic meaning. Use this when the user's question relates conceptually to existing content but may not match exact keywords. When get_questions keyword search returns poor results, use semantic_search instead.
|
||||
|
||||
Please intelligently use these tools based on the user's question to provide accurate answers. If you need to query system information, please use the appropriate tools to get the data first.`
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
UserStatusChangedCacheKey = "answer:user:status:"
|
||||
UserStatusChangedCacheTime = 7 * 24 * time.Hour
|
||||
UserTokenCacheKey = "answer:user:token:"
|
||||
UserTokenCacheTime = 7 * 24 * time.Hour
|
||||
UserVisitTokenCacheKey = "answer:user:visit:"
|
||||
UserVisitCacheTime = 7 * 24 * 60 * 60
|
||||
UserVisitCookiesCacheKey = "visit"
|
||||
AdminTokenCacheKey = "answer:admin:token:"
|
||||
AdminTokenCacheTime = 7 * 24 * time.Hour
|
||||
UserTokenMappingCacheKey = "answer:user-token:mapping:"
|
||||
UserEmailCodeCacheKey = "answer:user:email-code:"
|
||||
UserEmailCodeCacheTime = 10 * time.Minute
|
||||
UserLatestEmailCodeCacheKey = "answer:user-id:email-code:"
|
||||
SiteInfoCacheKey = "answer:site-info:"
|
||||
SiteInfoCacheTime = 1 * time.Hour
|
||||
ConfigID2KEYCacheKeyPrefix = "answer:config:id:"
|
||||
ConfigKEY2ContentCacheKeyPrefix = "answer:config:key:"
|
||||
ConfigCacheTime = 1 * time.Hour
|
||||
ConnectorUserExternalInfoCacheKey = "answer:connector:"
|
||||
ConnectorUserExternalInfoCacheTime = 10 * time.Minute
|
||||
ConnectorOAuthStateCacheKey = "answer:connector:oauth-state:"
|
||||
ConnectorOAuthStateCacheTime = 10 * time.Minute
|
||||
ConnectorOAuthBindStateCacheTime = 5 * time.Minute
|
||||
SiteMapQuestionCacheKeyPrefix = "answer:sitemap:question:%d"
|
||||
SiteMapQuestionCacheTime = time.Hour
|
||||
SitemapMaxSize = 50000
|
||||
NewQuestionNotificationLimitCacheKeyPrefix = "answer:new-question-notification-limit:"
|
||||
NewQuestionNotificationLimitCacheTime = 7 * 24 * time.Hour
|
||||
NewQuestionNotificationLimitMax = 50
|
||||
RateLimitCacheKeyPrefix = "answer:rate-limit:"
|
||||
RateLimitCacheTime = 5 * time.Minute
|
||||
RedDotCacheKey = "answer:red-dot:%s:%s"
|
||||
RedDotCacheTime = 30 * 24 * time.Hour
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
CommentEditDeadline = time.Minute * 5
|
||||
)
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
DefaultPageSize = 20 // Default number of pages
|
||||
DefaultBulkUser = 5000
|
||||
)
|
||||
|
||||
var (
|
||||
Version = ""
|
||||
Revision = ""
|
||||
GoVersion = ""
|
||||
)
|
||||
|
||||
var Timezones = []string{
|
||||
// Americas
|
||||
"America/New_York",
|
||||
"America/Chicago",
|
||||
"America/Los_Angeles",
|
||||
"America/Toronto",
|
||||
"America/Vancouver",
|
||||
"America/Mexico_City",
|
||||
"America/Sao_Paulo",
|
||||
"America/Buenos_Aires",
|
||||
|
||||
// Europe
|
||||
"Europe/London",
|
||||
"Europe/Paris",
|
||||
"Europe/Berlin",
|
||||
"Europe/Madrid",
|
||||
"Europe/Rome",
|
||||
"Europe/Moscow",
|
||||
|
||||
// Asia
|
||||
"Asia/Shanghai",
|
||||
"Asia/Tokyo",
|
||||
"Asia/Singapore",
|
||||
"Asia/Dubai",
|
||||
"Asia/Hong_Kong",
|
||||
"Asia/Seoul",
|
||||
"Asia/Bangkok",
|
||||
"Asia/Kolkata",
|
||||
|
||||
// Pacific
|
||||
"Australia/Sydney",
|
||||
"Australia/Melbourne",
|
||||
"Pacific/Auckland",
|
||||
|
||||
// Africa
|
||||
"Africa/Cairo",
|
||||
"Africa/Johannesburg",
|
||||
"Africa/Lagos",
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
AcceptLanguageFlag = "Accept-Language"
|
||||
ShortIDFlag = "Short-ID-Enabled"
|
||||
)
|
||||
|
||||
type ContextKey string
|
||||
|
||||
const (
|
||||
AcceptLanguageContextKey ContextKey = ContextKey(AcceptLanguageFlag)
|
||||
ShortIDContextKey ContextKey = ContextKey(ShortIDFlag)
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
EmailTplKeyChangeEmailTitle = "email_tpl.change_email.title"
|
||||
EmailTplKeyChangeEmailBody = "email_tpl.change_email.body"
|
||||
|
||||
EmailTplKeyNewAnswerTitle = "email_tpl.new_answer.title"
|
||||
EmailTplKeyNewAnswerBody = "email_tpl.new_answer.body"
|
||||
|
||||
EmailTplKeyNewCommentTitle = "email_tpl.new_comment.title"
|
||||
EmailTplKeyNewCommentBody = "email_tpl.new_comment.body"
|
||||
|
||||
EmailTplKeyPassResetTitle = "email_tpl.pass_reset.title"
|
||||
EmailTplKeyPassResetBody = "email_tpl.pass_reset.body"
|
||||
|
||||
EmailTplKeyRegisterTitle = "email_tpl.register.title"
|
||||
EmailTplKeyRegisterBody = "email_tpl.register.body"
|
||||
|
||||
EmailTplKeyTestTitle = "email_tpl.test.title"
|
||||
EmailTplKeyTestBody = "email_tpl.test.body"
|
||||
|
||||
EmailTplKeyInvitedAnswerTitle = "email_tpl.invited_you_to_answer.title"
|
||||
EmailTplKeyInvitedAnswerBody = "email_tpl.invited_you_to_answer.body"
|
||||
|
||||
EmailTplKeyNewQuestionTitle = "email_tpl.new_question.title"
|
||||
EmailTplKeyNewQuestionBody = "email_tpl.new_question.body"
|
||||
)
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
// EventType event type. It is used to define the type of event. Such as object.action
|
||||
type EventType string
|
||||
|
||||
// event object
|
||||
const (
|
||||
eventQuestion = "question"
|
||||
eventAnswer = "answer"
|
||||
eventComment = "comment"
|
||||
eventUser = "user"
|
||||
)
|
||||
|
||||
// event action
|
||||
const (
|
||||
eventCreate = "create"
|
||||
eventUpdate = "update"
|
||||
eventDelete = "delete"
|
||||
eventVote = "vote"
|
||||
eventAccept = "accept" // only question have the accept event
|
||||
eventShare = "share" // the object share link has been clicked
|
||||
eventFlag = "flag"
|
||||
eventReact = "react"
|
||||
)
|
||||
|
||||
const (
|
||||
EventUserUpdate EventType = eventUser + "." + eventUpdate
|
||||
EventUserShare EventType = eventUser + "." + eventShare
|
||||
)
|
||||
|
||||
const (
|
||||
EventQuestionCreate EventType = eventQuestion + "." + eventCreate
|
||||
EventQuestionUpdate EventType = eventQuestion + "." + eventUpdate
|
||||
EventQuestionDelete EventType = eventQuestion + "." + eventDelete
|
||||
EventQuestionVote EventType = eventQuestion + "." + eventVote
|
||||
EventQuestionAccept EventType = eventQuestion + "." + eventAccept
|
||||
EventQuestionFlag EventType = eventQuestion + "." + eventFlag
|
||||
EventQuestionReact EventType = eventQuestion + "." + eventReact
|
||||
)
|
||||
|
||||
const (
|
||||
EventAnswerCreate EventType = eventAnswer + "." + eventCreate
|
||||
EventAnswerUpdate EventType = eventAnswer + "." + eventUpdate
|
||||
EventAnswerDelete EventType = eventAnswer + "." + eventDelete
|
||||
EventAnswerVote EventType = eventAnswer + "." + eventVote
|
||||
EventAnswerFlag EventType = eventAnswer + "." + eventFlag
|
||||
EventAnswerReact EventType = eventAnswer + "." + eventReact
|
||||
)
|
||||
|
||||
const (
|
||||
EventCommentCreate EventType = eventComment + "." + eventCreate
|
||||
EventCommentUpdate EventType = eventComment + "." + eventUpdate
|
||||
EventCommentDelete EventType = eventComment + "." + eventDelete
|
||||
EventCommentVote EventType = eventComment + "." + eventVote
|
||||
EventCommentFlag EventType = eventComment + "." + eventFlag
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
ReactionTooltipLabel = "reaction.tooltip"
|
||||
)
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
// NotificationUpdateQuestion update question
|
||||
NotificationUpdateQuestion = "notification.action.update_question"
|
||||
// NotificationAnswerTheQuestion answer the question
|
||||
NotificationAnswerTheQuestion = "notification.action.answer_the_question"
|
||||
// NotificationUpVotedTheQuestion up voted the question
|
||||
NotificationUpVotedTheQuestion = "notification.action.up_voted_question"
|
||||
// NotificationDownVotedTheQuestion down voted the question
|
||||
NotificationDownVotedTheQuestion = "notification.action.down_voted_question"
|
||||
// NotificationUpdateAnswer update answer
|
||||
NotificationUpdateAnswer = "notification.action.update_answer"
|
||||
// NotificationAcceptAnswer accept answer
|
||||
NotificationAcceptAnswer = "notification.action.accept_answer"
|
||||
// NotificationUpVotedTheAnswer up voted the answer
|
||||
NotificationUpVotedTheAnswer = "notification.action.up_voted_answer"
|
||||
// NotificationDownVotedTheAnswer down voted the answer
|
||||
NotificationDownVotedTheAnswer = "notification.action.down_voted_answer"
|
||||
// NotificationCommentQuestion comment question
|
||||
NotificationCommentQuestion = "notification.action.comment_question"
|
||||
// NotificationCommentAnswer comment answer
|
||||
NotificationCommentAnswer = "notification.action.comment_answer"
|
||||
// NotificationUpVotedTheComment up voted the comment
|
||||
NotificationUpVotedTheComment = "notification.action.up_voted_comment"
|
||||
// NotificationReplyToYou reply to you
|
||||
NotificationReplyToYou = "notification.action.reply_to_you"
|
||||
// NotificationMentionYou mention you
|
||||
NotificationMentionYou = "notification.action.mention_you"
|
||||
// NotificationYourQuestionIsClosed your question is closed
|
||||
NotificationYourQuestionIsClosed = "notification.action.your_question_is_closed"
|
||||
// NotificationYourQuestionWasDeleted your question was deleted
|
||||
NotificationYourQuestionWasDeleted = "notification.action.your_question_was_deleted"
|
||||
// NotificationYourAnswerWasDeleted your answer was deleted
|
||||
NotificationYourAnswerWasDeleted = "notification.action.your_answer_was_deleted"
|
||||
// NotificationYourCommentWasDeleted your comment was deleted
|
||||
NotificationYourCommentWasDeleted = "notification.action.your_comment_was_deleted"
|
||||
// NotificationInvitedYouToAnswer invited you to answer
|
||||
NotificationInvitedYouToAnswer = "notification.action.invited_you_to_answer"
|
||||
// NotificationEarnedBadge earned badge
|
||||
NotificationEarnedBadge = "notification.action.earned_badge"
|
||||
)
|
||||
|
||||
type NotificationChannelKey string
|
||||
type NotificationSource string
|
||||
|
||||
const (
|
||||
InboxSource NotificationSource = "inbox"
|
||||
AllNewQuestionSource NotificationSource = "all_new_question"
|
||||
AllNewQuestionForFollowingTagsSource NotificationSource = "all_new_question_for_following_tags"
|
||||
)
|
||||
|
||||
const (
|
||||
EmailChannel NotificationChannelKey = "email"
|
||||
)
|
||||
|
||||
const (
|
||||
NotificationTypeInbox = "inbox"
|
||||
NotificationTypeAchievement = "achievement"
|
||||
NotificationTypeBadgeAchievement = "badge"
|
||||
)
|
||||
|
||||
var (
|
||||
NotificationMsgTypeMapping = map[string]int{
|
||||
NotificationUpdateQuestion: 1,
|
||||
NotificationAnswerTheQuestion: 1,
|
||||
NotificationUpVotedTheQuestion: 2,
|
||||
NotificationDownVotedTheQuestion: 2,
|
||||
NotificationUpdateAnswer: 1,
|
||||
NotificationAcceptAnswer: 1,
|
||||
NotificationUpVotedTheAnswer: 2,
|
||||
NotificationDownVotedTheAnswer: 2,
|
||||
NotificationCommentQuestion: 1,
|
||||
NotificationCommentAnswer: 1,
|
||||
NotificationUpVotedTheComment: 2,
|
||||
NotificationReplyToYou: 1,
|
||||
NotificationMentionYou: 1,
|
||||
NotificationYourQuestionIsClosed: 1,
|
||||
NotificationYourQuestionWasDeleted: 1,
|
||||
NotificationYourAnswerWasDeleted: 1,
|
||||
NotificationYourCommentWasDeleted: 1,
|
||||
NotificationInvitedYouToAnswer: 3,
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
QuestionObjectType = "question"
|
||||
AnswerObjectType = "answer"
|
||||
TagObjectType = "tag"
|
||||
UserObjectType = "user"
|
||||
CollectionObjectType = "collection"
|
||||
CommentObjectType = "comment"
|
||||
ReportObjectType = "report"
|
||||
BadgeObjectType = "badge"
|
||||
BadgeAwardObjectType = "badge_award"
|
||||
)
|
||||
|
||||
var (
|
||||
ObjectTypeStrMapping = map[string]int{
|
||||
QuestionObjectType: 1,
|
||||
AnswerObjectType: 2,
|
||||
TagObjectType: 3,
|
||||
UserObjectType: 4,
|
||||
CollectionObjectType: 6,
|
||||
CommentObjectType: 7,
|
||||
ReportObjectType: 8,
|
||||
BadgeObjectType: 9,
|
||||
BadgeAwardObjectType: 10,
|
||||
}
|
||||
|
||||
ObjectTypeNumberMapping = map[int]string{
|
||||
1: QuestionObjectType,
|
||||
2: AnswerObjectType,
|
||||
3: TagObjectType,
|
||||
4: UserObjectType,
|
||||
6: CollectionObjectType,
|
||||
7: CommentObjectType,
|
||||
8: ReportObjectType,
|
||||
9: BadgeObjectType,
|
||||
10: BadgeAwardObjectType,
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
PluginStatus = "plugin.status"
|
||||
)
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
import "github.com/apache/answer/internal/base/reason"
|
||||
|
||||
type Privilege struct {
|
||||
Key string `json:"key"`
|
||||
Label string `json:"label"`
|
||||
Value int `validate:"gte=1" json:"value"`
|
||||
}
|
||||
|
||||
const (
|
||||
RankQuestionAddKey = "rank.question.add"
|
||||
RankQuestionEditKey = "rank.question.edit"
|
||||
RankQuestionDeleteKey = "rank.question.delete"
|
||||
RankQuestionVoteUpKey = "rank.question.vote_up"
|
||||
RankQuestionVoteDownKey = "rank.question.vote_down"
|
||||
RankAnswerAddKey = "rank.answer.add"
|
||||
RankAnswerEditKey = "rank.answer.edit"
|
||||
RankAnswerDeleteKey = "rank.answer.delete"
|
||||
RankAnswerAcceptKey = "rank.answer.accept"
|
||||
RankAnswerVoteUpKey = "rank.answer.vote_up"
|
||||
RankAnswerVoteDownKey = "rank.answer.vote_down"
|
||||
RankInviteSomeoneToAnswerKey = "rank.answer.invite_someone_to_answer"
|
||||
RankCommentAddKey = "rank.comment.add"
|
||||
RankCommentEditKey = "rank.comment.edit"
|
||||
RankCommentDeleteKey = "rank.comment.delete"
|
||||
RankReportAddKey = "rank.report.add"
|
||||
RankTagAddKey = "rank.tag.add"
|
||||
RankTagEditKey = "rank.tag.edit"
|
||||
RankTagDeleteKey = "rank.tag.delete"
|
||||
RankTagSynonymKey = "rank.tag.synonym"
|
||||
RankLinkUrlLimitKey = "rank.link.url_limit"
|
||||
RankVoteDetailKey = "rank.vote.detail"
|
||||
RankCommentVoteUpKey = "rank.comment.vote_up"
|
||||
RankCommentVoteDownKey = "rank.comment.vote_down"
|
||||
RankQuestionEditWithoutReviewKey = "rank.question.edit_without_review"
|
||||
RankAnswerEditWithoutReviewKey = "rank.answer.edit_without_review"
|
||||
RankTagEditWithoutReviewKey = "rank.tag.edit_without_review"
|
||||
RankAnswerAuditKey = "rank.answer.audit"
|
||||
RankQuestionAuditKey = "rank.question.audit"
|
||||
RankTagAuditKey = "rank.tag.audit"
|
||||
RankQuestionCloseKey = "rank.question.close"
|
||||
RankQuestionReopenKey = "rank.question.reopen"
|
||||
RankTagUseReservedTagKey = "rank.tag.use_reserved_tag"
|
||||
)
|
||||
|
||||
var (
|
||||
RankAllPrivileges = []*Privilege{
|
||||
{Label: reason.RankQuestionAddLabel, Key: RankQuestionAddKey},
|
||||
{Label: reason.RankAnswerAddLabel, Key: RankAnswerAddKey},
|
||||
{Label: reason.RankCommentAddLabel, Key: RankCommentAddKey},
|
||||
{Label: reason.RankReportAddLabel, Key: RankReportAddKey},
|
||||
{Label: reason.RankCommentVoteUpLabel, Key: RankCommentVoteUpKey},
|
||||
{Label: reason.RankLinkUrlLimitLabel, Key: RankLinkUrlLimitKey},
|
||||
{Label: reason.RankQuestionVoteUpLabel, Key: RankQuestionVoteUpKey},
|
||||
{Label: reason.RankAnswerVoteUpLabel, Key: RankAnswerVoteUpKey},
|
||||
{Label: reason.RankQuestionVoteDownLabel, Key: RankQuestionVoteDownKey},
|
||||
{Label: reason.RankAnswerVoteDownLabel, Key: RankAnswerVoteDownKey},
|
||||
{Label: reason.RankInviteSomeoneToAnswerLabel, Key: RankInviteSomeoneToAnswerKey},
|
||||
{Label: reason.RankTagAddLabel, Key: RankTagAddKey},
|
||||
{Label: reason.RankTagEditLabel, Key: RankTagEditKey},
|
||||
{Label: reason.RankQuestionEditLabel, Key: RankQuestionEditKey},
|
||||
{Label: reason.RankAnswerEditLabel, Key: RankAnswerEditKey},
|
||||
{Label: reason.RankQuestionEditWithoutReviewLabel, Key: RankQuestionEditWithoutReviewKey},
|
||||
{Label: reason.RankAnswerEditWithoutReviewLabel, Key: RankAnswerEditWithoutReviewKey},
|
||||
{Label: reason.RankQuestionAuditLabel, Key: RankQuestionAuditKey},
|
||||
{Label: reason.RankAnswerAuditLabel, Key: RankAnswerAuditKey},
|
||||
{Label: reason.RankTagAuditLabel, Key: RankTagAuditKey},
|
||||
{Label: reason.RankTagEditWithoutReviewLabel, Key: RankTagEditWithoutReviewKey},
|
||||
{Label: reason.RankTagSynonymLabel, Key: RankTagSynonymKey},
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
DeletedQuestionTitleTrKey = "question.deleted_title"
|
||||
QuestionsTitleTrKey = "question.questions_title"
|
||||
TagsListTitleTrKey = "tag.tags_title"
|
||||
TagHasNoDescription = "tag.no_description"
|
||||
)
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
ReasonSpam = "reason.spam"
|
||||
ReasonRudeOrAbusive = "reason.rude_or_abusive"
|
||||
ReasonSomething = "reason.something"
|
||||
ReasonADuplicate = "reason.a_duplicate"
|
||||
ReasonNotAAnswer = "reason.not_a_answer"
|
||||
ReasonNoLongerNeeded = "reason.no_longer_needed"
|
||||
ReasonCommunitySpecific = "reason.community_specific"
|
||||
ReasonNotClarity = "reason.not_clarity"
|
||||
ReasonNormal = "reason.normal"
|
||||
ReasonNormalUser = "reason.normal.user"
|
||||
ReasonClosed = "reason.closed"
|
||||
ReasonDeleted = "reason.deleted"
|
||||
ReasonDeletedUser = "reason.deleted.user"
|
||||
ReasonSuspended = "reason.suspended"
|
||||
ReasonInactive = "reason.inactive"
|
||||
ReasonLooksOk = "reason.looks_ok"
|
||||
ReasonNeedsEdit = "reason.needs_edit"
|
||||
ReasonNeedsClose = "reason.needs_close"
|
||||
ReasonNeedsDelete = "reason.needs_delete"
|
||||
)
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
type ReviewingType string
|
||||
|
||||
const (
|
||||
QueuedPost ReviewingType = "queued_post"
|
||||
QueuedUser ReviewingType = "queued_user"
|
||||
FlaggedPost ReviewingType = "flagged_post"
|
||||
FlaggedUser ReviewingType = "flagged_user"
|
||||
SuggestedPostEdit ReviewingType = "suggested_post_edit"
|
||||
)
|
||||
|
||||
const (
|
||||
ReportOperationEditPost = "edit_post"
|
||||
ReportOperationClosePost = "close_post"
|
||||
ReportOperationDeletePost = "delete_post"
|
||||
ReportOperationUnlistPost = "unlist_post"
|
||||
ReportOperationIgnoreReport = "ignore_report"
|
||||
)
|
||||
|
||||
const (
|
||||
ReviewQueuedPostLabel = "review.queued_post"
|
||||
ReviewFlaggedPostLabel = "review.flagged_post"
|
||||
ReviewSuggestedPostEditLabel = "review.suggested_post_edit"
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
DefaultGravatarBaseURL = "https://www.gravatar.com/avatar/"
|
||||
DefaultAvatar = "system"
|
||||
AvatarTypeDefault = "default"
|
||||
AvatarTypeGravatar = "gravatar"
|
||||
AvatarTypeCustom = "custom"
|
||||
)
|
||||
|
||||
const (
|
||||
// PermalinkQuestionIDAndTitle /questions/10010000000000001/post-title
|
||||
PermalinkQuestionIDAndTitle = iota + 1
|
||||
// PermalinkQuestionID /questions/10010000000000001
|
||||
PermalinkQuestionID
|
||||
// PermalinkQuestionIDAndTitleByShortID /questions/11/post-title
|
||||
PermalinkQuestionIDAndTitleByShortID
|
||||
// PermalinkQuestionIDByShortID /questions/11
|
||||
PermalinkQuestionIDByShortID
|
||||
)
|
||||
|
||||
const (
|
||||
ColorSchemeDefault = "default"
|
||||
ColorSchemeLight = "light"
|
||||
ColorSchemeDark = "dark"
|
||||
ColorSchemeSystem = "system"
|
||||
|
||||
ThemeLayoutFullWidth = "Full-width"
|
||||
ThemeLayoutFixedWidth = "Fixed-width"
|
||||
)
|
||||
|
||||
const (
|
||||
EmailConfigKey = "email.config"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultMaxImageMegapixel = 40 * 1000 * 1000
|
||||
DefaultMaxImageSize = 4 * 1024 * 1024
|
||||
DefaultMaxAttachmentSize = 8 * 1024 * 1024
|
||||
)
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
// SiteTypeLegal\SiteTypeLegal\SiteTypeWrite The following items will no longer be used.
|
||||
SiteTypeLegal = "legal"
|
||||
SiteTypeInterface = "interface"
|
||||
SiteTypeWrite = "write"
|
||||
|
||||
SiteTypeGeneral = "general"
|
||||
SiteTypeBranding = "branding"
|
||||
SiteTypeSeo = "seo"
|
||||
SiteTypeLogin = "login"
|
||||
SiteTypeCustomCssHTML = "css-html"
|
||||
SiteTypeTheme = "theme"
|
||||
SiteTypePrivileges = "privileges"
|
||||
SiteTypeUsers = "users"
|
||||
|
||||
SiteTypeAdvanced = "advanced"
|
||||
SiteTypeQuestions = "questions"
|
||||
SiteTypeTags = "tags"
|
||||
|
||||
SiteTypeUsersSettings = "users_settings"
|
||||
SiteTypeInterfaceSettings = "interface_settings"
|
||||
|
||||
SiteTypePolicies = "policies"
|
||||
SiteTypeSecurity = "security"
|
||||
SiteTypeAI = "ai"
|
||||
SiteTypeFeatureToggle = "feature-toggle"
|
||||
SiteTypeMCP = "mcp"
|
||||
)
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
AvatarSubPath = "avatar"
|
||||
AvatarThumbSubPath = "avatar_thumb"
|
||||
PostSubPath = "post"
|
||||
BrandingSubPath = "branding"
|
||||
FilesPostSubPath = "files/post"
|
||||
DeletedSubPath = "deleted"
|
||||
)
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
UserNormal = "normal"
|
||||
UserSuspended = "suspended"
|
||||
UserDeleted = "deleted"
|
||||
UserInactive = "inactive"
|
||||
)
|
||||
const (
|
||||
EmailStatusAvailable = 1
|
||||
EmailStatusToBeVerified = 2
|
||||
)
|
||||
|
||||
const (
|
||||
DeletePermanentlyUsers = "users"
|
||||
DeletePermanentlyQuestions = "questions"
|
||||
DeletePermanentlyAnswers = "answers"
|
||||
)
|
||||
|
||||
func ConvertUserStatus(status, mailStatus int) string {
|
||||
switch status {
|
||||
case 1:
|
||||
if mailStatus == EmailStatusToBeVerified {
|
||||
return UserInactive
|
||||
}
|
||||
return UserNormal
|
||||
case 9:
|
||||
return UserSuspended
|
||||
case 10:
|
||||
return UserDeleted
|
||||
}
|
||||
return UserNormal
|
||||
}
|
||||
Reference in New Issue
Block a user