@@ -249,23 +249,22 @@ func stateFilter(query url.Values) (change.StateFilter, error) { default: return "", fmt.Errorf("unsupported state filter value: %q", selectedTabName) } } func (s state) augmentUnread(ctx context.Context, es []component.ChangeEntry, is change.Service, notificationsService notifications.Service) []component.ChangeEntry { func (s state) augmentUnread(ctx context.Context, es []component.ChangeEntry, service change.Service, notificationsService notifications.Service) []component.ChangeEntry { if notificationsService == nil { return es } tt, ok := is.(interface { ThreadType() string tt, ok := service.(interface { ThreadType(repo string) string }) if !ok { log.Println("augmentUnread: changes service doesn't implement ThreadType") log.Println("augmentUnread: change service doesn't implement ThreadType") return es } threadType := tt.ThreadType() if s.CurrentUser.ID == 0 { // Unauthenticated user cannot have any unread changes. return es } @@ -279,11 +278,13 @@ func (s state) augmentUnread(ctx context.Context, es []component.ChangeEntry, is return es } unreadThreads := make(map[uint64]struct{}) // Set of unread thread IDs. for _, n := range ns { if n.ThreadType != threadType { // Assumes RepoSpec matches because we filtered via notifications.ListOptions. // n.RepoSpec == s.RepoSpec is guaranteed because we filtered in notifications.ListOptions, // so we only need to check that n.ThreadType matches. if n.ThreadType != tt.ThreadType(s.RepoSpec) { continue } unreadThreads[n.ThreadID] = struct{}{} }