MDL-68991 core: Prevent popup blockers blocking feedback window

Some browsers like Firefox are very inflexible with window.open()
and block it if it is not instantly invoked after the user click.

Also according to https://stackoverflow.com/a/6807615 it is best
practice to replace self:: with static::
This commit is contained in:
Shamim Rezaie
2020-06-10 16:10:53 +10:00
parent 4cdcd23fb2
commit 292a67aede
5 changed files with 27 additions and 29 deletions
+5 -5
View File
@@ -57,9 +57,9 @@ class core_userfeedback {
$actions = [
[
'title' => get_string('calltofeedback_give'),
'url' => '#',
'url' => static::make_link()->out(false),
'data' => [
'action' => 'give',
'action' => 'give',
'record' => 1,
'hide' => 1,
],
@@ -103,13 +103,13 @@ class core_userfeedback {
$lastactiontime = max($give ?: 0, $remind ?: 0);
switch ($CFG->userfeedback_nextreminder) {
case self::REMIND_AFTER_UPGRADE:
$lastupgrade = self::last_major_upgrade_time();
case static::REMIND_AFTER_UPGRADE:
$lastupgrade = static::last_major_upgrade_time();
if ($lastupgrade >= $lastactiontime) {
return $lastupgrade + ($CFG->userfeedback_remindafter * DAYSECS) < time();
}
break;
case self::REMIND_PERIODICALLY:
case static::REMIND_PERIODICALLY:
return $lastactiontime + ($CFG->userfeedback_remindafter * DAYSECS) < time();
break;
}