From 1c547f33b6469098f408ce63fffa85e73c26f15d Mon Sep 17 00:00:00 2001 From: Tobias Messner Date: Mon, 23 Sep 2024 14:16:06 +0200 Subject: [PATCH] fix: Disable Feedback Prompt when logged out, Change order of buttons Fix a bug where the interval feedback prompt would be shown, even when the user is not logged in. Restore the original order of the feedback buttons by changing the server-side enum. --- backend/capellacollab/feedback/models.py | 4 ++-- frontend/src/app/app.component.ts | 7 ++++++- frontend/src/app/openapi/model/feedback-rating.ts | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/capellacollab/feedback/models.py b/backend/capellacollab/feedback/models.py index fc4b234f3..81d28d19c 100644 --- a/backend/capellacollab/feedback/models.py +++ b/backend/capellacollab/feedback/models.py @@ -13,9 +13,9 @@ class FeedbackRating(str, enum.Enum): - GOOD = "good" - OKAY = "okay" BAD = "bad" + OKAY = "okay" + GOOD = "good" class AnonymizedSession(core_pydantic.BaseModel): diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 8479de069..8f64b98d1 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -18,6 +18,7 @@ import { HeaderComponent } from './general/header/header.component'; import { NavBarMenuComponent } from './general/nav-bar-menu/nav-bar-menu.component'; import { NoticeComponent } from './general/notice/notice.component'; import { PageLayoutService } from './page-layout/page-layout.service'; +import { AuthenticationWrapperService } from './services/auth/auth.service'; import { FeedbackWrapperService } from './sessions/feedback/feedback.service'; import { FullscreenService } from './sessions/service/fullscreen.service'; @@ -46,6 +47,7 @@ export class AppComponent implements OnInit, AfterViewInit { public fullscreenService: FullscreenService, private navBarService: NavBarService, private feedbackService: FeedbackWrapperService, + private authService: AuthenticationWrapperService, ) { slugify.extend({ '.': '-' }); } @@ -54,7 +56,10 @@ export class AppComponent implements OnInit, AfterViewInit { async ngOnInit() { this.feedbackService.loadFeedbackConfig().subscribe(() => { - if (this.feedbackService.shouldShowIntervalPrompt()) { + if ( + this.feedbackService.shouldShowIntervalPrompt() && + this.authService.isLoggedIn() + ) { this.feedbackService.showDialog([], 'On interval'); this.feedbackService.saveFeedbackPromptDate(); } diff --git a/frontend/src/app/openapi/model/feedback-rating.ts b/frontend/src/app/openapi/model/feedback-rating.ts index 16b48081d..589acd144 100644 --- a/frontend/src/app/openapi/model/feedback-rating.ts +++ b/frontend/src/app/openapi/model/feedback-rating.ts @@ -11,11 +11,11 @@ -export type FeedbackRating = 'good' | 'okay' | 'bad'; +export type FeedbackRating = 'bad' | 'okay' | 'good'; export const FeedbackRating = { - Good: 'good' as FeedbackRating, + Bad: 'bad' as FeedbackRating, Okay: 'okay' as FeedbackRating, - Bad: 'bad' as FeedbackRating + Good: 'good' as FeedbackRating };