1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

revert: use previous removeDuplicates to keep entry tag order

Refs: 863a5b3
This commit is contained in:
Phantop 2025-02-20 17:03:14 -05:00
parent 4a77e937af
commit 61ce39508d

View file

@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"log/slog"
"slices"
"strings"
"time"
@ -612,9 +611,18 @@ func (s *Storage) UnshareEntry(userID int64, entryID int64) (err error) {
return
}
func removeDuplicates(l []string) []string {
slices.Sort(l)
return slices.Compact(l)
// removeDuplicate removes duplicate entries from a slice while keeping order.
// Some feeds expect tags to be shown in order, so we preserve it rather than sort.
func removeDuplicates[T string | int](sliceList []T) []T {
allKeys := make(map[T]bool)
list := []T{}
for _, item := range sliceList {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}
func removeEmpty(l []string) []string {