1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00
This commit is contained in:
July 2025-06-24 05:52:52 -04:00 committed by GitHub
commit 9d5d8992b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"log/slog"
"slices"
"strings"
"time"
@ -630,9 +629,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 {