Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication: Remove Metis module from the codebase #10195

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

cremertim
Copy link
Contributor

@cremertim cremertim commented Jan 23, 2025

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 and design guidelines.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.

Motivation and Context

We updated to Angular 19 and migrated everything to standalone, but still have leftover old code with modules

Description

This PR removes the Metis module out of the communication code

Steps for Testing

Prerequisites:

  • 1 Student
  1. Log in to Artemis
  2. Navigate into a course
  3. Go to the communication section
  4. Verify you can still interact with post, answer to post and write posts
  5. Write a post into a lecture channel
  6. Go to the lectures tab
  7. Verify you can still see the communication chat there

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2
    -->

Screenshots

image

Summary by CodeRabbit

  • Module Changes

    • Removed MetisModule from multiple modules and test configurations.
    • Updated module dependencies, including the addition of LinkPreviewModule in the CourseOverviewComponent.
  • Component Updates

    • Added PostingThreadComponent and MessageInlineInputComponent to the discussion section.
  • Test Configuration

    • Updated test setups to remove MetisModule references.
    • Added LinkPreviewService and LinkifyService in test configurations.
    • Introduced mock translation service in some test setups.

@cremertim cremertim requested a review from a team as a code owner January 23, 2025 10:54
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Jan 23, 2025
@cremertim cremertim changed the title Remove metis module Communication: Remove Metis module from the code Jan 23, 2025
Copy link

coderabbitai bot commented Jan 23, 2025

Walkthrough

The pull request involves the removal of the MetisModule from multiple files within the application. This includes the deletion of the metis.module.ts file, which contained the MetisModule definition. The MetisModule has been removed from the imports and exports of the ArtemisPlagiarismCasesSharedModule and CourseConversationsModule. Additionally, new components have been added to the DiscussionSectionComponent, and test configurations have been updated to reflect these changes.

Changes

File Path Change Summary
src/main/webapp/app/course/plagiarism-cases/shared/plagiarism-cases-shared.module.ts Removed MetisModule from imports and exports
src/main/webapp/app/overview/course-conversations/course-conversations.module.ts Removed MetisModule import
src/main/webapp/app/overview/discussion-section/discussion-section.component.ts Added imports for PostingThreadComponent and MessageInlineInputComponent
src/main/webapp/app/shared/metis/metis.module.ts Completely removed the module file
src/test/javascript/spec/component/overview/course-conversations/layout/conversation-header/conversation-header.component.spec.ts Removed MetisModule import from test configuration
src/test/javascript/spec/component/shared/metis/postings-header/posting-header.component.spec.ts Added TranslateService provider and removed MetisModule import
src/main/webapp/app/overview/course-overview.component.ts Added LinkPreviewModule import
src/test/javascript/spec/component/overview/discussion-section/discussion-section.component.spec.ts Added providers for LinkPreviewService and LinkifyService

Possibly related PRs

Suggested Labels

ready for review, chore, bugfix, ready to merge

Suggested Reviewers

  • HawKhiem
  • sachmii
  • EneaGore
  • florian-glombik
  • krusche
  • FelberMartin
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 23, 2025
@cremertim cremertim changed the title Communication: Remove Metis module from the code Communication: Remove Metis module from the codebase Jan 23, 2025
@PaRangger PaRangger temporarily deployed to artemis-test2.artemis.cit.tum.de January 23, 2025 12:21 — with GitHub Actions Inactive
Copy link

@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

🧹 Nitpick comments (2)
src/main/webapp/app/overview/course-overview.component.ts (2)

Line range hint 1-1000: Consider splitting this component for better maintainability.

The component has grown quite large and handles multiple responsibilities. Consider the following architectural improvements:

  1. Extract the sidebar logic into a separate component
  2. Move course actions to a dedicated service
  3. Simplify course loading logic using async pipe
  4. Consider using facade pattern to reduce the number of injected dependencies

This will improve maintainability, testability, and make the code more modular.


Line range hint 1-1000: Optimize performance with RxJS operators.

Consider the following performance improvements:

  1. Debounce the window resize event listener to prevent excessive calculations:
+ private readonly RESIZE_DEBOUNCE_TIME = 150;
+
  @HostListener('window:resize')
  onResize() {
+   this.resizeSubject.next();
  }
+
+ private resizeSubject = new Subject<void>();
+
+ ngOnInit() {
+   this.resizeSubject.pipe(
+     debounceTime(this.RESIZE_DEBOUNCE_TIME),
+     takeUntil(this.ngUnsubscribe)
+   ).subscribe(() => {
+     if (this.itemsDrop) {
+       this.updateVisibleNavbarItems(window.innerHeight);
+       if (!this.anyItemHidden) this.itemsDrop.close();
+     }
+   });
  1. Simplify subscription cleanup by consistently using the takeUntil operator with ngUnsubscribe Subject.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9886a9 and 3779373.

📒 Files selected for processing (1)
  • src/main/webapp/app/overview/course-overview.component.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/overview/course-overview.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: server-tests
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Analyse
  • GitHub Check: Build .war artifact

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 23, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 23, 2025
Copy link

@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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c858f50 and 2a454cb.

📒 Files selected for processing (1)
  • src/test/javascript/spec/component/overview/discussion-section/discussion-section.component.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/javascript/spec/component/overview/discussion-section/discussion-section.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-tests-selected
  • GitHub Check: server-tests
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: client-tests
  • GitHub Check: Build .war artifact
  • GitHub Check: Analyse

Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Tested on TS2. Everything works as expected

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!) lock:artemis-test2 tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

3 participants