Follow-up from "add iteration autocomplete to RTE"

The following discussion from !175785 (merged) should be addressed:

  • [ ] @ramistry started a discussion: (+2 comments)

    @himkp. I was trying out adding iteration. On issues, they are working perfectly. I was thinking, as we are adding support of adding and removing iterations using quick actions on work items, should we also include tagging iterations in work item comments?


    @ramistry Yes we should. For RTE, the autocomplete logic is in app/assets/javascripts/content_editor/services/autocomplete_helper.js. I haven't gotten around to unifying autocomplete logic in both PTE and RTE (that's quite a big task). In the meantime I think it is okay to manually add it in both places.

    Since each issue can only have one iteration, it should be much simpler than adding/removing assignees or labels. It should work exactly like autocompleting milestones. The only thing we need to do is that when an iteration quick action is selected from the dropdown, we should autofill *iteration: in the text editors and trigger an iteration dropdown. Similar to how we autofill % for milestones and trigger a dropdown.


    @ramistry I actually misunderstood your comment. After this MR and is merged, iterations should work automatically in RTE in work items. However, we also need to do this:

    when an iteration quick action is selected from the dropdown, we should autofill *iteration: in the text editors and trigger an iteration dropdown. Similar to how we autofill % for milestones and trigger a dropdown.

    This is a simple enough change:

    diff --git a/app/assets/javascripts/content_editor/constants/index.js b/app/assets/javascripts/content_editor/constants/index.js
    index e641f8c9d0b4..fd452921562f 100644
    --- a/app/assets/javascripts/content_editor/constants/index.js
    +++ b/app/assets/javascripts/content_editor/constants/index.js
    @@ -95,4 +95,6 @@ export const COMMANDS = {
       UNASSIGN: '/unassign',
       UNASSIGN_REVIEWER: '/unassign_reviewer',
       UNLABEL: '/unlabel',
    +  ITERATION: '/iteration',
    +  REMOVE_ITERATION: '/remove_iteration',
     };
    diff --git a/app/assets/javascripts/content_editor/extensions/suggestions.js b/app/assets/javascripts/content_editor/extensions/suggestions.js
    index 4b175a34255d..08f1109856fa 100644
    --- a/app/assets/javascripts/content_editor/extensions/suggestions.js
    +++ b/app/assets/javascripts/content_editor/extensions/suggestions.js
    @@ -186,6 +186,8 @@ export default Node.create({
               [COMMANDS.UNASSIGN_REVIEWER]: '@',
               [COMMANDS.REASSIGN_REVIEWER]: '@',
               [COMMANDS.MILESTONE]: '%',
    +          [COMMANDS.ITERATION]: '*iteration:',
    +          [COMMANDS.REMOVE_ITERATION]: '*iteration:',
             },
           }),
         ];

    However, this requires that !175556 (merged) be merged first, so I'll create a follow up issue for this.

Assignee Loading
Time tracking Loading