-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.js
48 lines (39 loc) · 1.93 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Meteor.startup(function(){
Deps.autorun(function(){
// All my data. Provide only to logged-in users.
if(!Meteor.loggingIn() && Meteor.userId()){
Meteor.subscribe('myData', function(){
Session.set('settings', Meteor.user().settings||{});
Session.set('profileComplete', Meteor.user().profile_complete||0);
});
Meteor.subscribe('myPictures');
Meteor.subscribe('myNotifications');
Meteor.subscribe('myFriendList');
myNewsFeedHandle = Meteor.subscribeWithPagination('myNewsfeed', Newsfeed.activitiesPerPage);
// My conversations
conversationsHandle = Meteor.subscribeWithPagination('myConversations', 3);
oneConversationHandle = Meteor.subscribeWithPagination('oneConversation', function(){
return Session.get('currentConversation') || null;
}, Messages.messagePerPage);
// Questions for the profile form.
Meteor.subscribe('questions');
}
});
// When visiting someone's profile
Deps.autorun(function () {
userProfileHandle = Meteor.subscribe("userProfile", Session.get("currentUserProfile"));
userPictureHandle = Meteor.subscribe("oneUserPictures", Session.get("currentUserProfile"));
userActivitiesHandle = Meteor.subscribeWithPagination("oneUserActivities", function(){
return Session.get("currentUserProfile") || null;
}, Activities.activitiesPerPage);
});
Deps.autorun(function(){
if(Session.get("searchQuery")){
searchHandle = Meteor.subscribe("searchResults", Session.get("searchQuery"), Meteor.users.searchResultsLimit, function(){
Session.set('searchQueryDone', Session.get('searchQuery'));
console.log('updating publication searchResults');
});
}
});
// Meteor.subscribe('adminShowEveryone');
});