@instructure/quiz-core 20.36.1-rc.4 → 20.36.1-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/banks/components/Banks/index.js +0 -1
- package/es/banks/components/Banks/presenter.js +4 -6
- package/es/banks/components/SharingModal/index.js +0 -2
- package/es/banks/components/SharingModal/presenter.js +17 -76
- package/es/common/components/resources/item/ItemEdit/presenter.js +1 -2
- package/lib/banks/components/Banks/index.js +0 -1
- package/lib/banks/components/Banks/presenter.js +4 -6
- package/lib/banks/components/SharingModal/index.js +0 -2
- package/lib/banks/components/SharingModal/presenter.js +17 -76
- package/lib/common/components/resources/item/ItemEdit/presenter.js +1 -2
- package/package.json +9 -9
|
@@ -19,7 +19,6 @@ function mapStateToProps(state, props) {
|
|
|
19
19
|
return {
|
|
20
20
|
itemBankSearchTableEnabled: featureOn('item_bank_search_table'),
|
|
21
21
|
usedByCourseEnabled: featureOn('filter_item_banks_used_by_course'),
|
|
22
|
-
subAccountBankSharingEnabled: featureOn('sub_account_bank_sharing'),
|
|
23
22
|
scopeType: scopeType,
|
|
24
23
|
sortBy: sortBy,
|
|
25
24
|
sortOrder: sortOrder,
|
|
@@ -222,7 +222,7 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
222
222
|
}, {
|
|
223
223
|
key: "topLevelBankFilterName",
|
|
224
224
|
value: function topLevelBankFilterName() {
|
|
225
|
-
return
|
|
225
|
+
return t('Shared with Me');
|
|
226
226
|
}
|
|
227
227
|
}, {
|
|
228
228
|
key: "renderFilters",
|
|
@@ -235,7 +235,7 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
235
235
|
translation: t('Institution Banks')
|
|
236
236
|
}, {
|
|
237
237
|
slug: 'courses',
|
|
238
|
-
translation:
|
|
238
|
+
translation: t('Shared with Courses')
|
|
239
239
|
}];
|
|
240
240
|
if (this.props.scope.uuid) {
|
|
241
241
|
scopeOptions.push({
|
|
@@ -243,7 +243,7 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
243
243
|
translation: t('This Course')
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
if (this.
|
|
246
|
+
if (this.isSubAccountLaunch()) {
|
|
247
247
|
// Put this option below "Insitution Banks"
|
|
248
248
|
scopeOptions.splice(2, 0, {
|
|
249
249
|
slug: 'this_account',
|
|
@@ -302,7 +302,7 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
302
302
|
onChange: this.handleSearchInputChange,
|
|
303
303
|
placeholder: t('Search Banks'),
|
|
304
304
|
"data-automation": "sdk-search-bank-textinput"
|
|
305
|
-
})),
|
|
305
|
+
})), !this.hideAccountSearch() && jsx(Grid.Col, {
|
|
306
306
|
width: 4
|
|
307
307
|
}, jsx(AsyncSearch, {
|
|
308
308
|
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
@@ -488,7 +488,6 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
488
488
|
usedByCourseEnabled: PropTypes.bool,
|
|
489
489
|
itemBankSearchTableEnabled: PropTypes.bool,
|
|
490
490
|
setUI: PropTypes.func.isRequired,
|
|
491
|
-
subAccountBankSharingEnabled: PropTypes.bool,
|
|
492
491
|
iceTopNavBarEnabled: PropTypes.bool,
|
|
493
492
|
styles: PropTypes.object,
|
|
494
493
|
rootAccountUuid: PropTypes.string
|
|
@@ -515,7 +514,6 @@ export var Banks = (_dec = withStyleOverrides(generateStyle, generateComponentTh
|
|
|
515
514
|
searchSelection: [],
|
|
516
515
|
usedByCourseEnabled: false,
|
|
517
516
|
itemBankSearchTableEnabled: false,
|
|
518
|
-
subAccountBankSharingEnabled: false,
|
|
519
517
|
iceTopNavBarEnabled: false,
|
|
520
518
|
rootAccountUuid: null
|
|
521
519
|
}, _Banks.contextTypes = {
|
|
@@ -4,14 +4,12 @@ import { connect } from "../../../common/react-redux.js";
|
|
|
4
4
|
import { shareBank, getSharedBanks, updateSharedBankPermission, getBank, updateBank } from "../../api/banks.js";
|
|
5
5
|
import { removeSharedBank } from "../../../common/actions/sharedBanks.js";
|
|
6
6
|
import { withConfirm } from "../../../common/actions/modal.js";
|
|
7
|
-
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
8
7
|
import SharingModal from "./presenter.js";
|
|
9
8
|
function mapStateToProps(state, ownProps) {
|
|
10
9
|
var sharedBanks = state.get('sharedBanks', Map()).filter(function (sharedBank) {
|
|
11
10
|
return sharedBank.get('bankId') === ownProps.bank.id;
|
|
12
11
|
}).toList();
|
|
13
12
|
return {
|
|
14
|
-
subAccountBankSharingEnabled: featureOn('sub_account_bank_sharing'),
|
|
15
13
|
sharedBanks: sharedBanks
|
|
16
14
|
};
|
|
17
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -176,27 +176,7 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
176
176
|
return originalEntity.get('permission', CAN_EDIT);
|
|
177
177
|
};
|
|
178
178
|
_this.handleEntityRemove = function (entity, undoRemove) {
|
|
179
|
-
|
|
180
|
-
_this.confirmPermissionChange(entity, REMOVED_ACCESS);
|
|
181
|
-
} else {
|
|
182
|
-
var permission = undoRemove ? _this.originalPermissionForEntity(entity) : REMOVED_ACCESS;
|
|
183
|
-
_this.setState(function (prevState) {
|
|
184
|
-
var sharesIndex = prevState.shares.findIndex(function (e) {
|
|
185
|
-
return e.get('id') == entity.get('id');
|
|
186
|
-
});
|
|
187
|
-
var newEntitiesIndex = prevState.newEntities.findIndex(function (e) {
|
|
188
|
-
return e.get('id') == entity.get('id');
|
|
189
|
-
});
|
|
190
|
-
var removedNewEntity = newEntitiesIndex > -1;
|
|
191
|
-
var newShares = removedNewEntity ? prevState.shares.delete(sharesIndex) : prevState.shares.setIn([sharesIndex, 'permission'], permission);
|
|
192
|
-
var newEntities = removedNewEntity ? prevState.newEntities.delete(newEntitiesIndex) : prevState.newEntities;
|
|
193
|
-
return {
|
|
194
|
-
shares: newShares,
|
|
195
|
-
newEntities: newEntities,
|
|
196
|
-
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, _defineProperty({}, entity.get('id'), permission))
|
|
197
|
-
};
|
|
198
|
-
}, _this.updateEntitiesCount);
|
|
199
|
-
}
|
|
179
|
+
_this.confirmPermissionChange(entity, REMOVED_ACCESS);
|
|
200
180
|
};
|
|
201
181
|
_this.handleSearchPermissionChange = function (e, _ref4) {
|
|
202
182
|
var value = _ref4.value;
|
|
@@ -223,21 +203,13 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
223
203
|
permission: _this.state.searchPermission
|
|
224
204
|
});
|
|
225
205
|
}));
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
} else {
|
|
235
|
-
_this.setState({
|
|
236
|
-
searchSelection: [],
|
|
237
|
-
shares: newEntities.concat(_this.state.shares),
|
|
238
|
-
newEntities: newEntities.concat(_this.state.newEntities)
|
|
239
|
-
}, _this.updateEntitiesCount);
|
|
240
|
-
}
|
|
206
|
+
newEntities.forEach(function (entity) {
|
|
207
|
+
_this.props.onShare(entity.toJS());
|
|
208
|
+
_this.props.shareBank(_this.sharedBankForEntity(entity), _this.props.getUserInfo);
|
|
209
|
+
});
|
|
210
|
+
_this.setState({
|
|
211
|
+
searchSelection: []
|
|
212
|
+
});
|
|
241
213
|
};
|
|
242
214
|
_this.updatePermission = /*#__PURE__*/function () {
|
|
243
215
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(entity, permission) {
|
|
@@ -282,19 +254,7 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
282
254
|
});
|
|
283
255
|
};
|
|
284
256
|
_this.handleEntityPermissionChange = function (entity, permission) {
|
|
285
|
-
|
|
286
|
-
_this.confirmPermissionChange(entity, permission);
|
|
287
|
-
} else {
|
|
288
|
-
_this.setState(function (prevState) {
|
|
289
|
-
var index = prevState.shares.findIndex(function (share) {
|
|
290
|
-
return share.get('id') === entity.get('id');
|
|
291
|
-
});
|
|
292
|
-
return {
|
|
293
|
-
shares: prevState.shares.setIn([index, 'permission'], permission),
|
|
294
|
-
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, _defineProperty({}, entity.get('id'), permission))
|
|
295
|
-
};
|
|
296
|
-
});
|
|
297
|
-
}
|
|
257
|
+
_this.confirmPermissionChange(entity, permission);
|
|
298
258
|
};
|
|
299
259
|
_this.toggleAccountShare = function (event) {
|
|
300
260
|
_this.setState(function (prevState) {
|
|
@@ -383,7 +343,7 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
383
343
|
}, {
|
|
384
344
|
key: "componentDidUpdate",
|
|
385
345
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
386
|
-
if (this.
|
|
346
|
+
if (this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
387
347
|
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
388
348
|
this.props.updateBank(updatedBank, false);
|
|
389
349
|
}
|
|
@@ -502,37 +462,20 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
502
462
|
var existingAccounts = existingShares.filter(function (s) {
|
|
503
463
|
return s.get('entityType') === SHARED_WITH_ACCOUNT;
|
|
504
464
|
});
|
|
505
|
-
|
|
506
|
-
return this.renderSubaccountSharingEnabledEntities(existingPeople, existingCourses, existingAccounts);
|
|
507
|
-
}
|
|
508
|
-
return this.renderOriginalDesignEntities(existingPeople, existingCourses);
|
|
465
|
+
return this.renderSubaccountSharingEnabledEntities(existingPeople, existingCourses, existingAccounts);
|
|
509
466
|
}
|
|
510
467
|
}, {
|
|
511
468
|
key: "renderFooter",
|
|
512
469
|
value: function renderFooter() {
|
|
513
|
-
|
|
514
|
-
return jsx(Button, {
|
|
515
|
-
color: "primary",
|
|
516
|
-
margin: "0 x-small 0 0",
|
|
517
|
-
onClick: this.handleDismiss
|
|
518
|
-
}, t('Close'));
|
|
519
|
-
}
|
|
520
|
-
return jsx(React.Fragment, null, jsx(Button, {
|
|
521
|
-
"data-automation": "sdk-shared-bank-cancel-button",
|
|
522
|
-
color: "primary-inverse",
|
|
523
|
-
onClick: this.handleDismiss,
|
|
524
|
-
margin: "0 x-small 0 0"
|
|
525
|
-
}, t('Cancel')), jsx(Button, {
|
|
526
|
-
"data-automation": "sdk-shared-bank-done-button",
|
|
470
|
+
return jsx(Button, {
|
|
527
471
|
color: "primary",
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}, t('
|
|
472
|
+
margin: "0 x-small 0 0",
|
|
473
|
+
onClick: this.handleDismiss
|
|
474
|
+
}, t('Close'));
|
|
531
475
|
}
|
|
532
476
|
}, {
|
|
533
477
|
key: "render",
|
|
534
478
|
value: function render() {
|
|
535
|
-
var subAccountBankSharingEnabled = this.props.subAccountBankSharingEnabled;
|
|
536
479
|
return jsx(Modal, {
|
|
537
480
|
open: this.props.isOpen,
|
|
538
481
|
onDismiss: this.handleDismiss,
|
|
@@ -545,7 +488,7 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
545
488
|
placement: "end",
|
|
546
489
|
offset: "medium",
|
|
547
490
|
screenReaderLabel: t('Close')
|
|
548
|
-
})), jsx(ModalBody, null,
|
|
491
|
+
})), jsx(ModalBody, null, this.state.shares.size >= 0 ? this.renderEntitiesSection() : _ref7), jsx(ModalFooter, null, this.renderFooter()));
|
|
549
492
|
}
|
|
550
493
|
}]);
|
|
551
494
|
SharingModalPresenter.displayName = "SharingModalPresenter";
|
|
@@ -580,7 +523,6 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
580
523
|
removeSharedBank: PropTypes.func.isRequired,
|
|
581
524
|
shareBank: PropTypes.func.isRequired,
|
|
582
525
|
sharedBanks: ImmutablePropTypes.list,
|
|
583
|
-
subAccountBankSharingEnabled: PropTypes.bool,
|
|
584
526
|
updateBank: PropTypes.func.isRequired,
|
|
585
527
|
updateSharedBankPermission: PropTypes.func.isRequired,
|
|
586
528
|
updateSharedCount: PropTypes.func,
|
|
@@ -595,7 +537,6 @@ export var SharingModalPresenter = (_dec = withStyleOverrides(generateStyle, gen
|
|
|
595
537
|
onDismiss: noop,
|
|
596
538
|
onShare: function onShare() {},
|
|
597
539
|
sharedBanks: List(),
|
|
598
|
-
subAccountBankSharingEnabled: false,
|
|
599
540
|
updateSharedCount: Function.prototype
|
|
600
541
|
}, _SharingModalPresenter)) || _class);
|
|
601
542
|
export default SharingModalPresenter;
|
|
@@ -15,7 +15,6 @@ import t from '@instructure/quiz-i18n/es/format-message';
|
|
|
15
15
|
import { propsForInteractionEdit } from "../../../../util/interactionTypePropsHelper.js";
|
|
16
16
|
import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
|
|
17
17
|
import { toErrors } from "../../../../util/instUIMessages.js";
|
|
18
|
-
import { featureOn } from "../../../../../common/util/featureCheck.js";
|
|
19
18
|
export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
20
19
|
_inherits(ItemEdit, _Component);
|
|
21
20
|
var _super = _createSuper(ItemEdit);
|
|
@@ -63,7 +62,7 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
63
62
|
var launchContextUuid = this.props.scope.launch_context_uuid;
|
|
64
63
|
var launchContextTitle = this.props.scope.title;
|
|
65
64
|
// If editing within a quiz, there is no account launch context
|
|
66
|
-
if (
|
|
65
|
+
if (rootAccountName) {
|
|
67
66
|
launchContexts.push({
|
|
68
67
|
uuid: this.props.rootAccountUuid,
|
|
69
68
|
name: rootAccountName
|
|
@@ -26,7 +26,6 @@ function mapStateToProps(state, props) {
|
|
|
26
26
|
return {
|
|
27
27
|
itemBankSearchTableEnabled: (0, _featureCheck.featureOn)('item_bank_search_table'),
|
|
28
28
|
usedByCourseEnabled: (0, _featureCheck.featureOn)('filter_item_banks_used_by_course'),
|
|
29
|
-
subAccountBankSharingEnabled: (0, _featureCheck.featureOn)('sub_account_bank_sharing'),
|
|
30
29
|
scopeType: scopeType,
|
|
31
30
|
sortBy: sortBy,
|
|
32
31
|
sortOrder: sortOrder,
|
|
@@ -230,7 +230,7 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
230
230
|
}, {
|
|
231
231
|
key: "topLevelBankFilterName",
|
|
232
232
|
value: function topLevelBankFilterName() {
|
|
233
|
-
return
|
|
233
|
+
return (0, _formatMessage.default)('Shared with Me');
|
|
234
234
|
}
|
|
235
235
|
}, {
|
|
236
236
|
key: "renderFilters",
|
|
@@ -243,7 +243,7 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
243
243
|
translation: (0, _formatMessage.default)('Institution Banks')
|
|
244
244
|
}, {
|
|
245
245
|
slug: 'courses',
|
|
246
|
-
translation:
|
|
246
|
+
translation: (0, _formatMessage.default)('Shared with Courses')
|
|
247
247
|
}];
|
|
248
248
|
if (this.props.scope.uuid) {
|
|
249
249
|
scopeOptions.push({
|
|
@@ -251,7 +251,7 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
251
251
|
translation: (0, _formatMessage.default)('This Course')
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
if (this.
|
|
254
|
+
if (this.isSubAccountLaunch()) {
|
|
255
255
|
// Put this option below "Insitution Banks"
|
|
256
256
|
scopeOptions.splice(2, 0, {
|
|
257
257
|
slug: 'this_account',
|
|
@@ -310,7 +310,7 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
310
310
|
onChange: this.handleSearchInputChange,
|
|
311
311
|
placeholder: (0, _formatMessage.default)('Search Banks'),
|
|
312
312
|
"data-automation": "sdk-search-bank-textinput"
|
|
313
|
-
})),
|
|
313
|
+
})), !this.hideAccountSearch() && (0, _emotion.jsx)(_uiGrid.Grid.Col, {
|
|
314
314
|
width: 4
|
|
315
315
|
}, (0, _emotion.jsx)(_index7.default, {
|
|
316
316
|
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
@@ -496,7 +496,6 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
496
496
|
usedByCourseEnabled: _propTypes.default.bool,
|
|
497
497
|
itemBankSearchTableEnabled: _propTypes.default.bool,
|
|
498
498
|
setUI: _propTypes.default.func.isRequired,
|
|
499
|
-
subAccountBankSharingEnabled: _propTypes.default.bool,
|
|
500
499
|
iceTopNavBarEnabled: _propTypes.default.bool,
|
|
501
500
|
styles: _propTypes.default.object,
|
|
502
501
|
rootAccountUuid: _propTypes.default.string
|
|
@@ -523,7 +522,6 @@ var Banks = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.default, _theme.
|
|
|
523
522
|
searchSelection: [],
|
|
524
523
|
usedByCourseEnabled: false,
|
|
525
524
|
itemBankSearchTableEnabled: false,
|
|
526
|
-
subAccountBankSharingEnabled: false,
|
|
527
525
|
iceTopNavBarEnabled: false,
|
|
528
526
|
rootAccountUuid: null
|
|
529
527
|
}, _Banks.contextTypes = {
|
|
@@ -11,14 +11,12 @@ var _reactRedux = require("../../../common/react-redux.js");
|
|
|
11
11
|
var _banks = require("../../api/banks.js");
|
|
12
12
|
var _sharedBanks = require("../../../common/actions/sharedBanks.js");
|
|
13
13
|
var _modal = require("../../../common/actions/modal.js");
|
|
14
|
-
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
15
14
|
var _presenter = _interopRequireDefault(require("./presenter.js"));
|
|
16
15
|
function mapStateToProps(state, ownProps) {
|
|
17
16
|
var sharedBanks = state.get('sharedBanks', (0, _immutable.Map)()).filter(function (sharedBank) {
|
|
18
17
|
return sharedBank.get('bankId') === ownProps.bank.id;
|
|
19
18
|
}).toList();
|
|
20
19
|
return {
|
|
21
|
-
subAccountBankSharingEnabled: (0, _featureCheck.featureOn)('sub_account_bank_sharing'),
|
|
22
20
|
sharedBanks: sharedBanks
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.SharingModalPresenter = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
14
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -184,27 +184,7 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
184
184
|
return originalEntity.get('permission', _quizCommon.CAN_EDIT);
|
|
185
185
|
};
|
|
186
186
|
_this.handleEntityRemove = function (entity, undoRemove) {
|
|
187
|
-
|
|
188
|
-
_this.confirmPermissionChange(entity, _quizCommon.REMOVED_ACCESS);
|
|
189
|
-
} else {
|
|
190
|
-
var permission = undoRemove ? _this.originalPermissionForEntity(entity) : _quizCommon.REMOVED_ACCESS;
|
|
191
|
-
_this.setState(function (prevState) {
|
|
192
|
-
var sharesIndex = prevState.shares.findIndex(function (e) {
|
|
193
|
-
return e.get('id') == entity.get('id');
|
|
194
|
-
});
|
|
195
|
-
var newEntitiesIndex = prevState.newEntities.findIndex(function (e) {
|
|
196
|
-
return e.get('id') == entity.get('id');
|
|
197
|
-
});
|
|
198
|
-
var removedNewEntity = newEntitiesIndex > -1;
|
|
199
|
-
var newShares = removedNewEntity ? prevState.shares.delete(sharesIndex) : prevState.shares.setIn([sharesIndex, 'permission'], permission);
|
|
200
|
-
var newEntities = removedNewEntity ? prevState.newEntities.delete(newEntitiesIndex) : prevState.newEntities;
|
|
201
|
-
return {
|
|
202
|
-
shares: newShares,
|
|
203
|
-
newEntities: newEntities,
|
|
204
|
-
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, (0, _defineProperty2.default)({}, entity.get('id'), permission))
|
|
205
|
-
};
|
|
206
|
-
}, _this.updateEntitiesCount);
|
|
207
|
-
}
|
|
187
|
+
_this.confirmPermissionChange(entity, _quizCommon.REMOVED_ACCESS);
|
|
208
188
|
};
|
|
209
189
|
_this.handleSearchPermissionChange = function (e, _ref4) {
|
|
210
190
|
var value = _ref4.value;
|
|
@@ -231,21 +211,13 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
231
211
|
permission: _this.state.searchPermission
|
|
232
212
|
});
|
|
233
213
|
}));
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
});
|
|
242
|
-
} else {
|
|
243
|
-
_this.setState({
|
|
244
|
-
searchSelection: [],
|
|
245
|
-
shares: newEntities.concat(_this.state.shares),
|
|
246
|
-
newEntities: newEntities.concat(_this.state.newEntities)
|
|
247
|
-
}, _this.updateEntitiesCount);
|
|
248
|
-
}
|
|
214
|
+
newEntities.forEach(function (entity) {
|
|
215
|
+
_this.props.onShare(entity.toJS());
|
|
216
|
+
_this.props.shareBank(_this.sharedBankForEntity(entity), _this.props.getUserInfo);
|
|
217
|
+
});
|
|
218
|
+
_this.setState({
|
|
219
|
+
searchSelection: []
|
|
220
|
+
});
|
|
249
221
|
};
|
|
250
222
|
_this.updatePermission = /*#__PURE__*/function () {
|
|
251
223
|
var _ref5 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(entity, permission) {
|
|
@@ -290,19 +262,7 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
290
262
|
});
|
|
291
263
|
};
|
|
292
264
|
_this.handleEntityPermissionChange = function (entity, permission) {
|
|
293
|
-
|
|
294
|
-
_this.confirmPermissionChange(entity, permission);
|
|
295
|
-
} else {
|
|
296
|
-
_this.setState(function (prevState) {
|
|
297
|
-
var index = prevState.shares.findIndex(function (share) {
|
|
298
|
-
return share.get('id') === entity.get('id');
|
|
299
|
-
});
|
|
300
|
-
return {
|
|
301
|
-
shares: prevState.shares.setIn([index, 'permission'], permission),
|
|
302
|
-
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, (0, _defineProperty2.default)({}, entity.get('id'), permission))
|
|
303
|
-
};
|
|
304
|
-
});
|
|
305
|
-
}
|
|
265
|
+
_this.confirmPermissionChange(entity, permission);
|
|
306
266
|
};
|
|
307
267
|
_this.toggleAccountShare = function (event) {
|
|
308
268
|
_this.setState(function (prevState) {
|
|
@@ -391,7 +351,7 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
391
351
|
}, {
|
|
392
352
|
key: "componentDidUpdate",
|
|
393
353
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
394
|
-
if (this.
|
|
354
|
+
if (this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
395
355
|
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
396
356
|
this.props.updateBank(updatedBank, false);
|
|
397
357
|
}
|
|
@@ -510,37 +470,20 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
510
470
|
var existingAccounts = existingShares.filter(function (s) {
|
|
511
471
|
return s.get('entityType') === _quizCommon.SHARED_WITH_ACCOUNT;
|
|
512
472
|
});
|
|
513
|
-
|
|
514
|
-
return this.renderSubaccountSharingEnabledEntities(existingPeople, existingCourses, existingAccounts);
|
|
515
|
-
}
|
|
516
|
-
return this.renderOriginalDesignEntities(existingPeople, existingCourses);
|
|
473
|
+
return this.renderSubaccountSharingEnabledEntities(existingPeople, existingCourses, existingAccounts);
|
|
517
474
|
}
|
|
518
475
|
}, {
|
|
519
476
|
key: "renderFooter",
|
|
520
477
|
value: function renderFooter() {
|
|
521
|
-
|
|
522
|
-
return (0, _emotion.jsx)(_uiButtons.Button, {
|
|
523
|
-
color: "primary",
|
|
524
|
-
margin: "0 x-small 0 0",
|
|
525
|
-
onClick: this.handleDismiss
|
|
526
|
-
}, (0, _formatMessage.default)('Close'));
|
|
527
|
-
}
|
|
528
|
-
return (0, _emotion.jsx)(_react.default.Fragment, null, (0, _emotion.jsx)(_uiButtons.Button, {
|
|
529
|
-
"data-automation": "sdk-shared-bank-cancel-button",
|
|
530
|
-
color: "primary-inverse",
|
|
531
|
-
onClick: this.handleDismiss,
|
|
532
|
-
margin: "0 x-small 0 0"
|
|
533
|
-
}, (0, _formatMessage.default)('Cancel')), (0, _emotion.jsx)(_uiButtons.Button, {
|
|
534
|
-
"data-automation": "sdk-shared-bank-done-button",
|
|
478
|
+
return (0, _emotion.jsx)(_uiButtons.Button, {
|
|
535
479
|
color: "primary",
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}, (0, _formatMessage.default)('
|
|
480
|
+
margin: "0 x-small 0 0",
|
|
481
|
+
onClick: this.handleDismiss
|
|
482
|
+
}, (0, _formatMessage.default)('Close'));
|
|
539
483
|
}
|
|
540
484
|
}, {
|
|
541
485
|
key: "render",
|
|
542
486
|
value: function render() {
|
|
543
|
-
var subAccountBankSharingEnabled = this.props.subAccountBankSharingEnabled;
|
|
544
487
|
return (0, _emotion.jsx)(_quizCommon.Modal, {
|
|
545
488
|
open: this.props.isOpen,
|
|
546
489
|
onDismiss: this.handleDismiss,
|
|
@@ -553,7 +496,7 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
553
496
|
placement: "end",
|
|
554
497
|
offset: "medium",
|
|
555
498
|
screenReaderLabel: (0, _formatMessage.default)('Close')
|
|
556
|
-
})), (0, _emotion.jsx)(_quizCommon.ModalBody, null,
|
|
499
|
+
})), (0, _emotion.jsx)(_quizCommon.ModalBody, null, this.state.shares.size >= 0 ? this.renderEntitiesSection() : _ref7), (0, _emotion.jsx)(_quizCommon.ModalFooter, null, this.renderFooter()));
|
|
557
500
|
}
|
|
558
501
|
}]);
|
|
559
502
|
SharingModalPresenter.displayName = "SharingModalPresenter";
|
|
@@ -588,7 +531,6 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
588
531
|
removeSharedBank: _propTypes.default.func.isRequired,
|
|
589
532
|
shareBank: _propTypes.default.func.isRequired,
|
|
590
533
|
sharedBanks: _reactImmutableProptypes.default.list,
|
|
591
|
-
subAccountBankSharingEnabled: _propTypes.default.bool,
|
|
592
534
|
updateBank: _propTypes.default.func.isRequired,
|
|
593
535
|
updateSharedBankPermission: _propTypes.default.func.isRequired,
|
|
594
536
|
updateSharedCount: _propTypes.default.func,
|
|
@@ -603,7 +545,6 @@ var SharingModalPresenter = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.
|
|
|
603
545
|
onDismiss: noop,
|
|
604
546
|
onShare: function onShare() {},
|
|
605
547
|
sharedBanks: (0, _immutable.List)(),
|
|
606
|
-
subAccountBankSharingEnabled: false,
|
|
607
548
|
updateSharedCount: Function.prototype
|
|
608
549
|
}, _SharingModalPresenter)) || _class);
|
|
609
550
|
exports.SharingModalPresenter = SharingModalPresenter;
|
|
@@ -23,7 +23,6 @@ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/f
|
|
|
23
23
|
var _interactionTypePropsHelper = require("../../../../util/interactionTypePropsHelper.js");
|
|
24
24
|
var _ElementsForSelectors = _interopRequireDefault(require("../../../../../common/util/ElementsForSelectors.js"));
|
|
25
25
|
var _instUIMessages = require("../../../../util/instUIMessages.js");
|
|
26
|
-
var _featureCheck = require("../../../../../common/util/featureCheck.js");
|
|
27
26
|
var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
28
27
|
(0, _inherits2.default)(ItemEdit, _Component);
|
|
29
28
|
var _super = (0, _createSuper2.default)(ItemEdit);
|
|
@@ -71,7 +70,7 @@ var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
71
70
|
var launchContextUuid = this.props.scope.launch_context_uuid;
|
|
72
71
|
var launchContextTitle = this.props.scope.title;
|
|
73
72
|
// If editing within a quiz, there is no account launch context
|
|
74
|
-
if (
|
|
73
|
+
if (rootAccountName) {
|
|
75
74
|
launchContexts.push({
|
|
76
75
|
uuid: this.props.rootAccountUuid,
|
|
77
76
|
name: rootAccountName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.36.1-rc.
|
|
3
|
+
"version": "20.36.1-rc.6+1a10615e3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@instructure/emotion": "^8.56.3",
|
|
47
47
|
"@instructure/grading-utils": "^1.0.0",
|
|
48
48
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
49
|
-
"@instructure/quiz-common": "^20.36.1-rc.
|
|
50
|
-
"@instructure/quiz-i18n": "^20.36.1-rc.
|
|
51
|
-
"@instructure/quiz-interactions": "^20.36.1-rc.
|
|
52
|
-
"@instructure/quiz-number-input": "^20.36.1-rc.
|
|
53
|
-
"@instructure/quiz-rce": "^20.36.1-rc.
|
|
49
|
+
"@instructure/quiz-common": "^20.36.1-rc.6+1a10615e3",
|
|
50
|
+
"@instructure/quiz-i18n": "^20.36.1-rc.6+1a10615e3",
|
|
51
|
+
"@instructure/quiz-interactions": "^20.36.1-rc.6+1a10615e3",
|
|
52
|
+
"@instructure/quiz-number-input": "^20.36.1-rc.6+1a10615e3",
|
|
53
|
+
"@instructure/quiz-rce": "^20.36.1-rc.6+1a10615e3",
|
|
54
54
|
"@instructure/ui-a11y-content": "^8.56.3",
|
|
55
55
|
"@instructure/ui-alerts": "^8.56.3",
|
|
56
56
|
"@instructure/ui-avatar": "^8.56.3",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"file-saver": "~2.0.5",
|
|
115
115
|
"humps": "^2.0.0",
|
|
116
116
|
"immutable": "^3.8.1",
|
|
117
|
-
"instructure-validations": "^20.36.1-rc.
|
|
117
|
+
"instructure-validations": "^20.36.1-rc.6+1a10615e3",
|
|
118
118
|
"ipaddr.js": "^1.5.4",
|
|
119
119
|
"isomorphic-fetch": "^2.2.0",
|
|
120
120
|
"isuuid": "^0.1.0",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"jquery": "^2.2.3",
|
|
165
165
|
"karma-junit-reporter": "^2.0.1",
|
|
166
166
|
"most-subject": "^5.3.0",
|
|
167
|
-
"quiz-presets": "^20.36.1-rc.
|
|
167
|
+
"quiz-presets": "^20.36.1-rc.6+1a10615e3",
|
|
168
168
|
"react": "^16.8.6",
|
|
169
169
|
"react-addons-test-utils": "^15.6.2",
|
|
170
170
|
"react-dom": "^16.8.6",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
"publishConfig": {
|
|
181
181
|
"access": "public"
|
|
182
182
|
},
|
|
183
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "1a10615e378cbb095dce3fa4ddc808f3c9d629d0"
|
|
184
184
|
}
|