<commit_before>Meteor.publish("allHomes", function() {
  // All homes publication
  return Homes.find();
});

Meteor.publish("singleHome", function(homeId) {
  // Publish a single home
  return Homes.find(homeId);
});

Meteor.publish("homesBelongingToGroup", function(groupId) {
  // Publish homes belonging to group
  return Homes.find({ groupId });
});<commit_msg>Add current user visible homes<commit_after>Meteor.publish("allHomes", function() {
  // All homes publication
  return Homes.find();
});

Meteor.publish("singleHome", function(homeId) {
  // Publish a single home
  return Homes.find(homeId);
});

Meteor.publish("homesBelongingToGroup", function(groupId) {
  // Publish homes belonging to group
  return Homes.find({ groupId });
});

Meteor.publish("currentUserVisibleHomes", function() {
  const userId = Meteor.userId();

  // Group IDs can be obtained through Permissions
  const userGroups = Meteor.call("getSingleUserGroupIds", userId);

  return Homes.find({
    groupId: { $in: userGroups }
  });
});
{'fraction_non_alphanumeric': 0.1455078125, 'fraction_numerical': 0.0, 'mean_word_length': 4.790960451977401, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5427350', 'n_tokens_mistral': 326, 'n_tokens_neox': 310, 'n_words': 75}