Skip to content

Commit add31ed

Browse files
Merge pull request #181 from codante-io/fix/discord-notification-urls-mini-projects-clean
Fix Discord notification URLs for mini-project lesson comments
2 parents e368bcd + 20c5ee7 commit add31ed

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app/Models/Comment.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,18 @@ public function getCommentableUrl()
9898

9999
if ($this->commentable_type == "App\Models\Lesson") {
100100
$lesson = $this->commentable;
101-
$workshop = $lesson->lessonable;
101+
$lessonable = $lesson->lessonable;
102102
$lessonSlug = $lesson->slug;
103103

104-
return '/workshops/'.$workshop->slug.'/'.$lessonSlug;
104+
// Check if the lesson belongs to a Challenge (mini-projeto)
105+
if ($lessonable instanceof \App\Models\Challenge) {
106+
return '/mini-projetos/'.$lessonable->slug.'/resolucao/'.$lessonSlug;
107+
}
108+
109+
// Check if the lesson belongs to a Workshop
110+
if ($lessonable instanceof \App\Models\Workshop) {
111+
return '/workshops/'.$lessonable->slug.'/'.$lessonSlug;
112+
}
105113
}
106114
}
107115

0 commit comments

Comments
 (0)