mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-68931-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
1495cf837e
3 changed files with 49 additions and 2 deletions
|
@ -96,7 +96,7 @@ class core_userfeedback {
|
||||||
public static function should_display_reminder(): bool {
|
public static function should_display_reminder(): bool {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if ($CFG->enableuserfeedback && isloggedin() && !isguestuser()) {
|
if (static::can_give_feedback()) {
|
||||||
$give = get_user_preferences('core_userfeedback_give');
|
$give = get_user_preferences('core_userfeedback_give');
|
||||||
$remind = get_user_preferences('core_userfeedback_remind');
|
$remind = get_user_preferences('core_userfeedback_remind');
|
||||||
|
|
||||||
|
@ -145,6 +145,17 @@ class core_userfeedback {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the current can give feedback.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function can_give_feedback(): bool {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
return $CFG->enableuserfeedback && isloggedin() && !isguestuser();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last major upgrade time
|
* Returns the last major upgrade time
|
||||||
*
|
*
|
||||||
|
|
|
@ -835,7 +835,7 @@ class core_renderer extends renderer_base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isloggedin() && !isguestuser()) {
|
if (core_userfeedback::can_give_feedback()) {
|
||||||
$output .= html_writer::div(
|
$output .= html_writer::div(
|
||||||
$this->render_from_template('core/userfeedback_footer_link', ['url' => core_userfeedback::make_link()->out(false)])
|
$this->render_from_template('core/userfeedback_footer_link', ['url' => core_userfeedback::make_link()->out(false)])
|
||||||
);
|
);
|
||||||
|
|
36
lib/tests/behat/userfeedback.feature
Normal file
36
lib/tests/behat/userfeedback.feature
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
@core
|
||||||
|
Feature: Gathering user feedback
|
||||||
|
In order to facilitate data collection from as broad a sample of Moodle users as possible
|
||||||
|
As Moodle HQ
|
||||||
|
We should add a link within Moodle to a permanent URL on which surveys will be placed
|
||||||
|
|
||||||
|
Scenario: Users should see a feedback link on footer when the feature is enabled
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| enableuserfeedback | 1 |
|
||||||
|
When I log in as "admin"
|
||||||
|
Then I should see "Give feedback" in the "page-footer" "region"
|
||||||
|
|
||||||
|
Scenario: Users should not see a feedback link on footer when the feature is disabled
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| enableuserfeedback | 0 |
|
||||||
|
When I log in as "admin"
|
||||||
|
Then I should not see "Give feedback" in the "page-footer" "region"
|
||||||
|
|
||||||
|
Scenario: Visitors should not see a feedback link on footer when they are not logged in
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| enableuserfeedback | 1 |
|
||||||
|
When I am on site homepage
|
||||||
|
Then I should not see "Give feedback" in the "page-footer" "region"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Users should not see the notification after they click on the remind me later link
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| enableuserfeedback | 1 |
|
||||||
|
| userfeedback_nextreminder | 2 |
|
||||||
|
| userfeedback_remindafter | 90 |
|
||||||
|
When I log in as "admin"
|
||||||
|
And I follow "Dashboard" in the user menu
|
||||||
|
And I click on "Remind me later" "link"
|
||||||
|
And I reload the page
|
||||||
|
Then I should not see "Give feedback" in the "region-main" "region"
|
||||||
|
And I should not see "Remind me later" in the "region-main" "region"
|
Loading…
Add table
Add a link
Reference in a new issue