From 079a89fbbacf172c4f6a91062d14425100df85ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 14 Aug 2018 11:43:55 +0200 Subject: [PATCH] Changed confirm message for removing us relationship with an epic --- app/locales/taiga/locale-en.json | 7 ++----- .../related-userstory-row.controller.coffee | 13 ++++++------ ...lated-userstory-row.controller.spec.coffee | 20 ++++++++++--------- .../related-userstory-row.jade | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index f899cedf..b254df6a 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -1105,7 +1105,7 @@ }, "REMOVE_RELATIONSHIP_WITH_EPIC": { "TITLE": "Remove relationship with Epic", - "MESSAGE": "Are you sure you want to delete the relationship of this User Story with the Epic {{epicSubject}}" + "MESSAGE": "Are you sure you want to delete the relationship of this User Story with the Epic {{epicSubject}}?" }, "CREATE_MEMBER": { "PLACEHOLDER_INVITATION_TEXT": "(Optional) Add a personalized text to the invitation. Tell something lovely to your new members ;-)", @@ -1168,8 +1168,6 @@ "PAGE_TITLE": "{{epicSubject}} - Epic {{epicRef}} - {{projectName}}", "PAGE_DESCRIPTION": "Status: {{epicStatus }}. Description: {{epicDescription}}", "SECTION_NAME": "Epic", - "TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY": "Unlink related userstory", - "MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY": "This action will remove the link to the related user story '{{subject}}'", "ERROR_UNLINK_RELATED_USERSTORY": "We have not been able to unlink: {{errorMessage}}", "CREATE_RELATED_USERSTORIES": "Create a relationship with", "NEW_USERSTORY": "New user story", @@ -1408,8 +1406,7 @@ "CLOSE": "Close notification", "MAIL": "Notifications By Mail", "DESKTOP": "Desktop notifications using browser alerts", - "ASK_DELETE": "Are you sure you want to delete?", - "ASK_REMOVE_LINK": "Are you sure you want to remove the link?" + "ASK_DELETE": "Are you sure you want to delete?" }, "CANCEL_ACCOUNT": { "TITLE": "Cancel your account", diff --git a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.coffee b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.coffee index eab0d91b..f0c4c654 100644 --- a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.coffee +++ b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.coffee @@ -40,12 +40,13 @@ class RelatedUserstoryRowController return @translate.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED") onDeleteRelatedUserstory: () -> - title = @translate.instant('EPIC.TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY') - message = @translate.instant('EPIC.MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY', { - subject: @.userstory.get('subject') - }) - subtitle = @translate.instant('NOTIFICATION.ASK_REMOVE_LINK') - return @confirm.askOnDelete(title, message, subtitle) + title = @translate.instant("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.TITLE") + message = @translate.instant( + "LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.MESSAGE", + { epicSubject: @.epic.get('subject') } + ) + + return @confirm.ask(title, null, message) .then (askResponse) => onError = () => message = @translate.instant('EPIC.ERROR_UNLINK_RELATED_USERSTORY', {errorMessage: message}) diff --git a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.spec.coffee b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.spec.coffee index 5b496b0e..80bba063 100644 --- a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.spec.coffee +++ b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.controller.spec.coffee @@ -112,6 +112,7 @@ describe "RelatedUserstoryRow", -> it "delete related userstory success", (done) -> RelatedUserstoryRowCtrl.epic = Immutable.fromJS({ + subject: "SampleEpic" id: 123 }) RelatedUserstoryRowCtrl.userstory = Immutable.fromJS({ @@ -125,11 +126,11 @@ describe "RelatedUserstoryRow", -> finish: sinon.spy() } - mocks.translate.instant.withArgs("EPIC.TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY").returns("title") - mocks.translate.instant.withArgs("EPIC.MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY", {subject: "Deleting"}).returns("message") + mocks.translate.instant.withArgs("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.TITLE").returns("title") + mocks.translate.instant.withArgs("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.MESSAGE", {epicSubject: "SampleEpic"}).returns("message") - mocks.tgConfirm.askOnDelete = sinon.stub() - mocks.tgConfirm.askOnDelete.withArgs("title", "message").promise().resolve(askResponse) + mocks.tgConfirm.ask = sinon.stub() + mocks.tgConfirm.ask.withArgs("title").promise().resolve(askResponse) promise = mocks.tgResources.epics.deleteRelatedUserstory.withArgs(123, 124).promise().resolve(true) RelatedUserstoryRowCtrl.onDeleteRelatedUserstory().then () -> @@ -139,6 +140,7 @@ describe "RelatedUserstoryRow", -> it "delete related userstory error", (done) -> RelatedUserstoryRowCtrl.epic = Immutable.fromJS({ + epicSubject: "SampleEpic" id: 123 }) RelatedUserstoryRowCtrl.userstory = Immutable.fromJS({ @@ -152,12 +154,12 @@ describe "RelatedUserstoryRow", -> finish: sinon.spy() } - mocks.translate.instant.withArgs("EPIC.TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY").returns("title") - mocks.translate.instant.withArgs("EPIC.MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY", {subject: "Deleting"}).returns("message") - mocks.translate.instant.withArgs("EPIC.ERROR_UNLINK_RELATED_USERSTORY", {errorMessage: "message"}).returns("error message") + mocks.translate.instant.withArgs("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.TITLE").returns("title") + mocks.translate.instant.withArgs("LIGHTBOX.REMOVE_RELATIONSHIP_WITH_EPIC.MESSAGE", {epicSubject: "SampleEpic"}).returns("message") + mocks.translate.instant.withArgs("EPIC.ERROR_UNLINK_RELATED_USERSTORY").returns("error message") - mocks.tgConfirm.askOnDelete = sinon.stub() - mocks.tgConfirm.askOnDelete.withArgs("title", "message").promise().resolve(askResponse) + mocks.tgConfirm.ask = sinon.stub() + mocks.tgConfirm.ask.withArgs("title").promise().resolve(askResponse) promise = mocks.tgResources.epics.deleteRelatedUserstory.withArgs(123, 124).promise().reject(new Error("error")) RelatedUserstoryRowCtrl.onDeleteRelatedUserstory().then () -> diff --git a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.jade b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.jade index 61e7ae4b..3e7a6a48 100644 --- a/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.jade +++ b/app/modules/epics/related-userstories/related-userstory-row/related-userstory-row.jade @@ -20,7 +20,7 @@ tg-svg.icon-drag( .userstory-settings a.delete-userstory.e2e-delete-userstory( tg-check-permission="modify_epic" - title="{{'COMMON.UNLINK' | translate}}" + title="{{'US.REMOVE_RELATIONSHIP_WITH_EPIC' | translate}}" href="" ng-click="vm.onDeleteRelatedUserstory()" )