2013-04-14 14:51:37 +09:00
|
|
|
// Session variables
|
2012-12-11 10:47:11 +09:00
|
|
|
Session.set('initialLoad', true);
|
2013-10-12 12:24:41 +09:00
|
|
|
Session.set('today', new Date());
|
2013-10-12 13:01:16 +09:00
|
|
|
Session.set('view', 'top');
|
2013-10-24 20:46:14 +09:00
|
|
|
Session.set('postsLimit', getSetting('postsPerPage', 2));
|
2013-10-25 10:04:34 +09:00
|
|
|
Session.set('settingsLoaded', false);
|
2012-12-11 10:47:11 +09:00
|
|
|
|
2013-10-09 22:16:47 +09:00
|
|
|
// Subscriptions
|
|
|
|
|
|
|
|
// note: here we only subscribe to subscriptions that we need to be available all the time.
|
|
|
|
// For subscriptions depending on specific pages, see the router.
|
|
|
|
|
2013-10-14 12:14:12 +09:00
|
|
|
// TODO: add session variable that tracks when all global subscriptions have loaded
|
2013-10-09 22:16:47 +09:00
|
|
|
|
2013-04-14 14:51:37 +09:00
|
|
|
// Settings
|
2012-10-10 07:28:44 +09:00
|
|
|
Meteor.subscribe('settings', function(){
|
2013-10-09 22:16:47 +09:00
|
|
|
// runs once after settings have loaded
|
2012-11-21 14:31:58 +09:00
|
|
|
Session.set('settingsLoaded',true);
|
2013-10-30 08:27:44 +09:00
|
|
|
analyticsInit();
|
2012-10-10 07:28:44 +09:00
|
|
|
});
|
|
|
|
|
2013-04-14 14:51:37 +09:00
|
|
|
// Categories
|
2013-02-18 13:38:15 +09:00
|
|
|
Meteor.subscribe('categories');
|
|
|
|
|
2013-10-09 22:16:47 +09:00
|
|
|
// Current User
|
2013-10-21 18:56:22 +08:00
|
|
|
// We need to subscribe to the currentUser subscription because by itself,
|
|
|
|
// Meteor doesn't send all the user properties that we need
|
2012-11-17 13:24:19 +09:00
|
|
|
Meteor.subscribe('currentUser');
|
|
|
|
|
2013-04-14 14:51:37 +09:00
|
|
|
// Notifications - only load if user is logged in
|
2013-10-21 18:56:22 +08:00
|
|
|
if(Meteor.user() != null)
|
2012-10-10 07:57:34 +09:00
|
|
|
Meteor.subscribe('notifications');
|
2013-10-15 12:09:19 +09:00
|
|
|
|
2013-10-24 21:07:55 +09:00
|
|
|
STATUS_PENDING=1;
|
|
|
|
STATUS_APPROVED=2;
|
2013-10-30 08:27:44 +09:00
|
|
|
STATUS_REJECTED=3;
|
|
|
|
|