mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* Current types:
|
||||
* Admin : task_overdue, user_registration, nogrp_user_registered
|
||||
* User : task_requirements_updated, user_task_overdue, task_reminder, achievement,
|
||||
* User : task_requirements_updated, task_submissions_closed, task_submissions_reopened, user_task_overdue, user_task_auto_completed, task_reminder, achievement,
|
||||
* course_unlocked, course_completed, certificate_issued, welcome,
|
||||
* nogrp_welcome, assessment_updated, announcement, tier_expired,
|
||||
* task_submission_reviewed, task_assigned, task_completed
|
||||
@@ -45,12 +45,13 @@ const NOTIFICATION_REGISTRY = {
|
||||
type: 'task_overdue',
|
||||
scope: 'admin',
|
||||
trigger: 'cron',
|
||||
build({ count, task_list_ids = [] }) {
|
||||
build({ count, task_list_ids = [], targetStatus = 'overdue' }) {
|
||||
const label = targetStatus === 'completed' ? 'completed' : 'overdue';
|
||||
return {
|
||||
type: 'task_overdue',
|
||||
title: 'Tasks Overdue',
|
||||
message: `${count} task${count === 1 ? ' was' : 's were'} automatically marked as overdue.`,
|
||||
data: { count, task_list_ids },
|
||||
title: targetStatus === 'completed' ? 'Tasks Auto-Completed' : 'Tasks Overdue',
|
||||
message: `${count} task${count === 1 ? ' was' : 's were'} automatically marked as ${label}.`,
|
||||
data: { count, task_list_ids, target_status: targetStatus },
|
||||
};
|
||||
},
|
||||
},
|
||||
@@ -94,12 +95,40 @@ const NOTIFICATION_REGISTRY = {
|
||||
type: 'task',
|
||||
scope: 'user',
|
||||
trigger: 'event',
|
||||
build({ taskName, taskListId = null, groupId = null }) {
|
||||
build({ taskName, taskListId = null, groupId = null, taskId = null }) {
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Task Updated',
|
||||
message: `The requirements for "${taskName}" have been updated by your administrator.`,
|
||||
data: { taskName, taskListId, groupId },
|
||||
data: { taskName, taskListId, groupId, taskId },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
task_submissions_closed: {
|
||||
type: 'task',
|
||||
scope: 'user',
|
||||
trigger: 'event',
|
||||
build({ taskName, taskListId = null, groupId = null, taskId = null }) {
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Submissions Closed',
|
||||
message: `"${taskName}" is no longer accepting submissions.`,
|
||||
data: { taskName, taskListId, groupId, taskId },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
task_submissions_reopened: {
|
||||
type: 'task',
|
||||
scope: 'user',
|
||||
trigger: 'event',
|
||||
build({ taskName, taskListId = null, groupId = null, taskId = null }) {
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Submissions Reopened',
|
||||
message: `"${taskName}" is accepting submissions again.`,
|
||||
data: { taskName, taskListId, groupId, taskId },
|
||||
};
|
||||
},
|
||||
},
|
||||
@@ -108,13 +137,28 @@ const NOTIFICATION_REGISTRY = {
|
||||
type: 'task',
|
||||
scope: 'user',
|
||||
trigger: 'cron',
|
||||
build({ count, task_list_ids = [] }) {
|
||||
build({ count, task_list_ids = [], taskListId = null, taskId = null }) {
|
||||
const label = count === 1 ? '1 task has' : `${count} tasks have`;
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Tasks Overdue',
|
||||
message: `${label} passed their deadline and been marked as overdue.`,
|
||||
data: { count, task_list_ids },
|
||||
data: { count, task_list_ids, taskListId, taskId },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
user_task_auto_completed: {
|
||||
type: 'task',
|
||||
scope: 'user',
|
||||
trigger: 'cron',
|
||||
build({ count, task_list_ids = [], taskListId = null, taskId = null }) {
|
||||
const label = count === 1 ? '1 task has' : `${count} tasks have`;
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Tasks Auto-Completed',
|
||||
message: `${label} passed their deadline and been automatically marked as completed.`,
|
||||
data: { count, task_list_ids, taskListId, taskId },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user