1
0
mirror of https://github.com/beestat/app.git synced 2025-05-31 12:16:39 -04:00

Fixed #295 - If there are no announcements, clicking the announcements button breaks

This commit is contained in:
Jon Ziebell 2021-01-27 21:01:10 -05:00
parent 8087410436
commit 2155015bb6

View File

@ -13,6 +13,10 @@ beestat.extend(beestat.component.modal.announcements, beestat.component.modal);
*/
beestat.component.modal.announcements.prototype.decorate_contents_ = function(parent) {
var announcements = $.values(beestat.cache.announcement).reverse();
if (announcements.length === 0) {
parent.appendChild($.createElement('p').innerText('No recent announcements! :)'));
} else {
announcements.forEach(function(announcement) {
parent.appendChild($.createElement('div').style({
'border-bottom': '1px solid #eee',
@ -38,6 +42,7 @@ beestat.component.modal.announcements.prototype.decorate_contents_ = function(pa
'last_read_announcement_id',
announcements[0].announcement_id
);
}
};
/**