Last active
August 29, 2015 14:23
-
-
Save czbaker/1d40faab052872899734 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Mod Follows | |
| Follows = new Mongo.Collection("follows"); | |
| Follows.allow({ | |
| insert: function(userId, doc) { | |
| return userId; | |
| }, | |
| update: function(userId, doc) { | |
| return false; | |
| }, | |
| remove: function(userId, doc) { | |
| return (userId && doc.owner === userId); | |
| } | |
| }); | |
| Schemas.Follows = new SimpleSchema({ | |
| owner: { | |
| type: String, | |
| autoValue: function() { | |
| return this.userId; | |
| } | |
| }, | |
| entity: { | |
| type: Number, | |
| index: 1 | |
| }, | |
| uid: { | |
| type: String | |
| }, | |
| createdAt: { | |
| type: Date, | |
| defaultValue: new Date() | |
| } | |
| }); | |
| Follows.attachSchema(Schemas.Follows); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Follow count of current mod | |
| Meteor.publish('allFollowMod', function(mod) { | |
| return Follows.find({uid: mod}); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Display single mod | |
| Router.route('/mod/:id', function() { | |
| this.render('modSingle'); | |
| }, { | |
| name: 'modSingle', | |
| waitOn: function() { | |
| var user = Meteor.userId(); | |
| var mod = this.params.id; | |
| return [ | |
| Subs.subscribe('singleMod', mod), | |
| Subs.subscribe('modOwner', mod), | |
| Subs.subscribe('currentModUser', user, mod), | |
| Subs.subscribe('currentFollowMod', user, mod), | |
| Subs.subscribe('allFollowMod', mod), // This one is causing the lockup. | |
| Subs.subscribe('modScreens', mod), | |
| Subs.subscribe('screenFiles'), | |
| Subs.subscribe('modComments', mod), | |
| Subs.subscribe('usernameEmail') | |
| ]; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment