From 69fe8e0240b6b80076c548aac282af4177b11a09 Mon Sep 17 00:00:00 2001 From: Asli Aykan Date: Mon, 3 Feb 2025 01:40:37 +0100 Subject: [PATCH] update type sorting --- .../webapp/app/shared/metis/metis.service.ts | 3 +- .../posting-reactions-bar.component.ts | 70 +++++++++---------- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/src/main/webapp/app/shared/metis/metis.service.ts b/src/main/webapp/app/shared/metis/metis.service.ts index 81b80e464a0b..ab87f02748f2 100644 --- a/src/main/webapp/app/shared/metis/metis.service.ts +++ b/src/main/webapp/app/shared/metis/metis.service.ts @@ -46,6 +46,7 @@ export class MetisService implements OnDestroy { private jhiWebsocketService = inject(WebsocketService); private conversationService = inject(ConversationService); private forwardedMessageService = inject(ForwardedMessageService); + private savedPostService: SavedPostService = inject(SavedPostService); private posts$: ReplaySubject = new ReplaySubject(1); private tags$: BehaviorSubject = new BehaviorSubject([]); @@ -59,9 +60,7 @@ export class MetisService implements OnDestroy { private cachedPosts: Post[] = []; private cachedTotalNumberOfPosts: number; private subscriptionChannel?: string; - private courseWideTopicSubscription: Subscription; - private savedPostService: SavedPostService = inject(SavedPostService); course: Course; diff --git a/src/main/webapp/app/shared/metis/posting-reactions-bar/posting-reactions-bar.component.ts b/src/main/webapp/app/shared/metis/posting-reactions-bar/posting-reactions-bar.component.ts index 833e80d22238..4a235de5b014 100644 --- a/src/main/webapp/app/shared/metis/posting-reactions-bar/posting-reactions-bar.component.ts +++ b/src/main/webapp/app/shared/metis/posting-reactions-bar/posting-reactions-bar.component.ts @@ -87,32 +87,40 @@ interface ReactionMetaDataMap { ], }) export class PostingReactionsBarComponent implements OnInit, OnChanges { - private metisService = inject(MetisService); - private accountService = inject(AccountService); - private conversationService: ConversationService = inject(ConversationService); - private modalService: NgbModal = inject(NgbModal); - private metisConversationService: MetisConversationService = inject(MetisConversationService); + readonly onBookmarkClicked = output(); + readonly DisplayPriority = DisplayPriority; + readonly faBookmark = faBookmark; + readonly faSmile = faSmile; + readonly faCheck = faCheck; + readonly faPencilAlt = faPencilAlt; + readonly faArrowRight = faArrowRight; + readonly faTrash = faTrashAlt; + readonly faShare = faShare; pinEmojiId: string = PIN_EMOJI_ID; archiveEmojiId: string = ARCHIVE_EMOJI_ID; closeCrossId: string = HEAVY_MULTIPLICATION_ID; - + showReactionSelector = false; + isAtLeastTutorInCourse: boolean; + isAuthorOfPosting: boolean; + isAuthorOfOriginalPost: boolean; + isAnswerOfAnnouncement: boolean; + isAtLeastInstructorInCourse: boolean; + mayEdit: boolean; + mayDelete: boolean; + pinTooltip: string; + displayPriority: DisplayPriority; + canPin = false; + channels: ChannelDTO[] = []; + users: UserPublicInfoDTO[] = []; posting = input(); isThreadSidebar = input(); isEmojiCount = input(false); isReadOnlyMode = input(false); - openPostingCreateEditModal = output(); closePostingCreateEditModal = output(); reactionsUpdated = output(); isModalOpen = output(); - - showReactionSelector = false; - isAtLeastTutorInCourse: boolean; - isAuthorOfPosting: boolean; - isAuthorOfOriginalPost: boolean; - isAnswerOfAnnouncement: boolean; - isAtLeastInstructorInCourse: boolean; mayDeleteOutput = output(); mayEditOutput = output(); canPinOutput = output(); @@ -122,36 +130,21 @@ export class PostingReactionsBarComponent implements OnInit, lastReadDate = input(); previewMode = input(); hoverBar = input(true); - showAnswersChange = output(); isLastAnswer = input(false); postingUpdated = output(); - mayEdit: boolean; - mayDelete: boolean; - pinTooltip: string; - displayPriority: DisplayPriority; - canPin = false; - readonly DisplayPriority = DisplayPriority; - channels: ChannelDTO[] = []; - users: UserPublicInfoDTO[] = []; - - isDeleteEvent = output(); - readonly onBookmarkClicked = output(); openThread = output(); originalPostDetails = input(); course = input(); - - // Icons - readonly faBookmark = faBookmark; - readonly faSmile = faSmile; - readonly faCheck = faCheck; - readonly faPencilAlt = faPencilAlt; - readonly faArrowRight = faArrowRight; - readonly faTrash = faTrashAlt; - readonly faShare = faShare; - + isDeleteEvent = output(); createEditModal = viewChild.required('createEditModal'); + private metisService = inject(MetisService); + private accountService = inject(AccountService); + private conversationService: ConversationService = inject(ConversationService); + private modalService: NgbModal = inject(NgbModal); + private metisConversationService: MetisConversationService = inject(MetisConversationService); + /** * on initialization: updates the current posting and its reactions, * invokes metis service to check user authority @@ -466,10 +459,11 @@ export class PostingReactionsBarComponent implements OnInit, * Uses openForwardMessageView from PostingsReactionsBarDirective to show the forward dialog. */ forwardMessage(): void { + const isAnswer = this.getPostingType() === 'answerPost'; if (!this.posting()!.content || this.posting()!.content === '') { - this.openForwardMessageView(this.originalPostDetails()!, false); + this.openForwardMessageView(this.originalPostDetails()!, isAnswer); } else { - this.openForwardMessageView(this.posting()!, false); + this.openForwardMessageView(this.posting()!, isAnswer); } }