Add time for archived notifications
This commit is contained in:
parent
4ce3678826
commit
c586d9170a
@ -98,9 +98,19 @@
|
|||||||
|
|
||||||
.cp-notification-content {
|
.cp-notification-content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
p {
|
p {
|
||||||
|
display: inline-block;
|
||||||
margin: 1rem 1rem;
|
margin: 1rem 1rem;
|
||||||
}
|
}
|
||||||
|
.notification-time {
|
||||||
|
margin: 1rem 1rem;
|
||||||
|
color: grey;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cp-notification-dismiss {
|
.cp-notification-dismiss {
|
||||||
|
|||||||
@ -75,26 +75,29 @@ define([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// add notification
|
// add notification
|
||||||
function addNotification (data, el) {
|
var addNotification = function (data, el) {
|
||||||
// if the type of notification correspond
|
// if the type of notification correspond
|
||||||
if (filterTypes.length === 0 || filterTypes.indexOf(data.content.msg.type) !== -1) {
|
if (filterTypes.length === 0 || filterTypes.indexOf(data.content.msg.type) !== -1) {
|
||||||
notifsData.push(data);
|
notifsData.push(data);
|
||||||
$(notifsList).prepend(el);
|
$(notifsList).prepend(el);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
function addArchivedNotification (data) {
|
var addArchivedNotification = function (data) {
|
||||||
var isDataUnread = unreadData.findIndex(function (ud) {
|
var isDataUnread = unreadData.findIndex(function (ud) {
|
||||||
return ud.content.hash === data.content.hash;
|
return ud.content.hash === data.content.hash;
|
||||||
}) === -1;
|
}) === -1;
|
||||||
if (data.content.archived && isDataUnread) {
|
if (data.content.archived && isDataUnread) {
|
||||||
notifsData.push(data);
|
notifsData.push(data);
|
||||||
var el = common.mailbox.createElement(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");
|
$(el).addClass("cp-app-notification-archived");
|
||||||
$(notifsList).prepend(el);
|
$(notifsList).prepend(el);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$div.append(notifsPanel);
|
$div.append(notifsPanel);
|
||||||
|
|
||||||
if (key === "archived") {
|
if (key === "archived") {
|
||||||
var loadmore;
|
var loadmore;
|
||||||
var lastKnownHash;
|
var lastKnownHash;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user