Skip to content

Conversation

@jr-rk
Copy link

@jr-rk jr-rk commented Dec 18, 2025

Problem description

Changed hardcoded email value to email saved in config on BE (mail.helpdesk)

Sync verification

If en.json5 or cs.json5 translation files were updated:

  • Run yarn run sync-i18n -t src/assets/i18n/cs.json5 -i to synchronize messages, and changes are included in this PR.

Copilot review

  • Requested review from Copilot

@jr-rk jr-rk requested a review from Copilot December 18, 2025 15:47
@jr-rk jr-rk self-assigned this Dec 18, 2025
@jr-rk jr-rk linked an issue Dec 18, 2025 that may be closed by this pull request
8 tasks
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces a hardcoded email address ([email protected]) with a dynamic value retrieved from the backend configuration (mail.helpdesk). The change makes the contact email configurable rather than hardcoded in the translation files.

  • Fetches the help desk email from backend configuration service during component initialization
  • Updates translation strings to use template interpolation for the email parameter
  • Adds AsyncPipe and necessary imports to support the dynamic email display

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/home-page/home-news/home-news.component.ts Adds configuration service injection, fetches email from config, and stores it in a BehaviorSubject
src/app/home-page/home-news/home-news.component.html Updates template to conditionally display the upload info paragraph with interpolated email value
src/themes/custom/app/home-page/home-news/home-news.component.ts Adds AsyncPipe import to support the template changes in the themed version
src/assets/i18n/en.json5 Updates English translation to use {{ email }} placeholder instead of hardcoded email
src/assets/i18n/cs.json5 Updates Czech translation to use {{ email }} placeholder instead of hardcoded email

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 33 to 34
this.configService.findByPropertyName('mail.helpdesk').subscribe(remoteData => {
this.emailToContact$.next(remoteData?.payload?.values?.[0] || '');
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Consider handling error cases when the configuration service call fails. If the service throws an error or the property doesn't exist, the user will see no email at all. Adding error handling would provide a better user experience, such as falling back to a default email or logging the error for debugging.

Suggested change
this.configService.findByPropertyName('mail.helpdesk').subscribe(remoteData => {
this.emailToContact$.next(remoteData?.payload?.values?.[0] || '');
this.configService.findByPropertyName('mail.helpdesk').subscribe({
next: (remoteData) => {
this.emailToContact$.next(remoteData?.payload?.values?.[0] || '');
},
error: (error) => {
// Log error and fall back to an empty email to avoid breaking the UI
console.error('Failed to load mail.helpdesk configuration', error);
this.emailToContact$.next('');
},

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

@milanmajchrak we dont do this anywhere - is it necessary? should i implement it?

… memory leaks by implementing takeUntilDestroy; removed unnecessary BehaviourSubject and async usage
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jr-rk jr-rk requested a review from milanmajchrak December 18, 2025 16:53
Copy link
Collaborator

@milanmajchrak milanmajchrak left a comment

Choose a reason for hiding this comment

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

Use async

) {}

ngOnInit(): void {
this.configService.findByPropertyName('mail.helpdesk')
Copy link
Collaborator

@milanmajchrak milanmajchrak Dec 19, 2025

Choose a reason for hiding this comment

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

emailToContact$ = this.configService.findByPropertyName('mail.helpdesk')
  .pipe(map(remoteData => remoteData?.payload?.values?.[0] || ''));

</p>
<p [innerHTML]="'home.news.about-link' | translate"></p>
<p [innerHTML]="'home.news.upload-info' | translate"></p>
@if (emailToContact !== '') {
Copy link
Collaborator

@milanmajchrak milanmajchrak Dec 19, 2025

Choose a reason for hiding this comment

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

<!-- Template -->
@if (emailToContact$ | async; as email) {
  @if (email !== '') {
    <p [innerHTML]="'home.news.upload-info' | translate : { email }"></p>
  } @else {
    <p [innerHTML]="'home.news.upload-info-no-email' | translate"></p>
  }
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MENDELU/UI fixes (v2) - their demanded changes before deploy

3 participants