Skip to content

Commit 04e8f3a

Browse files
fix: manage access modal on duplicated xblock (#1866)
1 parent d717303 commit 04e8f3a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/course-unit/CourseUnit.test.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ describe('<CourseUnit />', () => {
468468
id: courseVerticalChildrenMock.children[0].block_id,
469469
});
470470

471+
axiosMock
472+
.onGet(getCourseUnitApiUrl(blockId))
473+
.reply(200, courseUnitIndexMock);
474+
471475
axiosMock
472476
.onPost(postXBlockBaseApiUrl({
473477
parent_locator: blockId,
@@ -2144,6 +2148,17 @@ describe('<CourseUnit />', () => {
21442148
? { ...child, block_type: 'html' }
21452149
: child));
21462150

2151+
axiosMock
2152+
.onGet(getCourseUnitApiUrl(blockId))
2153+
.reply(200, courseUnitIndexMock);
2154+
2155+
axiosMock
2156+
.onPost(postXBlockBaseApiUrl({
2157+
parent_locator: blockId,
2158+
duplicate_source_locator: courseVerticalChildrenMock.children[0].block_id,
2159+
}))
2160+
.replyOnce(200, { locator: '1234567890' });
2161+
21472162
axiosMock
21482163
.onGet(getCourseVerticalChildrenApiUrl(blockId))
21492164
.reply(200, updatedCourseVerticalChildrenMock);

src/course-unit/data/thunk.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ export function duplicateUnitItemQuery(itemId, xblockId, callback) {
262262
callback(courseKey, locator);
263263
const courseUnit = await getCourseUnitData(itemId);
264264
dispatch(fetchCourseItemSuccess(courseUnit));
265+
const courseVerticalChildrenData = await getCourseVerticalChildren(itemId);
266+
dispatch(updateCourseVerticalChildren(courseVerticalChildrenData));
265267
dispatch(hideProcessingNotification());
266268
dispatch(updateSavingStatus({ status: RequestStatus.SUCCESSFUL }));
267269
} catch (error) {

0 commit comments

Comments
 (0)