Skip to content

SF-3490 Show who created a draft #3350

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

Merged
merged 3 commits into from
Aug 11, 2025
Merged
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 @@ -8,7 +8,9 @@
<mat-expansion-panel-header [collapsedHeight]="'auto'" [expandedHeight]="'auto'">
<mat-panel-title>
<span class="title">{{ scriptureRange }}</span>
<span class="subtitle">{{ formatDate(entry.additionalInfo?.dateFinished) }}</span>
<span class="subtitle">{{
t("finished_at", { finishedAtTime: formatDate(entry.additionalInfo?.dateFinished) })
}}</span>
</mat-panel-title>
<mat-panel-description>
<span class="status" [ngClass]="getStatus(entry.state).color">
Expand Down Expand Up @@ -89,6 +91,20 @@
<tr mat-header-row *matHeaderRowDef="columnsToDisplay"></tr>
<tr mat-row *matRowDef="let row; columns: columnsToDisplay"></tr>
</table>
@if (buildRequestedAtDate != null && buildRequestedByUserName != null) {
<p>
{{
t("requested_by", {
requestedAtTime: buildRequestedAtDate,
requestedByUserName: buildRequestedByUserName
})
}}
</p>
} @else if (buildRequestedAtDate != null) {
<p>
{{ t("requested_at", { requestedAtTime: buildRequestedAtDate }) }}
</p>
}
}
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('DraftHistoryEntryComponent', () => {
component.entry = undefined;
expect(component.scriptureRange).toEqual('');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(component.hasDetails).toBe(false);
expect(component.entry).toBeUndefined();
Expand All @@ -80,7 +80,7 @@ describe('DraftHistoryEntryComponent', () => {

expect(component.scriptureRange).toEqual('Genesis');
expect(component.buildRequestedByUserName).toBe(user);
expect(component.buildRequestedByDate).toBe(date);
expect(component.buildRequestedAtDate).toBe(date);
expect(component.canDownloadBuild).toBe(true);
expect(fixture.nativeElement.querySelector('.format-usfm')).toBeNull();
expect(component.columnsToDisplay).toEqual(['scriptureRange', 'source', 'target']);
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('DraftHistoryEntryComponent', () => {

expect(component.scriptureRange).toEqual('Genesis');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(fixture.nativeElement.querySelector('.format-usfm')).toBeNull();
expect(component.columnsToDisplay).toEqual(['scriptureRange', 'source', 'target']);
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('DraftHistoryEntryComponent', () => {

expect(component.scriptureRange).toEqual('Genesis');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('formatted-date');
expect(component.buildRequestedAtDate).toBe('formatted-date');
expect(component.canDownloadBuild).toBe(true);
expect(fixture.nativeElement.querySelector('.format-usfm')).not.toBeNull();
expect(component.hasDetails).toBe(true);
Expand All @@ -200,7 +200,7 @@ describe('DraftHistoryEntryComponent', () => {
component.isLatestBuild = true;
expect(component.scriptureRange).toEqual('');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(fixture.nativeElement.querySelector('.format-usfm')).toBeNull();
expect(component.hasDetails).toBe(false);
Expand All @@ -212,7 +212,7 @@ describe('DraftHistoryEntryComponent', () => {
component.entry = entry;
expect(component.scriptureRange).toEqual('');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(component.hasDetails).toBe(false);
expect(component.entry).toBe(entry);
Expand All @@ -233,7 +233,7 @@ describe('DraftHistoryEntryComponent', () => {
component.entry = entry;
expect(component.scriptureRange).toEqual('');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(component.hasDetails).toBe(true);
expect(component.entry).toBe(entry);
Expand All @@ -250,7 +250,7 @@ describe('DraftHistoryEntryComponent', () => {
component.entry = entry;
expect(component.scriptureRange).toEqual('');
expect(component.buildRequestedByUserName).toBeUndefined();
expect(component.buildRequestedByDate).toBe('');
expect(component.buildRequestedAtDate).toBe('');
expect(component.canDownloadBuild).toBe(false);
expect(component.hasDetails).toBe(true);
expect(component.entry).toBe(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { SFProjectProfileDoc } from '../../../../core/models/sf-project-profile-
import { SFProjectService } from '../../../../core/sf-project.service';
import { BuildDto } from '../../../../machine-api/build-dto';
import { BuildStates } from '../../../../machine-api/build-states';
import { RIGHT_TO_LEFT_MARK } from '../../../../shared/utils';
import { DraftDownloadButtonComponent } from '../../draft-download-button/draft-download-button.component';
import { DraftPreviewBooksComponent } from '../../draft-preview-books/draft-preview-books.component';

Expand Down Expand Up @@ -176,9 +177,9 @@ export class DraftHistoryEntryComponent {
return this._buildRequestedByUserName;
}

get buildRequestedByDate(): string {
get buildRequestedAtDate(): string {
if (this._entry?.additionalInfo?.dateRequested == null) return '';
return this.i18n.formatDate(new Date(this._entry?.additionalInfo?.dateRequested));
return this.formatDate(this._entry?.additionalInfo?.dateRequested);
}

get hasDetails(): boolean {
Expand Down Expand Up @@ -233,7 +234,8 @@ export class DraftHistoryEntryComponent {
}

formatDate(date?: string): string {
return date == null ? '' : this.i18n.formatDate(new Date(date));
const formattedDate = date == null ? '' : this.i18n.formatDate(new Date(date));
return formattedDate.indexOf(RIGHT_TO_LEFT_MARK) !== -1 ? RIGHT_TO_LEFT_MARK + formattedDate : formattedDate;
}

getStatus(state: BuildStates): { icons: string; text: string; color: string } {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@
"draft_pending": "Pending",
"draft_unknown": "Unknown",
"error_details": "Please include these details when contacting support for assistance",
"finished_at": "Finished {{ finishedAtTime }}",
"format_draft": "Format draft",
"hide_model_training_configuration": "Hide model training configuration",
"requested_at": "Requested {{ requestedAtTime }}.",
"requested_by": "Requested by {{ requestedByUserName }} at {{ requestedAtTime }}.",
"show_model_training_configuration": "Show model training configuration",
"training_books": "Training books",
"training_model_description": "The language model was trained on this configuration:"
Expand Down
Loading