Skip to content

Commit

Permalink
Fix broken use of Settings.
Browse files Browse the repository at this point in the history
This should fix sandstorm-io#3322, but I don't have an LDAP setup to test with.

This was caused by the recent refactoring -- we added an explicit import
for `Settings`, but no explicit *export*.

This is actually the only remaining use of the variable, so instead of
simply revert the broken refactor, I just switched it over to using
`globalDb.collection.settings` (which is used all over the place), and
removed the `Settings` alias entirely.
  • Loading branch information
zenhack committed May 6, 2020
1 parent 649c607 commit 40d2199
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion shell/imports/db-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ ApiTokens = globalDb.collections.apiTokens;
Notifications = globalDb.collections.notifications;
StatsTokens = globalDb.collections.statsTokens;
Misc = globalDb.collections.misc;
Settings = globalDb.collections.settings;

currentUserGrains = globalDb.currentUserGrains.bind(globalDb);
isDemoUser = globalDb.isDemoUser.bind(globalDb);
Expand Down
3 changes: 1 addition & 2 deletions shell/imports/sandstorm-db/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { _ } from "meteor/underscore";

import Identicon from "/imports/sandstorm-identicons/identicon.js";
import { SandstormDb } from "./db.js";
import { Settings } from "/imports/db-deprecated.js";

let makeIdenticon;
let httpProtocol;
Expand Down Expand Up @@ -230,7 +229,7 @@ SandstormDb.fillInProfileDefaults = function (credential, profile) {
profile.name = profile.name || "Demo User";
profile.handle = profile.handle || "demo";
} else if (services.ldap) {
const setting = Settings.findOne({ _id: "ldapNameField" });
const setting = globalDb.collections.settings.findOne({ _id: "ldapNameField" });
const key = setting ? setting.value : "";
profile.handle = profile.handle || services.ldap.username;
profile.name = profile.name || services.ldap.rawAttrs[key] || profile.handle;
Expand Down

0 comments on commit 40d2199

Please sign in to comment.