Skip to content

Commit

Permalink
Publish and subscribe to feelings collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jkyuusai committed Sep 1, 2014
1 parent a52e383 commit 36fef57
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions collections/feelings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Feelings = new Meteor.Collection('feelings');

Feelings.allow({
update: ownsDocument,
remove: ownsDocument
Expand Down
8 changes: 7 additions & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
waitOn: function() { return [Meteor.subscribe('contacts'), Meteor.subscribe('groups') ]; }
waitOn: function() {
if(!Meteor.user()) {
return;
} else {
return Meteor.subscribe('feelings', Meteor.user()._id); }
}

});

Router.map(function() {
Expand Down
4 changes: 4 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://' + smtpKey + '@smtp.mailgun.org:587';
});

Meteor.publish('feelings', function(userId) {
return Feelings.find( {userId:userId} );
})

//TODO: Change this to a collection
var carrierList = {
'AT&T': 'mms.att.net',
Expand Down

0 comments on commit 36fef57

Please sign in to comment.