FIX: currentUser can be null

This commit is contained in:
Robin Ward 2016-07-19 12:48:52 -04:00
parent ede19943b3
commit f38347400c

View file

@ -8,8 +8,9 @@ const ATTRIBUTES_REGEX = new RegExp("(" + WHITELISTED_ATTRIBUTES.join("|") + ")=
registerOption((siteSettings, opts) => { registerOption((siteSettings, opts) => {
const currentUser = (opts.getCurrentUser && opts.getCurrentUser(opts.userId)) || opts.currentUser; const currentUser = (opts.getCurrentUser && opts.getCurrentUser(opts.userId)) || opts.currentUser;
const staff = currentUser && currentUser.staff;
opts.features.poll = !!siteSettings.poll_enabled || currentUser.staff; opts.features.poll = !!siteSettings.poll_enabled || staff;
opts.pollMaximumOptions = siteSettings.poll_maximum_options; opts.pollMaximumOptions = siteSettings.poll_maximum_options;
}); });