@@ -2518,6 +2518,10 @@ type UserChannelHistory struct {
25182518 Channels ColAccessHistoryMap `json:"channels"`
25192519}
25202520
2521+ type UserChannelHistoryResp struct {
2522+ CompactedChannels ColAccessHistoryMap `json:"compacted_channels"`
2523+ }
2524+
25212525func (h * handler ) getUserChannelHistory () error {
25222526 h .assertAdminOnly ()
25232527 username := internalUserName (mux .Vars (h .rq )["name" ])
@@ -2531,10 +2535,15 @@ func (h *handler) getUserChannelHistory() error {
25312535 colAccess := user .GetCollectionsAccess ()
25322536
25332537 colAccessHistoryMap := make (map [string ]map [string ][]string )
2534- for scope , _ := range colAccess {
2535- colAccessHistoryMap [scope ] = make (map [string ][]string )
2536- for col , _ := range colAccess [scope ] {
2537- colAccessHistoryMap [scope ][col ] = slices .Collect (maps .Keys (colAccess [scope ][col ].ChannelHistory_ ))
2538+ if colAccess == nil {
2539+ colAccessHistoryMap [base .DefaultScope ] = make (map [string ][]string )
2540+ colAccessHistoryMap [base.DefaultScope ][base.DefaultCollection ] = slices .Collect (maps .Keys (user .ChannelHistory ()))
2541+ } else {
2542+ for scope , _ := range colAccess {
2543+ colAccessHistoryMap [scope ] = make (map [string ][]string )
2544+ for col , _ := range colAccess [scope ] {
2545+ colAccessHistoryMap [scope ][col ] = slices .Collect (maps .Keys (colAccess [scope ][col ].ChannelHistory_ ))
2546+ }
25382547 }
25392548 }
25402549
@@ -2573,8 +2582,8 @@ func (h *handler) compactUserChannelHistory() error {
25732582 }
25742583 }
25752584
2576- userCompactedChannelHistory := UserChannelHistory {
2577- Channels : colAccessHistoryMap ,
2585+ userCompactedChannelHistory := UserChannelHistoryResp {
2586+ CompactedChannels : colAccessHistoryMap ,
25782587 }
25792588
25802589 err = authenticator .Save (user )
0 commit comments