-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from CodersTV/change-publish-composite
Replace publish composite with publish relations and fix publication fields
- Loading branch information
Showing
7 changed files
with
118 additions
and
132 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ cmather:[email protected] | |
coderstv:[email protected] | ||
coderstv:[email protected] | ||
[email protected] | ||
cottz:[email protected] | ||
dburles:[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -80,7 +81,6 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
reywood:[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
Meteor.publish('Followers', function () { | ||
return Followers.find({followerId: this.userId}); | ||
return this.userId && Followers.find({followerId: this.userId}) || this.ready(); | ||
}); | ||
|
||
Meteor.publish('CoderFollowers', function (coderId) { | ||
if (! coderId) { | ||
return this.ready(); | ||
} | ||
|
||
var user = Meteor.users.findOneFromCoderId(coderId); | ||
|
||
return Followers.find({coderId: user._id}); | ||
return user && Followers.find({coderId: user._id}) || this.ready(); | ||
}); | ||
|
||
Meteor.publishComposite('SelfFollowersWithProfiles', function () { | ||
return { | ||
find: function () { | ||
return Followers.find({followerId: this.userId}); | ||
}, | ||
children: [{ | ||
find: function (follower) { | ||
return Meteor.users.find({_id: follower.coderId}, { | ||
Meteor.publishRelations('SelfFollowersWithProfiles', function () { | ||
if (this.userId) { | ||
this.cursor(Followers.find({followerId: this.userId}), function (_id, follower) { | ||
this.cursor(Meteor.users.find({_id: follower.coderId}, { | ||
fields: { | ||
profile: 1 | ||
}); | ||
} | ||
}] | ||
}; | ||
} | ||
})); | ||
}); | ||
} | ||
|
||
return this.ready(); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,22 @@ | ||
Meteor.publishComposite('userPresenceWithProfile', function (coderUsername, coderId) { | ||
return { | ||
find: function () { | ||
var filter, presences; | ||
Meteor.publishRelations('userPresenceWithProfile', function (coderUsername, coderId) { | ||
var filter, presences; | ||
|
||
if (_.isEmpty(coderUsername) && _.isEmpty(coderId)) { | ||
this.ready(); | ||
return; | ||
} | ||
if (_.isEmpty(coderUsername) && _.isEmpty(coderId)) { | ||
return this.ready(); | ||
} | ||
|
||
if (coderUsername) { | ||
check(coderUsername, String); | ||
} else { | ||
check(coderId, String); | ||
} | ||
check(coderUsername || coderId, String); | ||
filter = {$or: [ | ||
{'state.whereAt': '/coder/' + coderUsername}, | ||
{'state.whereAt': '/coder/' + coderId} | ||
]}; | ||
|
||
filter = {$or: [ | ||
{'state.whereAt': '/coder/' + coderUsername}, | ||
{'state.whereAt': '/coder/' + coderId} | ||
]}; | ||
return Presences.find(filter, {fields: {state: true, userId: true}}); | ||
}, | ||
children: [{ | ||
find: function (presence) { | ||
if (presence.userId) { | ||
return Meteor.users.find({_id: presence.userId}); | ||
} | ||
this.cursor(Presences.find(filter, {fields: {state: true, userId: true}}), function (_id, presence) { | ||
if (presence.userId) { | ||
this.cursor(Meteor.users.find({_id: presence.userId})); | ||
} | ||
}); | ||
|
||
this.ready(); | ||
return; | ||
} | ||
}] | ||
}; | ||
return this.ready(); | ||
}); | ||
|
This file contains 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
This file contains 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