🐛 Bug fixes on notifications
This commit is contained in:
parent
fdf2d28f51
commit
573ccc0478
7
.idea/workspace.xml
generated
7
.idea/workspace.xml
generated
@ -4,9 +4,8 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix missing api endpoint">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":zap: A separate API to only get notification count">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/index.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/index.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/notifications_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/notifications_api.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -160,7 +159,6 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<MESSAGE value=":bug: Fix notification push batch emitted twice" />
|
||||
<MESSAGE value=":sparkles: Support jwks.json according OIDC stranded" />
|
||||
<MESSAGE value=":bug: Fix get user grpc method didn't extend group's permission" />
|
||||
<MESSAGE value=":bug: Fix unable get user full perm node" />
|
||||
@ -185,7 +183,8 @@
|
||||
<MESSAGE value=":bug: Fix random panic" />
|
||||
<MESSAGE value=":zap: Add cache into querying user" />
|
||||
<MESSAGE value=":bug: Fix missing api endpoint" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix missing api endpoint" />
|
||||
<MESSAGE value=":zap: A separate API to only get notification count" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":zap: A separate API to only get notification count" />
|
||||
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
|
@ -32,7 +32,7 @@ func getNotifications(c *fiber.Ctx) error {
|
||||
if err := tx.
|
||||
Limit(take).
|
||||
Offset(offset).
|
||||
Order("read_at DESC, created_at DESC").
|
||||
Order("created_at DESC").
|
||||
Find(¬ifications).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
@ -49,7 +49,7 @@ func getNotificationCount(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
tx := database.C.Where(&models.Notification{AccountID: user.ID}).Model(&models.Notification{})
|
||||
tx := database.C.Where("account_id = ? AND read_at IS NULL", user.ID).Model(&models.Notification{})
|
||||
|
||||
var count int64
|
||||
if err := tx.
|
||||
|
Loading…
Reference in New Issue
Block a user