diff --git a/app/assets/javascripts/todos/components/todo_item_body.vue b/app/assets/javascripts/todos/components/todo_item_body.vue index 59c30e058e8acee90fe88598860a43f78f139614..dcb7ae1df006e9ba913912b91caf30485485df8c 100644 --- a/app/assets/javascripts/todos/components/todo_item_body.vue +++ b/app/assets/javascripts/todos/components/todo_item_body.vue @@ -130,9 +130,7 @@ export default { if (this.todo.action === TODO_ACTION_TYPE_MEMBER_ACCESS_REQUESTED) { name = sprintf(s__('Todos|has requested access to %{what} %{which}'), { what: this.todo.memberAccessType, - // This one doesn't seem to be available via GraphQL. - // We probably want to move this logic to the backend anyhow... - which: this.todo.access_request_target_name, + which: this.todo.targetEntity.name, }); } @@ -141,8 +139,8 @@ export default { } if (this.todo.action === TODO_ACTION_TYPE_OKR_CHECKIN_REQUESTED) { - name = sprintf(s__('Todos|requested an OKR update for %{what}'), { - what: this.todo.targetEntity.title, + name = sprintf(s__('Todos|requested an OKR update for %{which}'), { + which: this.todo.targetEntity.name, }); } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 7e99c459b24b7cd34b20659d10aaac78513b9454..4f36ec83756b4214566071e0945ca860f7c3092f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -58389,6 +58389,9 @@ msgstr "" msgid "Todos|requested an OKR update for %{what}" msgstr "" +msgid "Todos|requested an OKR update for %{which}" +msgstr "" + msgid "Todos|reviewed your merge request" msgstr "" diff --git a/spec/frontend/todos/components/todo_item_body_spec.js b/spec/frontend/todos/components/todo_item_body_spec.js index 9f80cf3967533e5e1d002f79eed914c4dc08a4ac..db05442315238f9d29d9fddb6949d07a4e4153c5 100644 --- a/spec/frontend/todos/components/todo_item_body_spec.js +++ b/spec/frontend/todos/components/todo_item_body_spec.js @@ -36,7 +36,7 @@ describe('TodoItemBody', () => { }, action: TODO_ACTION_TYPE_ASSIGNED, targetEntity: { - title: 'Target title', + name: 'Foo', }, ...todoExtras, }, @@ -61,28 +61,27 @@ describe('TodoItemBody', () => { describe('correct text for actionName', () => { it.each` - actionName | text | showsAuthor - ${TODO_ACTION_TYPE_ADDED_APPROVER} | ${'set you as an approver.'} | ${true} - ${TODO_ACTION_TYPE_APPROVAL_REQUIRED} | ${'set you as an approver.'} | ${true} - ${TODO_ACTION_TYPE_ASSIGNED} | ${'assigned you.'} | ${true} - ${TODO_ACTION_TYPE_BUILD_FAILED} | ${'The pipeline failed.'} | ${false} - ${TODO_ACTION_TYPE_DIRECTLY_ADDRESSED} | ${'mentioned you.'} | ${true} - ${TODO_ACTION_TYPE_MARKED} | ${'added a to-do item'} | ${true} - ${TODO_ACTION_TYPE_MEMBER_ACCESS_REQUESTED} | ${'has requested access to'} | ${true} - ${TODO_ACTION_TYPE_MENTIONED} | ${'mentioned you.'} | ${true} - ${TODO_ACTION_TYPE_MERGE_TRAIN_REMOVED} | ${'Removed from Merge Train.'} | ${false} - ${TODO_ACTION_TYPE_OKR_CHECKIN_REQUESTED} | ${'requested an OKR update for'} | ${true} - ${TODO_ACTION_TYPE_REVIEW_REQUESTED} | ${'requested a review.'} | ${true} - ${TODO_ACTION_TYPE_REVIEW_SUBMITTED} | ${'reviewed your merge request.'} | ${true} - ${TODO_ACTION_TYPE_UNMERGEABLE} | ${'Could not merge.'} | ${false} - ${TODO_ACTION_TYPE_SSH_KEY_EXPIRED} | ${'Your SSH key has expired.'} | ${false} - ${TODO_ACTION_TYPE_SSH_KEY_EXPIRING_SOON} | ${'Your SSH key is expiring soon.'} | ${false} + actionName | text | showsAuthor + ${TODO_ACTION_TYPE_ADDED_APPROVER} | ${'set you as an approver.'} | ${true} + ${TODO_ACTION_TYPE_APPROVAL_REQUIRED} | ${'set you as an approver.'} | ${true} + ${TODO_ACTION_TYPE_ASSIGNED} | ${'assigned you.'} | ${true} + ${TODO_ACTION_TYPE_BUILD_FAILED} | ${'The pipeline failed.'} | ${false} + ${TODO_ACTION_TYPE_DIRECTLY_ADDRESSED} | ${'mentioned you.'} | ${true} + ${TODO_ACTION_TYPE_MARKED} | ${'added a to-do item'} | ${true} + ${TODO_ACTION_TYPE_MEMBER_ACCESS_REQUESTED} | ${'has requested access to group Foo'} | ${true} + ${TODO_ACTION_TYPE_MENTIONED} | ${'mentioned you.'} | ${true} + ${TODO_ACTION_TYPE_MERGE_TRAIN_REMOVED} | ${'Removed from Merge Train.'} | ${false} + ${TODO_ACTION_TYPE_OKR_CHECKIN_REQUESTED} | ${'requested an OKR update for Foo'} | ${true} + ${TODO_ACTION_TYPE_REVIEW_REQUESTED} | ${'requested a review.'} | ${true} + ${TODO_ACTION_TYPE_REVIEW_SUBMITTED} | ${'reviewed your merge request.'} | ${true} + ${TODO_ACTION_TYPE_UNMERGEABLE} | ${'Could not merge.'} | ${false} + ${TODO_ACTION_TYPE_SSH_KEY_EXPIRED} | ${'Your SSH key has expired.'} | ${false} + ${TODO_ACTION_TYPE_SSH_KEY_EXPIRING_SOON} | ${'Your SSH key is expiring soon.'} | ${false} `('renders "$text" for the "$actionName" action', ({ actionName, text, showsAuthor }) => { - createComponent({ action: actionName }); + createComponent({ action: actionName, memberAccessType: 'group' }); expect(wrapper.text()).toContain(text); expect(wrapper.text().includes('John Doe')).toBe(showsAuthor); }); - // FIXME: The TODO_ACTION_TYPE_OKR_CHECKIN_REQUESTED action raises an error. Seems to be broken. }); describe('when todo is hidden by SAML', () => {