Skip to content

Commit ea79ad9

Browse files
committed
Minor style fixes (leave the code better than it was...)
1 parent db592e0 commit ea79ad9

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

classes/review.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public static function get_first_review_post($moodleoverflowid, $afterpostid = n
9393
$afterdiscussionid = $DB->get_field('moodleoverflow_posts', 'discussion', ['id' => $afterpostid],
9494
MUST_EXIST);
9595

96-
$orderby = 'CASE WHEN (p.discussion > :afterdiscussionid OR (p.discussion = :afterdiscussionid2 AND p.id > :afterpostid)) THEN 0 ELSE 1 END, ';
96+
$orderby = 'CASE WHEN (p.discussion > :afterdiscussionid OR (p.discussion = :afterdiscussionid2 AND p.id
97+
> :afterpostid)) THEN 0 ELSE 1 END, ';
9798
$params['afterdiscussionid'] = $afterdiscussionid;
9899
$params['afterdiscussionid2'] = $afterdiscussionid;
99100
$params['afterpostid'] = $afterpostid;

grade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424
require_once(__DIR__ . "/../../config.php");
25-
25+
require_login();
2626
$id = required_param('id', PARAM_INT);
2727

2828
$cm = get_coursemodule_from_id('moodleoverflow', $id, 0, false, MUST_EXIST);

lang/en/moodleoverflow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
$string['gradesupdated'] = 'Grades updated';
406406
$string['taskupdategrades'] = 'Moodleoverflow maintenance job to update grades';
407407

408-
// Anonymous Feature
408+
// Anonymous Feature.
409409
$string['anonymous'] = 'Anonymous';
410410
$string['anonymous_help'] = 'This will hide username from all question (and answers).<br>WARNING: Once the questions (and answers) are anonymized, this cannot be reversed.<br>The setting can only be changed to a higher degree of anonymity.';
411411
$string['anonymous:only_questions'] = 'Only questioners (Irreversible!)';
@@ -419,7 +419,7 @@
419419
$string['desc:anonymous'] = 'No names will be displayed.';
420420
$string['resetanonymous_warning'] = 'Are you sure? If you are in production, <b>this is most certainly a bad decision</b> because your students and teachers posted their questions and answers, believing they would remain anonymous. <br><br><b>{$a->fullanoncount}</b> forums are currently fully anonymized, and in <b>{$a->questionanoncount}</b> additional forums the questioners are anonymized.<br><br><b>In all these forums, the real names of posters will be displayed again, even in already existing posts!</b><br><br>There is no way of reverting those changes!</br>';
421421

422-
// Review feature
422+
// Review feature.
423423
$string['review'] = 'Review';
424424
$string['reviewpost'] = 'Review a post';
425425
$string['review_help'] = 'Select what has to be approved by a teacher before being shown to students.';

locallib.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,8 @@ function moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discuss
907907
echo '<div id="moodleoverflow-posts">';
908908

909909
// Print the other posts.
910-
echo moodleoverflow_print_posts_nested($course, $cm, $moodleoverflow, $discussion, $post, $istracked, $posts, null, $usermapping);
910+
echo moodleoverflow_print_posts_nested($course, $cm, $moodleoverflow, $discussion, $post, $istracked, $posts,
911+
null, $usermapping);
911912

912913
echo '</div>';
913914
}
@@ -1599,7 +1600,7 @@ function moodleoverflow_add_new_post($post) {
15991600

16001601
// Add the post to the database.
16011602
$post->id = $DB->insert_record('moodleoverflow_posts', $post);
1602-
$DB->set_field('moodleoverflow_posts', 'message', $post->message, array('id' => $post->id)); // ??
1603+
$DB->set_field('moodleoverflow_posts', 'message', $post->message, array('id' => $post->id));
16031604
moodleoverflow_add_attachment($post, $moodleoverflow, $cm);
16041605

16051606
if ($post->reviewed) {
@@ -1819,7 +1820,7 @@ function moodleoverflow_discussion_update_last_post($discussionid) {
18191820
return false;
18201821
}
18211822

1822-
// Find the last reviewed post of the discussion. (even if user has review capability, because it is written to DB)
1823+
// Find the last reviewed post of the discussion. (even if user has review capability, because it is written to DB).
18231824
$sql = "SELECT id, userid, modified
18241825
FROM {moodleoverflow_posts}
18251826
WHERE discussion = ?

markposts.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
}
107107

108108
// Mark all the discussions read.
109-
if (!\mod_moodleoverflow\readtracking::moodleoverflow_mark_discussion_read($discussionid, context_module::instance($cm->id), $user->id)) {
109+
if (!\mod_moodleoverflow\readtracking::moodleoverflow_mark_discussion_read($discussionid,
110+
context_module::instance($cm->id), $user->id)) {
110111

111112
// Display an error, if something failes.
112113
$message = get_string('markreadfailed', 'moodleoverflow');

settings.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@
9797
$settings->add(new admin_setting_configcheckbox('moodleoverflow/allowreview',
9898
get_string('allowreview', 'moodleoverflow'), get_string('allowreview_desc', 'moodleoverflow'), 1));
9999

100-
$settings->add(new admin_setting_configtext('moodleoverflow/reviewpossibleaftertime', get_string('reviewpossibleaftertime', 'moodleoverflow'),
101-
get_string('reviewpossibleaftertime_desc', 'moodleoverflow'), 1800, PARAM_INT));
100+
$settings->add(new admin_setting_configtext('moodleoverflow/reviewpossibleaftertime',
101+
get_string('reviewpossibleaftertime', 'moodleoverflow'),
102+
get_string('reviewpossibleaftertime_desc', 'moodleoverflow'), 1800, PARAM_INT));
102103

103104
// Set scales for the reputation.
104105
$votesettings = [];

tests/locallib_test.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function tearDown(): void {
4444

4545
/**
4646
* Test subscription using automatic subscription on create.
47+
* @covers \mod_moodleoverflow\subscriptions Subscription of users as default.
4748
*/
4849
public function test_moodleoverflow_auto_subscribe_on_create() {
4950
global $DB;
@@ -76,6 +77,7 @@ public function test_moodleoverflow_auto_subscribe_on_create() {
7677

7778
/**
7879
* Test subscription using forced subscription on create.
80+
* @covers \mod_moodleoverflow\subscriptions sorced Subscription of users.
7981
*/
8082
public function test_moodleoverflow_forced_subscribe_on_create() {
8183
global $DB;
@@ -107,6 +109,7 @@ public function test_moodleoverflow_forced_subscribe_on_create() {
107109

108110
/**
109111
* Test subscription using optional subscription on create.
112+
* @covers \mod_moodleoverflow\subscriptions optional subscription.
110113
*/
111114
public function test_moodleoverflow_optional_subscribe_on_create() {
112115
global $DB;
@@ -137,6 +140,7 @@ public function test_moodleoverflow_optional_subscribe_on_create() {
137140

138141
/**
139142
* Test subscription using disallow subscription on create.
143+
* @covers \mod_moodleoverflow\subscriptions prohibit Subscription of users.
140144
*/
141145
public function test_moodleoverflow_disallow_subscribe_on_create() {
142146
global $DB;

0 commit comments

Comments
 (0)