From 833070e2a1001c9998fbe731518f2f5687678471 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 19 Jan 2022 16:20:16 +0200 Subject: [PATCH] FIX: Add a popupId to store state (#186) The dismissed state will be stored in local storage because popupId is present now. --- .../discourse/connectors/topic-navigation/no-answer.hbs | 2 +- .../connectors/topic-navigation/no-answer.js.es6 | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/connectors/topic-navigation/no-answer.hbs b/assets/javascripts/discourse/connectors/topic-navigation/no-answer.hbs index e9b2d12..d4ec7ff 100644 --- a/assets/javascripts/discourse/connectors/topic-navigation/no-answer.hbs +++ b/assets/javascripts/discourse/connectors/topic-navigation/no-answer.hbs @@ -1,5 +1,5 @@ {{#if show}} - {{#topic-navigation-popup}} + {{#topic-navigation-popup popupId="solved-notice" dismissDuration=oneWeek}}

{{i18n "solved.no_answer.title"}}

{{i18n "solved.no_answer.description"}}

{{/topic-navigation-popup}} diff --git a/assets/javascripts/discourse/connectors/topic-navigation/no-answer.js.es6 b/assets/javascripts/discourse/connectors/topic-navigation/no-answer.js.es6 index f14a353..4ab9714 100644 --- a/assets/javascripts/discourse/connectors/topic-navigation/no-answer.js.es6 +++ b/assets/javascripts/discourse/connectors/topic-navigation/no-answer.js.es6 @@ -1,11 +1,15 @@ import { later } from "@ember/runloop"; -// 7 days in milliseconds -const MAX_DURATION_WITH_NO_ANSWER = 7 * 24 * 60 * 60 * 1000; +const ONE_WEEK = 7 * 24 * 60 * 60 * 1000; // milliseconds +const MAX_DURATION_WITH_NO_ANSWER = ONE_WEEK; export default { setupComponent(args, component) { component.set("show", false); + component.setProperties({ + oneWeek: ONE_WEEK, + show: false, + }); later(() => { if (