diff --git a/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html b/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
new file mode 100644
index 00000000000..33c4de92e5b
--- /dev/null
+++ b/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
@@ -0,0 +1,139 @@
+
+
+
+
+ account_circle
+
+
+
{{ response.usernames }}
+
+
+
+
+
+ @if (
+ response.latestInappropriateFlagAnnotation == null ||
+ response.latestInappropriateFlagAnnotation.data == null ||
+ response.latestInappropriateFlagAnnotation.data.action != 'Delete'
+ ) {
+
+ } @else if (
+ response.latestInappropriateFlagAnnotation != null &&
+ response.latestInappropriateFlagAnnotation.data.action === 'Delete'
+ ) {
+
+ }
+
+
+ @for (attachment of response.studentData.attachments; track attachment) {
+
![Post attachment]()
+ }
+
+ @if (response.replies.length > 0) {
+
+ @if (mode === 'student' || response.replies.length > 0) {
+
+ }
+
+
+
+ }
+
diff --git a/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.ts b/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.ts
new file mode 100644
index 00000000000..425ced725d7
--- /dev/null
+++ b/src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.ts
@@ -0,0 +1,57 @@
+import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
+import { getAvatarColorForWorkgroupId } from '../../../common/workgroup/workgroup';
+import { CdkTextareaAutosize, TextFieldModule } from '@angular/cdk/text-field';
+import { SaveTimeMessageComponent } from '../../../common/save-time-message/save-time-message.component';
+import { RouterModule } from '@angular/router';
+import { MatDividerModule } from '@angular/material/divider';
+import { MatCardModule } from '@angular/material/card';
+import { MatButtonModule } from '@angular/material/button';
+import { FormsModule } from '@angular/forms';
+import { CommonModule } from '@angular/common';
+import { MatIconModule } from '@angular/material/icon';
+import { MatTooltipModule } from '@angular/material/tooltip';
+import { ClassResponse } from '../class-response/class-response.component';
+
+@Component({
+ encapsulation: ViewEncapsulation.None,
+ imports: [
+ CdkTextareaAutosize,
+ CommonModule,
+ FormsModule,
+ MatButtonModule,
+ MatCardModule,
+ MatDividerModule,
+ MatIconModule,
+ MatTooltipModule,
+ RouterModule,
+ SaveTimeMessageComponent,
+ TextFieldModule
+ ],
+ selector: 'class-response-teacher',
+ styleUrl: '../class-response/class-response.component.scss',
+ templateUrl: './class-response-teacher.component.html'
+})
+export class ClassResponseTeacherComponent extends ClassResponse {
+ @Output() hidePostEvent: any = new EventEmitter();
+ @Input() isDisabled: boolean;
+ @Input() mode: any;
+ @Input() numReplies: number;
+ @Input() response: any;
+ @Output() showPostEvent: any = new EventEmitter();
+ @Output() submitButtonClicked: any = new EventEmitter();
+
+ protected expanded: boolean = false;
+ protected repliesToShow: any[] = [];
+
+ protected hidePost(componentState: any): void {
+ if (confirm($localize`Are you sure you want to hide this content?`)) {
+ this.hidePostEvent.emit(componentState);
+ }
+ }
+
+ protected showPost(componentState: any): void {
+ if (confirm($localize`Are you sure you want to show this content?`)) {
+ this.showPostEvent.emit(componentState);
+ }
+ }
+}
diff --git a/src/assets/wise5/components/discussion/class-response/class-response.component.html b/src/assets/wise5/components/discussion/class-response/class-response.component.html
index f75ab7ea147..28f2ab32c59 100644
--- a/src/assets/wise5/components/discussion/class-response/class-response.component.html
+++ b/src/assets/wise5/components/discussion/class-response/class-response.component.html
@@ -22,44 +22,6 @@
@for (attachment of response.studentData.attachments; track attachment) {
}
- @if (mode === 'grading' || mode === 'gradingRevision') {
-
- @if (
- (response.latestInappropriateFlagAnnotation == null ||
- response.latestInappropriateFlagAnnotation.data.action !== 'Delete') &&
- (reply.latestInappropriateFlagAnnotation == null ||
- reply.latestInappropriateFlagAnnotation.data.action != 'Delete')
- ) {
-
- }
- @if (
- response.latestInappropriateFlagAnnotation != null &&
- response.latestInappropriateFlagAnnotation.data.action === 'Delete'
- ) {
-
- Parent Deleted
-
- }
- @if (
- reply.latestInappropriateFlagAnnotation != null &&
- reply.latestInappropriateFlagAnnotation.data.action === 'Delete'
- ) {
-
- }
-
- }
}
diff --git a/src/assets/wise5/components/discussion/class-response/class-response.component.scss b/src/assets/wise5/components/discussion/class-response/class-response.component.scss
index cf1a65b1dec..297794849e2 100644
--- a/src/assets/wise5/components/discussion/class-response/class-response.component.scss
+++ b/src/assets/wise5/components/discussion/class-response/class-response.component.scss
@@ -74,4 +74,8 @@
outline: none;
}
}
+
+ .mat-icon {
+ vertical-align: top;
+ }
}
diff --git a/src/assets/wise5/components/discussion/class-response/class-response.component.ts b/src/assets/wise5/components/discussion/class-response/class-response.component.ts
index 7e3f29bb74f..d407a21fe7e 100644
--- a/src/assets/wise5/components/discussion/class-response/class-response.component.ts
+++ b/src/assets/wise5/components/discussion/class-response/class-response.component.ts
@@ -39,7 +39,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
templateUrl: 'class-response.component.html'
})
export class ClassResponse {
- @Output() deleteButtonClicked: any = new EventEmitter();
protected expanded: boolean = false;
@Input() isDisabled: boolean;
@Input() mode: any;
@@ -47,7 +46,6 @@ export class ClassResponse {
protected repliesToShow: any[] = [];
@Input() response: any;
@Output() submitButtonClicked: any = new EventEmitter();
- @Output() undoDeleteButtonClicked: any = new EventEmitter();
private urlMatcher: any =
/((http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?)/g;
@@ -123,18 +121,6 @@ export class ClassResponse {
return responseText.substring(0, responseText.length - 1);
}
- protected delete(componentState: any): void {
- if (confirm($localize`Are you sure you want to delete this post?`)) {
- this.deleteButtonClicked.emit(componentState);
- }
- }
-
- protected undoDelete(componentState: any): void {
- if (confirm($localize`Are you sure you want to show this post?`)) {
- this.undoDeleteButtonClicked.emit(componentState);
- }
- }
-
protected toggleExpanded(): void {
this.expanded = !this.expanded;
if (this.expanded) {
diff --git a/src/assets/wise5/components/discussion/discussion-show-work/discussion-show-work.component.html b/src/assets/wise5/components/discussion/discussion-show-work/discussion-show-work.component.html
index e61a8e4528d..b6c98a1db9a 100644
--- a/src/assets/wise5/components/discussion/discussion-show-work/discussion-show-work.component.html
+++ b/src/assets/wise5/components/discussion/discussion-show-work/discussion-show-work.component.html
@@ -5,8 +5,8 @@
[response]="componentState"
[numReplies]="componentState.replies.length"
[mode]="'grading'"
- (deleteButtonClicked)="hidePost($event)"
- (undoDeleteButtonClicked)="showPost($event)"
+ (hidePostEvent)="hidePost($event)"
+ (showPostEvent)="showPost($event)"
[isDisabled]="true"
class="post"
/>
diff --git a/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html b/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
index 807b3f1acd0..7027f19b18a 100644
--- a/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
+++ b/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
@@ -1,6 +1,4 @@
-@if (mode !== 'summary') {
-
@if (mode === 'student') {
@@ -112,8 +108,6 @@
[numReplies]="componentState.replies.length"
(submitButtonClicked)="handleSubmitButtonClicked(componentState)"
[mode]="mode"
- (deleteButtonClicked)="deleteButtonClicked($event)"
- (undoDeleteButtonClicked)="undoDeleteButtonClicked($event)"
[isDisabled]="isDisabled"
class="post"
/>
@@ -127,8 +121,6 @@
[numReplies]="componentState.replies.length"
(submitButtonClicked)="handleSubmitButtonClicked(componentState)"
[mode]="mode"
- (deleteButtonClicked)="deleteButtonClicked($event)"
- (undoDeleteButtonClicked)="undoDeleteButtonClicked($event)"
[isDisabled]="isDisabled"
class="post"
style="display: block"
diff --git a/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.ts b/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.ts
index 22f20baac00..71c4f6357ee 100644
--- a/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.ts
+++ b/src/assets/wise5/components/discussion/discussion-student/discussion-student.component.ts
@@ -50,6 +50,7 @@ export class DiscussionStudent extends ComponentStudent {
newResponse: string = '';
responsesMap: any = {};
retrievedClassmateResponses: boolean = false;
+ studentMode: boolean = true;
studentResponse: string = '';
topLevelResponses: any = {};
@@ -58,7 +59,7 @@ export class DiscussionStudent extends ComponentStudent {
protected componentService: ComponentService,
protected configService: ConfigService,
protected dialog: MatDialog,
- private discussionService: DiscussionService,
+ protected discussionService: DiscussionService,
protected nodeService: NodeService,
protected notebookService: NotebookService,
private notificationService: NotificationService,
@@ -462,12 +463,11 @@ export class DiscussionStudent extends ComponentStudent {
}
setClassResponses(componentStates: any[], annotations: any[] = []): void {
- const isStudentMode = true;
this.classResponses = this.discussionService.getClassResponses(
componentStates,
annotations,
this.workgroupId,
- isStudentMode,
+ this.studentMode,
this.isAnonymizeResponses()
);
this.responsesMap = this.discussionService.getResponsesMap(this.classResponses);
diff --git a/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.html b/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.html
new file mode 100644
index 00000000000..dac8541294f
--- /dev/null
+++ b/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.html
@@ -0,0 +1,49 @@
+
+
+
+
+ @for (componentState of topLevelResponses.all; track componentState) {
+
+ }
+
+
+ @for (componentState of topLevelResponses.col2; track componentState) {
+
+ }
+
+
+
+ @for (componentState of topLevelResponses.col1; track componentState) {
+
+ }
+
+
+
diff --git a/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.ts b/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.ts
index ffeccd8e3fc..3fa4abd1585 100644
--- a/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.ts
+++ b/src/assets/wise5/components/discussion/discussion-teacher/discussion-teacher.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, SimpleChanges, ViewEncapsulation } from '@angular/core';
+import { Component, inject, Input, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ComponentHeaderComponent } from '../../../directives/component-header/component-header.component';
import { ComponentAnnotationsComponent } from '../../../directives/componentAnnotations/component-annotations.component';
import { MatCard } from '@angular/material/card';
@@ -9,14 +9,15 @@ import { MatInput } from '@angular/material/input';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { MatButton } from '@angular/material/button';
import { MatIcon } from '@angular/material/icon';
-import { ClassResponse } from '../class-response/class-response.component';
import { DiscussionStudent } from '../discussion-student/discussion-student.component';
+import { TeacherDiscussionService } from '../teacherDiscussionService';
+import { ClassResponseTeacherComponent } from '../class-response-teacher/class-response-teacher.component';
@Component({
encapsulation: ViewEncapsulation.None,
imports: [
CdkTextareaAutosize,
- ClassResponse,
+ ClassResponseTeacherComponent,
ComponentAnnotationsComponent,
ComponentHeaderComponent,
FormsModule,
@@ -29,11 +30,13 @@ import { DiscussionStudent } from '../discussion-student/discussion-student.comp
],
selector: 'discussion-teacher',
styleUrl: '../discussion-student/discussion-student.component.scss',
- templateUrl: '../discussion-student/discussion-student.component.html'
+ templateUrl: './discussion-teacher.component.html'
})
export class DiscussionTeacherComponent extends DiscussionStudent {
@Input() periodId: number;
@Input() anonymizeResponses: boolean;
+ studentMode: boolean = false;
+ private teacherDiscussionService = inject(TeacherDiscussionService);
ngOnChanges(changes: SimpleChanges): void {
if (changes.component) {
@@ -60,4 +63,88 @@ export class DiscussionTeacherComponent extends DiscussionStudent {
protected isAnonymizeResponses(): boolean {
return this.anonymizeResponses;
}
+
+ /**
+ * The teacher has clicked the delete button to delete a post. We won't actually delete the
+ * student work, we'll just create an inappropriate flag annotation which prevents the students in
+ * the class from seeing the post.
+ * @param componentState the student component state the teacher wants to delete.
+ */
+ protected hidePost(componentState: any): void {
+ this.flagPost(componentState, 'Delete');
+ }
+
+ /**
+ * The teacher has clicked the 'Undo Delete' button to undo a previous deletion of a post. This
+ * function will create an inappropriate flag annotation with the action set to 'Undo Delete'.
+ * This will make the post visible to the students.
+ * @param componentState the student component state the teacher wants to show again.
+ */
+ protected showPost(componentState: any): void {
+ this.flagPost(componentState, 'Undo Delete');
+ }
+
+ private flagPost(componentState: any, action: 'Delete' | 'Undo Delete'): void {
+ const toWorkgroupId = componentState.workgroupId;
+ const userInfo = this.configService.getUserInfoByWorkgroupId(toWorkgroupId);
+ const periodId = userInfo.periodId;
+ const teacherUserInfo = this.configService.getMyUserInfo();
+ const fromWorkgroupId = teacherUserInfo.workgroupId;
+ const runId = this.configService.getRunId();
+ const nodeId = this.nodeId;
+ const componentId = this.componentId;
+ const studentWorkId = componentState.id;
+ const data = {
+ action: action
+ };
+ const annotation = this.annotationService.createInappropriateFlagAnnotation(
+ runId,
+ periodId,
+ nodeId,
+ componentId,
+ fromWorkgroupId,
+ toWorkgroupId,
+ studentWorkId,
+ data
+ );
+ this.annotationService.saveAnnotation(annotation).then(() => {
+ const componentStates =
+ this.teacherDiscussionService.getPostsAssociatedWithComponentIdsAndWorkgroupId(
+ this.getGradingComponentIds(),
+ this.workgroupId
+ );
+ const annotations = this.getInappropriateFlagAnnotationsByComponentStates(componentStates);
+ this.setClassResponses(componentStates, annotations);
+ });
+ }
+
+ private getGradingComponentIds(): string[] {
+ const connectedComponentIds = [this.componentId];
+ if (this.componentContent.connectedComponents != null) {
+ for (const connectedComponent of this.componentContent.connectedComponents) {
+ connectedComponentIds.push(connectedComponent.componentId);
+ }
+ }
+ return connectedComponentIds;
+ }
+
+ /**
+ * Get the inappropriate flag annotations for these component states
+ * @param componentStates an array of component states
+ * @return an array of inappropriate flag annotations associated with the component states
+ */
+ private getInappropriateFlagAnnotationsByComponentStates(componentStates = []): any[] {
+ const annotations = [];
+ for (const componentState of componentStates) {
+ const latestInappropriateFlagAnnotation =
+ this.annotationService.getLatestAnnotationByStudentWorkIdAndType(
+ componentState.id,
+ 'inappropriateFlag'
+ );
+ if (latestInappropriateFlagAnnotation != null) {
+ annotations.push(latestInappropriateFlagAnnotation);
+ }
+ }
+ return annotations;
+ }
}
diff --git a/src/messages.xlf b/src/messages.xlf
index 7c5b4a5d6f5..486abfc0a90 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -12963,14 +12963,6 @@ The branches will be removed but the steps will remain in the unit.
src/assets/wise5/components/conceptMap/concept-map-student/concept-map-student.component.html
121,125
-
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 42,46
-
-
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 118,121
-
Update
@@ -16405,11 +16397,7 @@ Are you sure you want to proceed?
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 47,48
-
-
- src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 47,48
+ 45,46
@@ -18779,97 +18767,91 @@ Category Name:
20
-
- Post attachment
+
+ Hide from students
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 23,25
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 29,32
-
-
- Delete this post so students will not see it
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 37,40
-
-
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 114,117
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 100,102
-
- Make this post viewable to students
+
+ Show to students
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 53,56
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 42,45
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 144,146
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 125,127
-
- Undo Delete
+
+ Post attachment
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 58,64
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 52,55
src/assets/wise5/components/discussion/class-response/class-response.component.html
- 148,151
+ 23,26
Comments ()
+
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 62,63
+
src/assets/wise5/components/discussion/class-response/class-response.component.html
- 71,72
+ 33,34
Comments ()
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 75,76
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 66,67
-
-
- Students will not see this post
src/assets/wise5/components/discussion/class-response/class-response.component.html
- 128,130
+ 37,38
-
- Parent Deleted
+
+ Parent post is hidden, so this comment is also hidden
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 132,135
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.html
+ 113,115
-
- Add Comment
+
+ Are you sure you want to hide this content?
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 165,168
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.ts
+ 47
+
+
+ Are you sure you want to show this content?
- src/assets/wise5/components/discussion/class-response/class-response.component.html
- 167,170
+ src/assets/wise5/components/discussion/class-response-teacher/class-response-teacher.component.ts
+ 53
-
- Are you sure you want to delete this post?
+
+ Add Comment
- src/assets/wise5/components/discussion/class-response/class-response.component.ts
- 127
+ src/assets/wise5/components/discussion/class-response/class-response.component.html
+ 75,78
-
-
- Are you sure you want to show this post?
- src/assets/wise5/components/discussion/class-response/class-response.component.ts
- 133
+ src/assets/wise5/components/discussion/class-response/class-response.component.html
+ 77,80
@@ -18900,51 +18882,35 @@ Category Name:
Share with class...
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 28,31
-
-
- src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 28,31
+ 26,29
Remove file
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 54,56
-
-
- src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 54,56
+ 52,54
Add picture
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 70,73
-
-
- src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 70,73
+ 68,71
Post
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 84,88
-
-
- src/assets/wise5/components/discussion/discussion-student/discussion-student.component.html
- 84,88
+ 82,86
replied to a discussion you were in!
src/assets/wise5/components/discussion/discussion-student/discussion-student.component.ts
- 231
+ 232