Skip to content

Commit e6d3763

Browse files
committed
remove unecessary and wrong exception throw
1 parent 81822ec commit e6d3763

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

classes/post/post_control.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ private function check_post_exists(int $postid): object {
831831
*/
832832
private function check_user_can_create_discussion(): void {
833833
if (!has_capability('mod/moodleoverflow:startdiscussion', $this->info->modulecontext)) {
834-
throw new moodle_exception('cannotcreatediscussion', 'moodleoverflow');
834+
throw new moodle_exception('nopostmoodleoverflow', 'moodleoverflow');
835835
}
836836
}
837837

@@ -894,8 +894,6 @@ private function catch_unenrolled(): void {
894894
'returnurl' => '/mod/moodleoverflow/view.php?m=' . $this->info->moodleoverflow->id, ]),
895895
get_string('youneedtoenrol'));
896896
}
897-
// Notify the user, that he can not post a new discussion.
898-
throw new moodle_exception('nopostmoodleoverflow', 'moodleoverflow');
899897
}
900898
}
901899
}

0 commit comments

Comments
 (0)