Im building an app which sends questions to users, at a specific time. Most of the times everything goes well, and the question appears at the right time on my screen.
But now I'm testing it with Firefox and on my Android device. I'm getting a push notification (on my phone) at the right time, but when I open the app, it still says I dont have any open questions. Same on firefox. When I refresh my internetbrowser, and when I restart the app on my phone, the questions have shown up.
I think this has something to do with the cache of the Meteor app? Does anyone know a proper solution to fix this issue? Or does this only happen when I run my app locally?
My publication looks like this:
Meteor.publish("questions", function () {
var currentUser = this.userId;
if (Roles.userIsInRole(currentUser, ['superadmin']) || Roles.userIsInRole(currentUser, ['admin'])){
return Questions.find({});
}
else if(!this.userId){
return null;
}
else{
var joinedProjects = Projects.find({
$or: [
{invited: { $in: [currentUser] }},
{accepted: { $in: [currentUser] }}
]
}).map(function (projects) { return projects._id; });
return Questions.find({ project: { $in: joinedProjects }});
}
});