-
Notifications
You must be signed in to change notification settings - Fork 294
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
: Fix reply button message editing issue in exercise view
#9815
base: develop
Are you sure you want to change the base?
Changes from 4 commits
4860e4c
0b609dc
485e048
9f255f2
c0c553d
b4a0e9f
5d4c4e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -11,6 +11,7 @@ import { | |||||||||||||||||||||||||||||||||
SimpleChanges, | ||||||||||||||||||||||||||||||||||
ViewChild, | ||||||||||||||||||||||||||||||||||
ViewContainerRef, | ||||||||||||||||||||||||||||||||||
input, | ||||||||||||||||||||||||||||||||||
} from '@angular/core'; | ||||||||||||||||||||||||||||||||||
import { PostingFooterDirective } from 'app/shared/metis/posting-footer/posting-footer.directive'; | ||||||||||||||||||||||||||||||||||
import { Post } from 'app/entities/metis/post.model'; | ||||||||||||||||||||||||||||||||||
|
@@ -36,7 +37,6 @@ export class PostFooterComponent extends PostingFooterDirective<Post> implements | |||||||||||||||||||||||||||||||||
@Input() readOnlyMode = false; | ||||||||||||||||||||||||||||||||||
@Input() previewMode = false; | ||||||||||||||||||||||||||||||||||
@Input() modalRef?: NgbModalRef; | ||||||||||||||||||||||||||||||||||
@Input() hasChannelModerationRights = false; | ||||||||||||||||||||||||||||||||||
@Input() showAnswers = false; | ||||||||||||||||||||||||||||||||||
@Input() isCommunicationPage = false; | ||||||||||||||||||||||||||||||||||
@Input() sortedAnswerPosts: AnswerPost[] = []; | ||||||||||||||||||||||||||||||||||
|
@@ -48,6 +48,7 @@ export class PostFooterComponent extends PostingFooterDirective<Post> implements | |||||||||||||||||||||||||||||||||
@ViewChild(AnswerPostCreateEditModalComponent) answerPostCreateEditModal?: AnswerPostCreateEditModalComponent; | ||||||||||||||||||||||||||||||||||
@ViewChild('createEditAnswerPostContainer', { read: ViewContainerRef }) containerRef!: ViewContainerRef; | ||||||||||||||||||||||||||||||||||
@ViewChild('createAnswerPostModal') createAnswerPostModalComponent!: AnswerPostCreateEditModalComponent; | ||||||||||||||||||||||||||||||||||
hasChannelModerationRights = input<boolean>(false); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
createdAnswerPost: AnswerPost; | ||||||||||||||||||||||||||||||||||
isAtLeastTutorInCourse = false; | ||||||||||||||||||||||||||||||||||
|
@@ -173,6 +174,13 @@ export class PostFooterComponent extends PostingFooterDirective<Post> implements | |||||||||||||||||||||||||||||||||
this.createAnswerPostModalComponent.open(); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||
* Close create answer modal | ||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||
closeCreateAnswerPostModal() { | ||||||||||||||||||||||||||||||||||
this.createAnswerPostModalComponent.close(); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
Comment on lines
+176
to
+181
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for modal component. While the method implementation is straightforward, it should handle cases where Consider this safer implementation: closeCreateAnswerPostModal() {
- this.createAnswerPostModalComponent.close();
+ if (this.createAnswerPostModalComponent) {
+ this.createAnswerPostModalComponent.close();
+ } else {
+ console.warn('Modal component is not initialized');
+ }
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
protected postsTrackByFn(index: number, post: Post): number { | ||||||||||||||||||||||||||||||||||
return post.id!; | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Inconsistent permission check implementations found
The following files still use property binding instead of method invocation for
hasChannelModerationRights
:src/main/webapp/app/shared/metis/posting-thread/posting-thread.component.html
src/main/webapp/app/overview/course-conversations/layout/conversation-thread-sidebar/conversation-thread-sidebar.component.html
These components should be updated to use method invocation
hasChannelModerationRights()
for consistent permission evaluation across the application.🔗 Analysis chain
Verify permission check consistency across components.
The change from property binding to method invocation for
hasChannelModerationRights
aligns with the PR objective of fixing edit/delete permissions. This ensures that permissions are always freshly evaluated.Let's verify that this change is consistent across all components:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1144