mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-67144 mod_forum: If no users exist do not show the grading interface
This commit is contained in:
parent
ff175fce22
commit
fc741e030e
@ -563,6 +563,7 @@ $string['noselecteditems'] = 'no items were selected.';
|
||||
$string['notteachererror'] = 'You must be a teacher to use this feature.';
|
||||
$string['notenrolled'] = 'You are currently not enrolled in any courses.';
|
||||
$string['nousersloaded'] = 'No users loaded';
|
||||
$string['nouserstograde'] = 'No users to grade';
|
||||
$string['numberofgrades'] = 'Number of grades';
|
||||
$string['onascaleof'] = 'on a scale of {$a->grademin} to {$a->grademax}';
|
||||
$string['operations'] = 'Operations';
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -27,6 +27,7 @@ import getUserPicker from './local/grader/user_picker';
|
||||
import {createLayout as createFullScreenWindow} from 'mod_forum/local/layout/fullscreen';
|
||||
import getGradingPanelFunctions from './local/grader/gradingpanel';
|
||||
import {add as addToast} from 'core/toast';
|
||||
import {addNotification} from 'core/notification';
|
||||
import {get_string as getString} from 'core/str';
|
||||
import {failedUpdate} from 'core_grades/grades/grader/gradingpanel/normalise';
|
||||
import {addIconToContainerWithPromise} from 'core/loadingicon';
|
||||
@ -342,10 +343,21 @@ export const launch = async(getListOfUsers, getContentForUser, getGradeForUser,
|
||||
|
||||
// We need all of these functions to be executed in series, if one step runs before another the interface
|
||||
// will not work.
|
||||
|
||||
// We need this promise to resolve separately so that we can avoid loading the whole interface if there are no users.
|
||||
const userList = await getListOfUsers();
|
||||
if (!userList.length) {
|
||||
addNotification({
|
||||
message: await getString('nouserstograde', 'core_grades'),
|
||||
type: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Now that we have confirmed there are at least some users let's boot up the grader interface.
|
||||
const [
|
||||
graderLayout,
|
||||
{html, js},
|
||||
userList,
|
||||
] = await Promise.all([
|
||||
createFullScreenWindow({
|
||||
fullscreen: false,
|
||||
@ -359,8 +371,8 @@ export const launch = async(getListOfUsers, getContentForUser, getGradeForUser,
|
||||
drawer: {show: true},
|
||||
defaultsendnotifications: sendStudentNotifications,
|
||||
}),
|
||||
getListOfUsers(),
|
||||
]);
|
||||
|
||||
const graderContainer = graderLayout.getContainer();
|
||||
|
||||
const saveGradeFunction = getSaveUserGradeFunction(graderContainer, setGradeForUser);
|
||||
|
Loading…
x
Reference in New Issue
Block a user