Fix bootstrap meeting unread counts
This commit is contained in:
+14
-4
@@ -2406,14 +2406,21 @@ func TestServeIMBootstrapIncludesHomeCapabilities(t *testing.T) {
|
||||
oldWorkbench := store.Workbench
|
||||
oldRelations := store.Relations
|
||||
oldThirdParty := store.ThirdPartyConfig
|
||||
readAt := time.Now().UTC()
|
||||
security := &testSecurityStore{
|
||||
realName: &types.RealNameVerification{Status: "verified"},
|
||||
unreadNotifications: 4,
|
||||
realName: &types.RealNameVerification{Status: "verified"},
|
||||
notifications: []types.SystemNotification{
|
||||
{EventID: "evt-meeting-created", EventType: "meeting.created"},
|
||||
{EventID: "evt-meeting-updated", EventType: "meeting.updated"},
|
||||
{EventID: "evt-friend-request", EventType: "friend.request.created"},
|
||||
{EventID: "evt-daily-report", EventType: "daily_report.reminded"},
|
||||
{EventID: "evt-meeting-read", EventType: "meeting.created", ReadAt: &readAt},
|
||||
},
|
||||
}
|
||||
relations := &testRelationsStore{pendingCount: 2}
|
||||
workbench := &testWorkbenchStore{version: 9, modules: []types.WorkbenchModule{
|
||||
{Code: "organization", Name: "组织架构", Route: "/organization", UnreadCount: 3, Enabled: true, Permission: "enabled"},
|
||||
{Code: "meetings", Name: "会议通知", Route: "/meetings", UnreadCount: 5, Enabled: false, Permission: "enabled"},
|
||||
{Code: "meetings", Name: "会议通知", Route: "/meetings", UnreadCount: 0, Enabled: true, Permission: "enabled"},
|
||||
{Code: "external", Name: "外链", Route: "https://example.com", UnreadCount: 9, Enabled: true, Permission: "enabled"},
|
||||
}}
|
||||
store.Security = security
|
||||
@@ -2473,11 +2480,14 @@ func TestServeIMBootstrapIncludesHomeCapabilities(t *testing.T) {
|
||||
if modules[0].(map[string]any)["unread_count"].(float64) != 3 {
|
||||
t.Fatalf("unexpected bootstrap module unread: %#v", modules[0])
|
||||
}
|
||||
if modules[1].(map[string]any)["unread_count"].(float64) != 2 {
|
||||
t.Fatalf("unexpected bootstrap meetings unread: %#v", modules[1])
|
||||
}
|
||||
badges := data["entry_badges"].(map[string]any)
|
||||
if badges["new_friends_pending_count"].(float64) != 2 ||
|
||||
badges["contacts_total_unread"].(float64) != 2 ||
|
||||
badges["system_unread_count"].(float64) != 4 ||
|
||||
badges["workbench_total_unread"].(float64) != 3 {
|
||||
badges["workbench_total_unread"].(float64) != 5 {
|
||||
t.Fatalf("unexpected bootstrap badges: %#v", badges)
|
||||
}
|
||||
entries := data["entries"].(map[string]any)
|
||||
|
||||
Reference in New Issue
Block a user