MDL-71163 mod_forum: Remove duplicate due date info

This commit is contained in:
Shamim Rezaie 2021-04-26 12:05:45 +10:00
parent b23bbc2711
commit 4b593aaeef
2 changed files with 9 additions and 18 deletions

View file

@ -383,23 +383,25 @@ class discussion {
$notifications = $this->notifications; $notifications = $this->notifications;
$discussion = $this->discussion; $discussion = $this->discussion;
$forum = $this->forum; $forum = $this->forum;
$renderer = $this->renderer;
if ($forum->is_cutoff_date_reached()) { if ($forum->is_cutoff_date_reached()) {
$notifications[] = (new notification( $notifications[] = (new notification(
get_string('cutoffdatereached', 'forum'), get_string('cutoffdatereached', 'forum'),
notification::NOTIFY_INFO notification::NOTIFY_INFO
))->set_show_closebutton(); ))->set_show_closebutton();
} else if ($forum->is_due_date_reached()) { } else if ($forum->get_type() != 'single') {
$notifications[] = (new notification( // Due date is already shown at the top of the page for single simple discussion forums.
if ($forum->is_due_date_reached()) {
$notifications[] = (new notification(
get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())), get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
notification::NOTIFY_INFO notification::NOTIFY_INFO
))->set_show_closebutton(); ))->set_show_closebutton();
} else if ($forum->has_due_date()) { } else if ($forum->has_due_date()) {
$notifications[] = (new notification( $notifications[] = (new notification(
get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())), get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
notification::NOTIFY_INFO notification::NOTIFY_INFO
))->set_show_closebutton(); ))->set_show_closebutton();
}
} }
if ($forum->is_discussion_locked($discussion)) { if ($forum->is_discussion_locked($discussion)) {

View file

@ -337,7 +337,6 @@ class discussion_list {
private function get_notifications(stdClass $user, ?int $groupid) : array { private function get_notifications(stdClass $user, ?int $groupid) : array {
$notifications = $this->notifications; $notifications = $this->notifications;
$forum = $this->forum; $forum = $this->forum;
$renderer = $this->renderer;
$capabilitymanager = $this->capabilitymanager; $capabilitymanager = $this->capabilitymanager;
if ($forum->is_cutoff_date_reached()) { if ($forum->is_cutoff_date_reached()) {
@ -345,16 +344,6 @@ class discussion_list {
get_string('cutoffdatereached', 'forum'), get_string('cutoffdatereached', 'forum'),
notification::NOTIFY_INFO notification::NOTIFY_INFO
))->set_show_closebutton(); ))->set_show_closebutton();
} else if ($forum->is_due_date_reached()) {
$notifications[] = (new notification(
get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
notification::NOTIFY_INFO
))->set_show_closebutton();
} else if ($forum->has_due_date()) {
$notifications[] = (new notification(
get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
notification::NOTIFY_INFO
))->set_show_closebutton();
} }
if ($forum->has_blocking_enabled()) { if ($forum->has_blocking_enabled()) {