Skip to content

Conversation

@anian03
Copy link
Member

@anian03 anian03 commented Jan 25, 2026

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding guidelines.
  • I strictly followed the AET UI-UX guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

When mentioning lectures in communication, there can be multiple nested menus. For empty lectures, this often makes no sense as you need to select the lecture twice in order to create a content mention.

Description

For lectures that don't have attachments/units we can mention, we remove the sub-menu for selecting units/attachments as it does not provide any functionality and only adds an additional step for users.

Steps for Testing

Prerequisites:

  • 1 Course with communication enabled
  • 1 User
  • Lecture without attachment units
  • Lecture with attachment unit(s) but no slides, e.g. an image file
  • Lecture with attachment unit with slides, e.g. PDF
  1. Navigate to communication in the course
  2. Select "Lectures" above the text field to mention lectures
  3. For lectures without attachments: Make sure that you can directly click on the lecture in the menu and that no sub-menu opens
  4. For lectures with attachment units: Ensure you can still open the sub-menu to mention specific units. You should be able to reference units without slides directly, and those with slides should still show the sub-menu to pick a slide.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
markdown-editor-monaco.component.ts 95.90% 531 46 8.7
lecture-attachment-reference.action.ts 16.36% 120 ? ?

Last updated: 2026-01-25 18:27:16 UTC

Screenshots

Before

After

Summary by CodeRabbit

  • Bug Fixes
    • Lecture and unit menu items now perform the inline action when no referencable attachments or slides exist, instead of opening empty submenus.
    • Removed the empty-state placeholder from the slides submenu for a cleaner menu experience.

✏️ Tip: You can customize this high-level summary in your review settings.

@anian03 anian03 self-assigned this Jan 25, 2026
@github-project-automation github-project-automation bot moved this to Work In Progress in Artemis Development Jan 25, 2026
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@anian03 anian03 added the communication Pull requests that affect the corresponding module label Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@github-actions github-actions bot removed the communication Pull requests that affect the corresponding module label Jan 25, 2026
@anian03 anian03 added the communication Pull requests that affect the corresponding module label Jan 25, 2026
@anian03 anian03 moved this from Todo to In Progress in Communication Webclient Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de January 25, 2026 17:06 Inactive
@github-actions github-actions bot removed the communication Pull requests that affect the corresponding module label Jan 25, 2026
@anian03 anian03 added the communication Pull requests that affect the corresponding module label Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@github-actions
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed2s 183ms
TestResultTime ⏱
No test annotations available

@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de January 25, 2026 17:33 Inactive
@anian03 anian03 marked this pull request as ready for review January 25, 2026 17:38
@anian03 anian03 requested a review from krusche as a code owner January 25, 2026 17:38
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

Conditional menu triggering was added to the markdown editor: lecture and unit menu triggers now open submenus only when referencable attachments or slides exist, otherwise they execute the current editor action. The LectureWithDetails interface was exported and extended with an optional attachments property.

Changes

Cohort / File(s) Summary
Markdown Editor Template
src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html
Lecture button now uses [matMenuTriggerFor]="hasReferencableAttachments(lecture) ? lectureMenuUnits : undefined" and a click handler to run the editor action when no referencable attachments exist. Attachment units use [matMenuTriggerFor]="unit.slides?.length ? lectureMenuUnitsSlide : undefined" with a click handler to execute ATTACHMENT_UNITS when no slides. Removed slides empty-state placeholder (noItemsAvailable) from slides submenu.
Markdown Editor Component
src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.ts
Added public method hasReferencableAttachments(lecture: LectureWithDetails): boolean that checks for lecture.attachments or any attachmentVideoUnits with a link. Updated import to include LectureWithDetails.
Type Definition
src/main/webapp/app/shared/monaco-editor/model/actions/communication/lecture-attachment-reference.action.ts
Made LectureWithDetails exported and added optional attachments: Attachment[] to the interface.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: simplifying the mention functionality for empty lectures by removing unnecessary submenu steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/communication/simplify-referencing-empty-lectures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html`:
- Around line 187-202: The template currently checks unit.slides truthiness
which treats empty arrays as true; change the conditional on the
matMenuTriggerFor and the click guard to use unit.slides?.length (e.g.,
[matMenuTriggerFor]="unit.slides?.length ? lectureMenuUnitsSlide : null" and the
click short-circuit to !unit.slides?.length) so the submenu
(lectureMenuUnitsSlide) and the click handler using
displayedActions.lecture.executeInCurrentEditor only run when slides exist;
update both occurrences that reference unit.slides in the <button> to use
unit.slides?.length instead.
🧹 Nitpick comments (1)
src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.ts (1)

722-734: Check for non-empty attachments array rather than just truthiness.

The condition !!lecture.attachments on line 728 will return true for an empty array [], potentially causing the submenu to open when there are no attachments to display. Consider checking the array length:

♻️ Suggested improvement
     hasReferencableAttachments(lecture: LectureWithDetails): boolean {
-        const hasAttachments = !!lecture.attachments;
+        const hasAttachments = !!lecture.attachments?.length;
         const hasReferencableAttachmentVideoUnits =
             lecture.attachmentVideoUnits?.some((unit) => {
                 return unit.attachment && unit.attachment.link;
-            }) === true;
+            }) ?? false;
         return hasAttachments || hasReferencableAttachmentVideoUnits;
     }

Also, the === true comparison is redundant since ?.some() already returns boolean | undefined, and the nullish coalescing (?? false) is cleaner than strict equality.

@github-project-automation github-project-automation bot moved this from Work In Progress to Ready For Review in Artemis Development Jan 25, 2026
@github-actions github-actions bot removed the communication Pull requests that affect the corresponding module label Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@github-actions
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed1s 908ms
TestResultTime ⏱
No test annotations available

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 25, 2026
@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@github-actions
Copy link

@anian03 Test coverage has been automatically updated in the PR description.

@github-actions
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report223 ran220 passed1 skipped2 failed1h 37m 39s 323ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to write message in channel❌ failure2m 22s 950ms
e2e/exam/ExamTestRun.spec.ts
ts.Exam test run › Delete a test run › Deletes a test run❌ failure2m 39s 189ms

@helios-aet helios-aet bot temporarily deployed to artemis-test4.artemis.cit.tum.de January 26, 2026 13:53 Inactive
Copy link
Contributor

@matyasht matyasht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good and works as described

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests that update TypeScript code. (Added Automatically!) ready for review

Projects

Status: Ready For Review
Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants