Skip to content

Commit

Permalink
Merge pull request #8093 from jonboiser/update-facility-task-strings
Browse files Browse the repository at this point in the history
In Facility task cards, only quote the facility name and not the ID fragment
  • Loading branch information
rtibbles authored May 20, 2021
2 parents 607f205 + a9292fc commit 5951a07
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/mixins/commonCoreStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const coreStrings = createTranslator('CommonCoreStrings', {
invalidCredentialsError: 'Incorrect username or password',

// Formatting
nameWithIdInParens: '{name} ({id})',
nameWithIdInParens: `'{name}' ({id})`,
quotedPhrase: `'{phrase}'`,
dashSeparatedPair: '{item1} - {item2}',
dashSeparatedTriple: '{item1} - {item2} - {item3}',
Expand Down
6 changes: 3 additions & 3 deletions kolibri/core/assets/src/mixins/taskStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const taskStrings = createTranslator('TaskStrings', {
context: 'Sync task status',
},
syncFacilityTaskLabel: {
message: "Sync '{facilityName}'",
message: 'Sync {facilityName}',
context: 'Description of sync-facility task',
},
syncStepAndDescription: {
Expand All @@ -87,7 +87,7 @@ const taskStrings = createTranslator('TaskStrings', {
context: 'Remove facility task status',
},
removeFacilityTaskLabel: {
message: "Remove '{facilityName}'",
message: 'Remove {facilityName}',
context: 'Description of a remove-facility task',
},
removeFacilitySuccessStatus: {
Expand All @@ -97,7 +97,7 @@ const taskStrings = createTranslator('TaskStrings', {

// Import Facility Task strings
importFacilityTaskLabel: {
message: "Import '{facilityName}'",
message: 'Import {facilityName}',
context: 'Description of import-facility task',
},
importSuccessStatus: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe('syncTaskUtils.syncFacilityTaskDisplayInfo', () => {
const task = makeTask('RUNNING');
task.type = 'SYNCPEER/FULL';
const displayInfo = syncFacilityTaskDisplayInfo(task);
expect(displayInfo.headingMsg).toEqual("Sync 'generic facility (fac1)'");
expect(displayInfo.headingMsg).toEqual("Sync 'generic facility' (fac1)");
});

it('displays the correct header for facility-import tasks', () => {
const task = makeTask('RUNNING');
task.type = 'SYNCPEER/PULL';
const displayInfo = syncFacilityTaskDisplayInfo(task);
expect(displayInfo.headingMsg).toEqual("Import 'generic facility (fac1)'");
expect(displayInfo.headingMsg).toEqual("Import 'generic facility' (fac1)");
});

it('display title, started by username, and device name are invariant wrt status', () => {
Expand All @@ -63,9 +63,9 @@ describe('syncTaskUtils.syncFacilityTaskDisplayInfo', () => {
ALL_STATUSES.forEach(status => {
task.status = status;
expect(syncFacilityTaskDisplayInfo(task)).toMatchObject({
headingMsg: "Sync 'invariant facility (fac1)'",
headingMsg: "Sync 'invariant facility' (fac1)",
startedByMsg: "Started by 'invariant user'",
deviceNameMsg: "'invariant device (dev1)'",
deviceNameMsg: "'invariant device' (dev1)",
});
});
});
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('syncTaskUtils.removeFacilityTaskDisplayInfo', () => {
ALL_STATUSES.forEach(status => {
const task = makeTask(status);
expect(removeFacilityTaskDisplayInfo(task)).toMatchObject({
headingMsg: "Remove 'removed facility (fac1)'",
headingMsg: "Remove 'removed facility' (fac1)",
startedByMsg: "Started by 'removing user'",
});
});
Expand Down
4 changes: 1 addition & 3 deletions kolibri/plugins/device/assets/src/views/syncTaskUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export function syncFacilityTaskDisplayInfo(task) {
if (task.type === TaskTypes.SYNCDATAPORTAL) {
deviceNameMsg = 'Kolibri Data Portal';
} else if (task.device_name) {
deviceNameMsg = coreString('quotedPhrase', {
phrase: formatNameWithId(task.device_name, task.device_id),
});
deviceNameMsg = formatNameWithId(task.device_name, task.device_id);
}
const syncStep = syncTaskStatusToStepMap[task.sync_state];
const statusDescription =
Expand Down

0 comments on commit 5951a07

Please sign in to comment.