Merge branch 'MDL-85412-405' of https://github.com/aanabit/moodle into MOODLE_405_STABLE
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -184,6 +184,7 @@ export default class {
|
||||
* @param {int|null|undefined} data.targetSectionId the target section id
|
||||
* @param {int|null|undefined} data.targetCmId the target cm id
|
||||
* @param {String|null|undefined} data.component optional component (for format plugins)
|
||||
* @param {Object|undefined} [data.feedbackParams] the params to build the feedback message
|
||||
* @return {Object} the log entry
|
||||
*/
|
||||
async _getLoggerEntry(stateManager, action, itemIds, data = {}) {
|
||||
@@ -192,7 +193,7 @@ export default class {
|
||||
stateManager.setLogger(new SRLogger());
|
||||
isLoggerSet = true;
|
||||
}
|
||||
const feedbackParams = {
|
||||
let feedbackParams = {
|
||||
action,
|
||||
itemType: data.itemType ?? action.split('_')[0],
|
||||
};
|
||||
@@ -211,6 +212,9 @@ export default class {
|
||||
if (data.targetCmId) {
|
||||
feedbackParams.targetCmName = stateManager.get('cm', data.targetCmId).name;
|
||||
}
|
||||
if (data.feedbackParams) {
|
||||
feedbackParams = {...feedbackParams, ...data.feedbackParams};
|
||||
}
|
||||
|
||||
const message = await getString(
|
||||
`${action.toLowerCase()}_feedback${batch}`,
|
||||
@@ -412,6 +416,8 @@ export default class {
|
||||
const course = stateManager.get('course');
|
||||
const updates = await this._callEditWebservice('section_add', course.id, [], targetSectionId);
|
||||
stateManager.processUpdates(updates);
|
||||
const logEntry = this._getLoggerEntry(stateManager, 'section_add', []);
|
||||
stateManager.addLoggerEntry(await logEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,9 +428,11 @@ export default class {
|
||||
*/
|
||||
async sectionDelete(stateManager, sectionIds) {
|
||||
const course = stateManager.get('course');
|
||||
const logEntry = this._getLoggerEntry(stateManager, 'section_delete', sectionIds);
|
||||
const updates = await this._callEditWebservice('section_delete', course.id, sectionIds);
|
||||
this.bulkReset(stateManager);
|
||||
stateManager.processUpdates(updates);
|
||||
stateManager.addLoggerEntry(await logEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,11 +442,13 @@ export default class {
|
||||
*/
|
||||
async cmDelete(stateManager, cmIds) {
|
||||
const course = stateManager.get('course');
|
||||
const logEntry = this._getLoggerEntry(stateManager, 'cm_delete', cmIds);
|
||||
this.cmLock(stateManager, cmIds, true);
|
||||
const updates = await this._callEditWebservice('cm_delete', course.id, cmIds);
|
||||
this.bulkReset(stateManager);
|
||||
this.cmLock(stateManager, cmIds, false);
|
||||
stateManager.processUpdates(updates);
|
||||
stateManager.addLoggerEntry(await logEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -483,8 +493,18 @@ export default class {
|
||||
targetCmId = 0;
|
||||
}
|
||||
const course = stateManager.get('course');
|
||||
const pluginname = await getString(
|
||||
'pluginname',
|
||||
`${modName.toLowerCase()}`,
|
||||
);
|
||||
const logEntry = this._getLoggerEntry(stateManager, 'cm_add', [], {
|
||||
feedbackParams: {
|
||||
'modname': pluginname,
|
||||
},
|
||||
});
|
||||
const updates = await this._callNewModuleWebservice(course.id, modName, targetSectionId, targetCmId);
|
||||
stateManager.processUpdates(updates);
|
||||
stateManager.addLoggerEntry(await logEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,12 +27,12 @@ Feature: Delete activity and resource works correctly
|
||||
When I click on "Delete" "link" in the "Label 1" activity
|
||||
And I click on "Delete" "button" in the "Delete activity?" "dialogue"
|
||||
# Confirm that label is successfully deleted
|
||||
Then I should not see "Label 1"
|
||||
Then I should not see "Label 1" in the "page-content" "region"
|
||||
And I open "Glossary 1" actions menu
|
||||
And I click on "Delete" "link" in the "Glossary 1" activity
|
||||
And I click on "Delete" "button" in the "Delete activity?" "dialogue"
|
||||
# Confirm that glossary is successfully deleted.
|
||||
And I should not see "Glossary 1"
|
||||
And I should not see "Glossary 1" in the "page-content" "region"
|
||||
# Reload the page and confirm that both the label and glossary are really deleted
|
||||
And I reload the page
|
||||
And I should not see "Label 1"
|
||||
|
||||
@@ -34,6 +34,7 @@ $string['bulkeditingcourse'] = 'Bulk edit course: {$a}';
|
||||
$string['bulkcancel'] = 'Close bulk actions';
|
||||
$string['bulkselection'] = '{$a} selected';
|
||||
$string['bulkselection_plural'] = '{$a} selected';
|
||||
$string['cm_add_feedback'] = '{$a->modname} added.';
|
||||
$string['cm_complete_feedback'] = '{$a->name} marked as completed.';
|
||||
$string['cm_complete_feedback_batch'] = 'Selected {$a->count} activities marked as completed.';
|
||||
$string['cm_delete_feedback'] = '{$a->name} deleted.';
|
||||
@@ -74,6 +75,7 @@ $string['nobulkaction'] = 'No bulk actions available';
|
||||
$string['orphansectionwarning'] = 'This section and its content are not part of the course structure and are not visible to students. To use any of this content, move it to a different section.';
|
||||
$string['preference:coursesectionspreferences'] = 'Section user preferences for course {$a}';
|
||||
$string['privacy:metadata:preference:coursesectionspreferences'] = 'Section user preferences like collapsed and expanded.';
|
||||
$string['section_add_feedback'] = 'Section added.';
|
||||
$string['section_hide_feedback'] = 'Course section {$a->name} hidden.';
|
||||
$string['section_hide_feedback_batch'] = 'Selected {$a->count} course sections hidden.';
|
||||
$string['section_show_feedback'] = 'Course section {$a->name} shown.';
|
||||
|
||||
Reference in New Issue
Block a user