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-11-16 17:44:33 +09:00
|
|
|
Session.set('postsLimit', getSetting('postsPerPage', 10));
|
2013-11-06 10:11:35 +09:00
|
|
|
Session.set('sessionId', Meteor.default_connection._lastSessionId);
|
2012-12-11 10:47:11 +09:00
|
|
|
|
2014-02-18 14:46:53 +09:00
|
|
|
STATUS_PENDING=1;
|
|
|
|
STATUS_APPROVED=2;
|
|
|
|
STATUS_REJECTED=3;
|
2013-02-18 13:38:15 +09:00
|
|
|
|
2012-11-17 13:24:19 +09:00
|
|
|
|
2013-11-05 12:44:13 +09:00
|
|
|
|
2013-04-14 14:51:37 +09:00
|
|
|
// Notifications - only load if user is logged in
|
2014-01-06 02:44:18 +02:00
|
|
|
// Not mandatory, because server won't publish anything even if we try to load.
|
|
|
|
// Remember about Deps.autorun - user can log in and log out several times
|
|
|
|
Deps.autorun(function() {
|
|
|
|
// userId() can be changed before user(), because loading profile takes time
|
|
|
|
if(Meteor.userId()) {
|
|
|
|
Meteor.subscribe('notifications');
|
2014-02-18 14:46:53 +09:00
|
|
|
if(isAdmin(Meteor.user())){
|
|
|
|
// Subscribe to all users for now to make user selection autocomplete work
|
|
|
|
Meteor.subscribe('allUsersAdmin');
|
|
|
|
}
|
2014-01-06 02:44:18 +02:00
|
|
|
}
|
2014-02-18 14:46:53 +09:00
|
|
|
});
|