Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/ratings.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ public static function moodleoverflow_user_can_rate($post, $modulecontext, $user
}

// Check the capability.
return $userid != $post->userid && capabilities::has(capabilities::RATE_POST, $modulecontext, $userid)
return capabilities::has(capabilities::RATE_POST, $modulecontext, $userid)
&& $post->reviewed == 1;
}

Expand Down
3 changes: 2 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ function moodleoverflow_print_latest_discussions($moodleoverflow, $cm, $page = -

$preparedarray[$i]['userupvoted'] = ($rating->rating ?? null) == RATING_UPVOTE;
$preparedarray[$i]['userdownvoted'] = ($rating->rating ?? null) == RATING_DOWNVOTE;
$preparedarray[$i]['canchange'] = \mod_moodleoverflow\ratings::moodleoverflow_user_can_rate($firstpost, $context);
$preparedarray[$i]['canchange'] = \mod_moodleoverflow\ratings::moodleoverflow_user_can_rate($firstpost, $context) &&
$startuser->id != $USER->id;
$preparedarray[$i]['postid'] = $discussion->firstpost;

// Go to the next discussion.
Expand Down