1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +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" "errors"
"fmt" "fmt"
"log/slog" "log/slog"
"slices"
"strings" "strings"
"time" "time"
@ -612,9 +611,18 @@ func (s *Storage) UnshareEntry(userID int64, entryID int64) (err error) {
return return
} }
func removeDuplicates(l []string) []string { // removeDuplicate removes duplicate entries from a slice while keeping order.
slices.Sort(l) // Some feeds expect tags to be shown in order, so we preserve it rather than sort.
return slices.Compact(l) 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 { func removeEmpty(l []string) []string {