From cfb01a77f9d520e608d837f7bc5a5e5ffbe07d4e Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Wed, 17 Jun 2020 14:01:26 -0400 Subject: [PATCH] Fix: use the localUser function in orgsForUser check the orgsForUser publication was broken b/c it was looking at Meteor.user().bitbucket|github --- imports/api/org/server/publications.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/imports/api/org/server/publications.js b/imports/api/org/server/publications.js index 60232c0e..28be06af 100644 --- a/imports/api/org/server/publications.js +++ b/imports/api/org/server/publications.js @@ -18,6 +18,7 @@ import _ from 'lodash'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { Orgs } from '../orgs.js'; +import { localUser } from '../../lib/login.js'; Meteor.publish('orgIdByName', function(orgName){ return Orgs.find({ name: orgName }, { _id: 1, name: 1, customSearchableAttrs: 1}); @@ -29,13 +30,13 @@ Meteor.publish('orgs', function(names){ }); Meteor.publish('orgsForUser', function(){ - if(Meteor.user() && (Meteor.user().bitbucket || Meteor.user().github)) { - const orgNames = _.map(Meteor.user().orgs || [], 'name'); - return Orgs.find({ name: { $in: orgNames } }, { name: 1, orgYaml: 1, customSearchableAttrs: 1 }); - } else { + if(localUser()) { // local users should be able to see see all orgs with type local return Orgs.find({ type: 'local' }, { name: 1, customSearchableAttrs: 1 }); - } + } else { + const orgNames = _.map(Meteor.user().orgs || [], 'name'); + return Orgs.find({ name: { $in: orgNames } }, { name: 1, customSearchableAttrs: 1 }); + } }); Meteor.publish('gheOrg', (orgName)=>{