X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fnotify%2FListNotification.kt;h=60d7093ccd27d25df6ff4e3b656f536317e82bd0;hp=dccc43082c412e2f0d47cdc3d8c7ec69faaf0392;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=57beeb2a70c1c0f60c6a22d73e68815982e20d6d diff --git a/src/main/kotlin/net/pterodactylus/sone/notify/ListNotification.kt b/src/main/kotlin/net/pterodactylus/sone/notify/ListNotification.kt index dccc430..60d7093 100644 --- a/src/main/kotlin/net/pterodactylus/sone/notify/ListNotification.kt +++ b/src/main/kotlin/net/pterodactylus/sone/notify/ListNotification.kt @@ -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 : 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) : 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) { realElements.clear() - realElements.addAll(elements) + realElements.addAll(elements.distinct()) touch() }