mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #223 - New Content Localhost Popups Repeat 'Old' 'New Content' on Media Changes
This commit is contained in:
parent
a7c270d755
commit
6e51215e48
1 changed files with 17 additions and 6 deletions
|
@ -983,10 +983,20 @@ var Dashboard = {
|
||||||
clearTimeout(Dashboard.newItemTimeout);
|
clearTimeout(Dashboard.newItemTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.newItemTimeout = setTimeout(Dashboard.onNewItemTimerStopped, 60000);
|
Dashboard.newItemTimeout = setTimeout(function() {
|
||||||
|
|
||||||
|
Dashboard.onNewItemTimerStopped(data);
|
||||||
|
|
||||||
|
}, 60000);
|
||||||
},
|
},
|
||||||
|
|
||||||
onNewItemTimerStopped: function () {
|
onNewItemTimerStopped: function (data) {
|
||||||
|
|
||||||
|
var newItems = data.ItemsAdded;
|
||||||
|
|
||||||
|
if (!newItems.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
||||||
|
|
||||||
|
@ -995,7 +1005,8 @@ var Dashboard = {
|
||||||
Filters: "IsNotFolder",
|
Filters: "IsNotFolder",
|
||||||
SortBy: "DateCreated",
|
SortBy: "DateCreated",
|
||||||
SortOrder: "Descending",
|
SortOrder: "Descending",
|
||||||
ImageTypes: "Primary"
|
ImageTypes: "Primary",
|
||||||
|
Ids: newItems.join(',')
|
||||||
|
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
|
|
||||||
|
@ -1005,7 +1016,7 @@ var Dashboard = {
|
||||||
|
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
|
|
||||||
var data = {
|
var notification = {
|
||||||
title: "New " + item.Type,
|
title: "New " + item.Type,
|
||||||
body: item.Name,
|
body: item.Name,
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
@ -1015,14 +1026,14 @@ var Dashboard = {
|
||||||
|
|
||||||
if (imageTags.Primary) {
|
if (imageTags.Primary) {
|
||||||
|
|
||||||
data.icon = ApiClient.getImageUrl(item.Id, {
|
notification.icon = ApiClient.getImageUrl(item.Id, {
|
||||||
width: 100,
|
width: 100,
|
||||||
tag: imageTags.Primary,
|
tag: imageTags.Primary,
|
||||||
type: "Primary"
|
type: "Primary"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
WebNotifications.show(data);
|
WebNotifications.show(notification);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue