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: Highlight solution answer in thread #10069

Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
}}
</span>
</span>
@if (isResolvesPostSet()) {
<span class="post-header-solution">
<span
class="badge bg-info ms-2"
jhiTranslate="artemisApp.metis.post.resolvesPost"
ngbTooltip="{{ 'artemisApp.metis.post.resolvesPost' | artemisTranslate }}"
></span>
</span>
}
@if (!!isCommunicationPage && (!lastReadDate || (lastReadDate && posting.creationDate && posting.creationDate.isAfter(lastReadDate))) && !isAuthorOfPosting) {
<span jhiTranslate="global.generic.new" class="badge bg-secondary hideAfter5Seconds"></span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ export class AnswerPostHeaderComponent extends PostingHeaderDirective<AnswerPost
this.setUserProperties();
this.setUserAuthorityIconAndTooltip();
}

isResolvesPostSet(): boolean {
//Check if the post is a resolves post and if the attribute is not set return false
return this.posting.resolvesPost !== undefined && this.posting.resolvesPost;
}
}
1 change: 1 addition & 0 deletions src/main/webapp/i18n/de/metis.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"collapseContent": "Inhalt einklappen",
"addReaction": "Reaktion hinzufügen",
"pinMessage": "Nachricht anheften",
"resolvesPost": "Lösung",
"unpinMessage": "Nachricht lösen",
"editMessage": "Nachricht bearbeiten",
"deleteMessage": "Nachricht löschen",
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/en/metis.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"collapseContent": "Collapse content",
"addReaction": "Add reaction",
"pinMessage": "Pin message",
"resolvesPost": "Solution",
"unpinMessage": "Unpin message",
"editMessage": "Edit message",
"deleteMessage": "Delete message",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { metisAnswerPostUser2, metisResolvingAnswerPostUser1, metisUser1 } from
import { AccountService } from 'app/core/auth/account.service';
import { MockAccountService } from '../../../../../helpers/mocks/service/mock-account.service';
import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-picture.component';
import { By } from '@angular/platform-browser';

describe('AnswerPostHeaderComponent', () => {
let component: AnswerPostHeaderComponent;
Expand Down Expand Up @@ -92,6 +93,15 @@ describe('AnswerPostHeaderComponent', () => {
expect(getElement(debugElement, '#today-flag')).toBeNull();
});

it('should display solution when answerPost resolves post', () => {
const isResolvesPostSetSpy = jest.spyOn(component, 'isResolvesPostSet');
component.posting = metisResolvingAnswerPostUser1;
fixture.detectChanges();
const solution = debugElement.query(By.css('.post-header-solution'));
expect(isResolvesPostSetSpy).toHaveReturnedWith(true);
expect(solution).not.toBeNull();
});

it('should initialize answer post not marked as resolved and not show the check to mark it as such', () => {
// user, that is not author of original post, should not see the check to mark an answer post as resolving
metisServiceUserIsAtLeastTutorMock.mockReturnValue(false);
Expand Down
Loading