From c586d9170a33965ab0430329e06402d2a71e4a8d Mon Sep 17 00:00:00 2001 From: ClemDee Date: Tue, 2 Jul 2019 10:58:54 +0200 Subject: [PATCH] Add time for archived notifications --- www/notifications/app-notifications.less | 10 ++++++++++ www/notifications/inner.js | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/www/notifications/app-notifications.less b/www/notifications/app-notifications.less index 372816df7..a3dcdbd38 100644 --- a/www/notifications/app-notifications.less +++ b/www/notifications/app-notifications.less @@ -98,8 +98,18 @@ .cp-notification-content { flex-grow: 1; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; p { + display: inline-block; + margin: 1rem 1rem; + } + .notification-time { margin: 1rem 1rem; + color: grey; + margin-left: auto; } } diff --git a/www/notifications/inner.js b/www/notifications/inner.js index ce6b1a9a4..6ccb6934f 100644 --- a/www/notifications/inner.js +++ b/www/notifications/inner.js @@ -75,26 +75,29 @@ define([ ]); // add notification - function addNotification (data, el) { + var addNotification = function (data, el) { // if the type of notification correspond if (filterTypes.length === 0 || filterTypes.indexOf(data.content.msg.type) !== -1) { notifsData.push(data); $(notifsList).prepend(el); } - } - function addArchivedNotification (data) { + }; + var addArchivedNotification = function (data) { var isDataUnread = unreadData.findIndex(function (ud) { return ud.content.hash === data.content.hash; }) === -1; if (data.content.archived && isDataUnread) { notifsData.push(data); var el = common.mailbox.createElement(data); + var time = new Date(data.content.time); + $(el).find(".cp-notification-content").append(h("span.notification-time", time.toLocaleDateString() + " - " + time.toLocaleTimeString())); $(el).addClass("cp-app-notification-archived"); $(notifsList).prepend(el); } - } + }; $div.append(notifsPanel); + if (key === "archived") { var loadmore; var lastKnownHash;