File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 8
8
"errors"
9
9
"fmt"
10
10
"log/slog"
11
- "slices"
12
11
"strings"
13
12
"time"
14
13
@@ -612,9 +611,18 @@ func (s *Storage) UnshareEntry(userID int64, entryID int64) (err error) {
612
611
return
613
612
}
614
613
615
- func removeDuplicates (l []string ) []string {
616
- slices .Sort (l )
617
- return slices .Compact (l )
614
+ // removeDuplicate removes duplicate entries from a slice while keeping order.
615
+ // Some feeds expect tags to be shown in order, so we preserve it rather than sort.
616
+ func removeDuplicates [T string | int ](sliceList []T ) []T {
617
+ allKeys := make (map [T ]bool )
618
+ list := []T {}
619
+ for _ , item := range sliceList {
620
+ if _ , value := allKeys [item ]; ! value {
621
+ allKeys [item ] = true
622
+ list = append (list , item )
623
+ }
624
+ }
625
+ return list
618
626
}
619
627
620
628
func removeEmpty (l []string ) []string {
You can’t perform that action at this time.
0 commit comments