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.

update inbox

aichy126fb86b861da8d
diff --git a/docs/docs.go b/docs/docs.go
index ad4e2c58..4a90dfff 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -3588,34 +3588,6 @@ const docTemplate = `{
}
}
},
- "/answer/api/v1/question/closemsglist": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "close question msg list",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Question"
- ],
- "summary": "close question msg list",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/handler.RespBody"
- }
- }
- }
- }
- },
"/answer/api/v1/question/info": {
"get": {
"security": [
@@ -4124,56 +4096,6 @@ const docTemplate = `{
}
}
},
- "/answer/api/v1/report/type/list": {
- "get": {
- "description": "get report type list",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Report"
- ],
- "summary": "get report type list",
- "parameters": [
- {
- "enum": [
- "question",
- "answer",
- "comment",
- "user"
- ],
- "type": "string",
- "description": "report source",
- "name": "source",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "allOf": [
- {
- "$ref": "#/definitions/handler.RespBody"
- },
- {
- "type": "object",
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.GetReportTypeResp"
- }
- }
- }
- }
- ]
- }
- }
- }
- }
- },
"/answer/api/v1/revisions": {
"get": {
"description": "get revision list",
@@ -7003,35 +6925,6 @@ const docTemplate = `{
}
}
},
- "schema.GetReportTypeResp": {
- "type": "object",
- "properties": {
- "content_type": {
- "description": "content type",
- "type": "string"
- },
- "description": {
- "description": "report description",
- "type": "string"
- },
- "have_content": {
- "description": "is have content",
- "type": "boolean"
- },
- "name": {
- "description": "report name",
- "type": "string"
- },
- "source": {
- "description": "report source",
- "type": "string"
- },
- "type": {
- "description": "report type",
- "type": "integer"
- }
- }
- },
"schema.GetRevisionResp": {
"type": "object",
"properties": {
@@ -8508,6 +8401,9 @@ const docTemplate = `{
"system",
"gravatar"
]
+ },
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
@@ -8541,6 +8437,9 @@ const docTemplate = `{
"system",
"gravatar"
]
+ },
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
diff --git a/docs/swagger.json b/docs/swagger.json
index 3312fc5e..dac3816e 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -3576,34 +3576,6 @@
}
}
},
- "/answer/api/v1/question/closemsglist": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "close question msg list",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Question"
- ],
- "summary": "close question msg list",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/handler.RespBody"
- }
- }
- }
- }
- },
"/answer/api/v1/question/info": {
"get": {
"security": [
@@ -4112,56 +4084,6 @@
}
}
},
- "/answer/api/v1/report/type/list": {
- "get": {
- "description": "get report type list",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Report"
- ],
- "summary": "get report type list",
- "parameters": [
- {
- "enum": [
- "question",
- "answer",
- "comment",
- "user"
- ],
- "type": "string",
- "description": "report source",
- "name": "source",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "allOf": [
- {
- "$ref": "#/definitions/handler.RespBody"
- },
- {
- "type": "object",
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.GetReportTypeResp"
- }
- }
- }
- }
- ]
- }
- }
- }
- }
- },
"/answer/api/v1/revisions": {
"get": {
"description": "get revision list",
@@ -6991,35 +6913,6 @@
}
}
},
- "schema.GetReportTypeResp": {
- "type": "object",
- "properties": {
- "content_type": {
- "description": "content type",
- "type": "string"
- },
- "description": {
- "description": "report description",
- "type": "string"
- },
- "have_content": {
- "description": "is have content",
- "type": "boolean"
- },
- "name": {
- "description": "report name",
- "type": "string"
- },
- "source": {
- "description": "report source",
- "type": "string"
- },
- "type": {
- "description": "report type",
- "type": "integer"
- }
- }
- },
"schema.GetRevisionResp": {
"type": "object",
"properties": {
@@ -8496,6 +8389,9 @@
"system",
"gravatar"
]
+ },
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
@@ -8529,6 +8425,9 @@
"system",
"gravatar"
]
+ },
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 8519dc50..7abf1b22 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -693,27 +693,6 @@ definitions:
description: url title
type: string
type: object
- schema.GetReportTypeResp:
- properties:
- content_type:
- description: content type
- type: string
- description:
- description: report description
- type: string
- have_content:
- description: is have content
- type: boolean
- name:
- description: report name
- type: string
- source:
- description: report source
- type: string
- type:
- description: report type
- type: integer
- type: object
schema.GetRevisionResp:
properties:
content:
@@ -1752,6 +1731,8 @@ definitions:
- system
- gravatar
type: string
+ gravatar_base_url:
+ type: string
required:
- default_avatar
type: object
@@ -1774,6 +1755,8 @@ definitions:
- system
- gravatar
type: string
+ gravatar_base_url:
+ type: string
required:
- default_avatar
type: object
@@ -4451,23 +4434,6 @@ paths:
summary: add question and answer
tags:
- Question
- /answer/api/v1/question/closemsglist:
- get:
- consumes:
- - application/json
- description: close question msg list
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/handler.RespBody'
- security:
- - ApiKeyAuth: []
- summary: close question msg list
- tags:
- - Question
/answer/api/v1/question/info:
get:
consumes:
@@ -4781,37 +4747,6 @@ paths:
summary: add report
tags:
- Report
- /answer/api/v1/report/type/list:
- get:
- description: get report type list
- parameters:
- - description: report source
- enum:
- - question
- - answer
- - comment
- - user
- in: query
- name: source
- required: true
- type: string
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- allOf:
- - $ref: '#/definitions/handler.RespBody'
- - properties:
- data:
- items:
- $ref: '#/definitions/schema.GetReportTypeResp'
- type: array
- type: object
- summary: get report type list
- tags:
- - Report
/answer/api/v1/revisions:
get:
description: get revision list
diff --git a/internal/schema/notification_schema.go b/internal/schema/notification_schema.go
index 8688af37..fd9569ca 100644
--- a/internal/schema/notification_schema.go
+++ b/internal/schema/notification_schema.go
@@ -1,12 +1,16 @@
package schema
const (
- NotificationTypeInbox = 1
- NotificationTypeAchievement = 2
- NotificationNotRead = 1
- NotificationRead = 2
- NotificationStatusNormal = 1
- NotificationStatusDelete = 10
+ NotificationTypeInbox = 1
+ NotificationTypeAchievement = 2
+ NotificationNotRead = 1
+ NotificationRead = 2
+ NotificationStatusNormal = 1
+ NotificationStatusDelete = 10
+ NotificationInboxTypeAll = 1
+ NotificationInboxTypePosts = 2
+ NotificationInboxTypeInvites = 3
+ NotificationInboxTypeVotes = 4
)
var NotificationType = map[string]int{
@@ -14,6 +18,13 @@ var NotificationType = map[string]int{
"achievement": NotificationTypeAchievement,
}
+var NotificationInboxType = map[string]int{
+ "all": NotificationInboxTypeAll,
+ "posts": NotificationInboxTypePosts,
+ "invites": NotificationInboxTypeInvites,
+ "votes": NotificationInboxTypeVotes,
+}
+
type NotificationContent struct {
ID string `json:"id"`
TriggerUserID string `json:"-"` //show userid
@@ -69,11 +80,13 @@ type RedDot struct {
}
type NotificationSearch struct {
- Page int `json:"page" form:"page"` //Query number of pages
- PageSize int `json:"page_size" form:"page_size"` //Search page size
- Type int `json:"-" form:"-"`
- TypeStr string `json:"type" form:"type"` // inbox achievement
- UserID string `json:"-"`
+ Page int `json:"page" form:"page"` //Query number of pages
+ PageSize int `json:"page_size" form:"page_size"` //Search page size
+ Type int `json:"-" form:"-"`
+ TypeStr string `json:"type" form:"type"` // inbox achievement
+ InboxTypeStr string `json:"inbox_type" form:"inbox_type"` // inbox achievement
+ InboxType int `json:"-" form:"-"` // inbox achievement
+ UserID string `json:"-"`
}
type NotificationClearRequest struct {
diff --git a/internal/service/notification/notification_service.go b/internal/service/notification/notification_service.go
index 3a8cce13..3f23be3e 100644
--- a/internal/service/notification/notification_service.go
+++ b/internal/service/notification/notification_service.go
@@ -123,7 +123,12 @@ func (ns *NotificationService) GetNotificationPage(ctx context.Context, searchCo
if !ok {
return pager.NewPageModel(0, resp), nil
}
+ searchInboxType, ok := schema.NotificationInboxType[searchCond.InboxTypeStr]
+ if !ok {
+ return pager.NewPageModel(0, resp), nil
+ }
searchCond.Type = searchType
+ searchCond.InboxType = searchInboxType
notifications, total, err := ns.notificationRepo.GetNotificationPage(ctx, searchCond)
if err != nil {
return nil, err