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 88 "errors"
99 "fmt"
1010 "log/slog"
11- "slices"
1211 "strings"
1312 "time"
1413
@@ -612,9 +611,18 @@ func (s *Storage) UnshareEntry(userID int64, entryID int64) (err error) {
612611 return
613612}
614613
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
618626}
619627
620628func removeEmpty (l []string ) []string {
You can’t perform that action at this time.
0 commit comments