From 6e8450d07d894beca16fe0cf8d2ee47601acb01d Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Sun, 26 Sep 2021 11:32:13 +0200 Subject: [PATCH] add convenience func for removing entry from slice --- pub/util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pub/util.go b/pub/util.go index 942e937..9b5d723 100644 --- a/pub/util.go +++ b/pub/util.go @@ -399,6 +399,16 @@ func dedupeIRIs(recipients, ignored []*url.URL) (out []*url.URL) { return } +// removeOne removes any occurrences of entry from a slice of entries. +func removeOne(entries []*url.URL, entry *url.URL) (out []*url.URL) { + for _, e := range entries { + if e.String() != entry.String() { + out = append(out, e) + } + } + return out +} + // stripHiddenRecipients removes "bto" and "bcc" from the activity. // // Note that this requirement of the specification is under "Section 6: Client