Skip to content
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: Change posting deletion logic to not abort when deconstructing a post #10073

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/main/webapp/app/shared/metis/posting.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
ngOnDestroy(): void {
if (this.deleteTimer !== undefined) {
clearTimeout(this.deleteTimer);
this.deletePostingWithoutTimeout();
}

if (this.deleteInterval !== undefined) {
Expand All @@ -72,11 +73,7 @@

this.deleteTimer = setTimeout(
() => {
if (this.isAnswerPost) {
this.metisService.deleteAnswerPost(this.posting);
} else {
this.metisService.deletePost(this.posting);
}
this.deletePostingWithoutTimeout();
},
// We add a tiny buffer to make it possible for the user to react a bit longer than the ui displays (+1000)
this.deleteTimerInSeconds * 1000 + 1000,
Expand Down Expand Up @@ -139,12 +136,17 @@
}
}

private deletePostingWithoutTimeout() {
if (this.isAnswerPost) {
this.metisService.deleteAnswerPost(this.posting);
} else {
this.metisService.deletePost(this.posting);
/**
* Create a or navigate to one-to-one chat with the referenced user
*
* @param referencedUserLogin login of the referenced user
*/
onUserReferenceClicked(referencedUserLogin: string) {

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests

',' expected.

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests

';' expected.

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-compilation

',' expected.

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-compilation

';' expected.

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests-selected

',' expected.

Check failure on line 149 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests-selected

';' expected.
const course = this.metisService.course;
if (isMessagingEnabled(course)) {
if (this.isCommunicationPage) {
Expand All @@ -164,7 +166,7 @@
/**
* Create a or navigate to one-to-one chat with the referenced user
*/
onUserNameClicked() {

Check failure on line 169 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests

';' expected.

Check failure on line 169 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-compilation

';' expected.

Check failure on line 169 in src/main/webapp/app/shared/metis/posting.directive.ts

View workflow job for this annotation

GitHub Actions / client-tests-selected

';' expected.
if (!this.posting.author?.id) {
return;
}
Expand All @@ -187,3 +189,3 @@
}
}
}
Loading