Skip to content

Node.js based forum software built for the modern web

interim commit

Julian Lamf6be3eacfc4d
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index 100d2d71df..f5e8f60c22 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -24,9 +24,6 @@
"forum": '../forum'
}
});
- requirejs.onError = function(err) {
- console.log(err);
- }
</script>
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />
diff --git a/src/notifications.js b/src/notifications.js
index d6b2791028..e327e4c59f 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -30,6 +30,7 @@ var RDB = require('./redis.js'),
* the new one put in its place.
*/
RDB.incr('notifications:next_nid', function(err, nid) {
+ RDB.sadd('notifications', nid);
RDB.hmset('notifications:' + nid, {
text: text || '',
path: path || null,
@@ -124,6 +125,14 @@ var RDB = require('./redis.js'),
});
} else callback();
});
+ },
+ prune: function(cutoff, callback) {
+ var today = new Date();
+ if (!cutoff || !(cutoff instanceof Date)) cutoff = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
+
+ RDB.smembers('notifications', function(err, nids) {
+
+ });
}
}
diff --git a/src/upgrade.js b/src/upgrade.js
index 9a6faed535..3c86eea4f6 100644
--- a/src/upgrade.js
+++ b/src/upgrade.js
@@ -59,6 +59,27 @@ Upgrade.upgrade = function() {
next();
}
});
+ },
+ function(next) {
+ RDB.exists('notifications', function(err, exists) {
+ if (!exists) {
+ RDB.keys('notifications:*', function(err, keys) {
+ var multi = RDB.multi();
+
+ keys = keys.filter(function(key) {
+ if (key === 'notifications:next_nid') return false;
+ else return true;
+ }).map(function(key) {
+ return key.slice(14);
+ });
+
+ winston.info('[2013/10/23] Adding existing notifications to set');
+ RDB.sadd('notifications', keys, next);
+ });
+ } else {
+ winston.info('[2013/10/23] Updates to Notifications skipped.');
+ }
+ });
}
// Add new schema updates here
], function(err) {