aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/threadbuilder.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/threadbuilder.go b/lib/threadbuilder.go
index 8ffb7c1f..9137fc17 100644
--- a/lib/threadbuilder.go
+++ b/lib/threadbuilder.go
@@ -200,7 +200,19 @@ func (t *threadable) MessageThreadReferences() []string {
}
refs = []string{inreplyto}
}
- return refs
+ return cleanRefs(t.MessageThreadID(), refs)
+}
+
+func cleanRefs(m string, refs []string) []string {
+ considered := make(map[string]interface{})
+ cleanRefs := make([]string, 0, len(refs))
+ for _, r := range refs {
+ if _, seen := considered[r]; r != m && !seen {
+ considered[r] = nil
+ cleanRefs = append(cleanRefs, r)
+ }
+ }
+ return cleanRefs
}
func (t *threadable) Subject() string {