📄 Update year in file headers
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / notify / ListNotification.kt
index dccc430..60d7093 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - ListNotification.java - Copyright Â© 2010–2019 David Roden
+ * Sone - ListNotification.kt - Copyright Â© 2010–2020 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -41,18 +41,18 @@ class ListNotification<T> : TemplateNotification {
        @JvmOverloads
        constructor(id: String, key: String, template: Template, dismissable: Boolean = true) : super(id, currentTimeMillis(), currentTimeMillis(), dismissable, template) {
                this.key = key
-               template.initialContext.set(key, elements)
+               template.initialContext.set(key, realElements)
        }
 
        constructor(listNotification: ListNotification<T>) : super(listNotification.id, listNotification.createdTime, listNotification.lastUpdatedTime, listNotification.isDismissable, Template()) {
                this.key = listNotification.key
                template.add(listNotification.template)
-               template.initialContext.set(key, elements)
+               template.initialContext.set(key, realElements)
        }
 
        fun setElements(elements: Collection<T>) {
                realElements.clear()
-               realElements.addAll(elements)
+               realElements.addAll(elements.distinct())
                touch()
        }