381c5cb15c
Modified the previous implementation of the whiteboard individual access to remove multiple Collections dependency on this feature. Multi-user whiteboard is now an array instead of a boolean value and most of the access control can be synchronized and handled by akka-apps.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import Storage from '/imports/ui/services/storage/session';
|
|
import Users from '/imports/api/users';
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
const DRAW_SETTINGS = 'drawSettings';
|
|
|
|
const setTextShapeValue = (text) => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
if (drawSettings) {
|
|
drawSettings.textShape.textShapeValue = text;
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
|
}
|
|
};
|
|
|
|
const resetTextShapeActiveId = () => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
if (drawSettings) {
|
|
drawSettings.textShape.textShapeActiveId = '';
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
|
}
|
|
};
|
|
|
|
const isPresenter = () => {
|
|
const currentUser = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
|
|
return currentUser ? currentUser.presenter : false;
|
|
};
|
|
|
|
const activeTextShapeId = () => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
return drawSettings ? drawSettings.textShape.textShapeActiveId : '';
|
|
};
|
|
|
|
export default {
|
|
setTextShapeValue,
|
|
activeTextShapeId,
|
|
isPresenter,
|
|
resetTextShapeActiveId,
|
|
};
|