Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Show changelog notification

Uku Tahta5ac5ddd16d8
diff --git a/assets/js/app.js b/assets/js/app.js
index 4232f5968c..92d535cce3 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -70,27 +70,23 @@ function showChangelogNotification(el) {
const lastUpdated = Number(localStorage.lastChangelogUpdate)
const lastChecked = Number(localStorage.lastChangelogClick)
- if (lastChecked) {
- const hasNewUpdateSinceLastClicked = lastUpdated > lastChecked
- const notOlderThanThreeDays = Date.now() - lastUpdated < 1000 * 60 * 60 * 72
- if (hasNewUpdateSinceLastClicked && notOlderThanThreeDays) {
- el.innerHTML = `
- <a href="https://plausible.io/changelog" target="_blank">
- <svg class="w-5 h-5 text-gray-600 " fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"></path>
- </svg>
- <svg class="w-4 h-4 text-pink-500 absolute" style="left: 14px; top: 2px;" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <circle cx="8" cy="8" r="4" fill="currentColor" />
- </svg>
- </a>
- `
- const link = el.getElementsByTagName('a')[0]
- link.addEventListener('click', function() {
- localStorage.lastChangelogClick = Date.now()
- setTimeout(() => { link.remove() }, 100)
- })
- }
- } else {
- localStorage.lastChangelogClick = Date.now()
+ const hasNewUpdateSinceLastClicked = lastUpdated > lastChecked
+ const notOlderThanThreeDays = Date.now() - lastUpdated < 1000 * 60 * 60 * 72
+ if ((!lastChecked || hasNewUpdateSinceLastClicked) && notOlderThanThreeDays) {
+ el.innerHTML = `
+ <a href="https://plausible.io/changelog" target="_blank">
+ <svg class="w-5 h-5 text-gray-600 " fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"></path>
+ </svg>
+ <svg class="w-4 h-4 text-pink-500 absolute" style="left: 14px; top: 2px;" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="8" cy="8" r="4" fill="currentColor" />
+ </svg>
+ </a>
+ `
+ const link = el.getElementsByTagName('a')[0]
+ link.addEventListener('click', function() {
+ localStorage.lastChangelogClick = Date.now()
+ setTimeout(() => { link.remove() }, 100)
+ })
}
}
diff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eex
index 1a1f944f97..621f783916 100644
--- a/lib/plausible_web/templates/layout/app.html.eex
+++ b/lib/plausible_web/templates/layout/app.html.eex
@@ -58,7 +58,7 @@
</div>
</div>
</li>
- <%= if @conn.assigns[:current_user].email in ["[email protected]", "[email protected]"] do %>
+ <%= if @conn.assigns[:current_user] do %>
<li id="changelog-notification" class="relative py-2"></li>
<% end %>
</ul>