Skip to content
Snippets Groups Projects

Display slash commands outcome when previewing Markdown

Merged username-removed-378947 requested to merge adam-separate-slash-commands into master
All threads resolved!

What does this MR do?

This continues the work started in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7497.

  • Remove slash commands from Markdown preview and display their outcome next to the text field.
  • Introduce new "explanation" block to our slash commands DSL.
  • Introduce optional "parse_params" block to slash commands DSL that allows to process a parameter before it is passed to "explanation" or "command" blocks.
  • Pass path for previewing Markdown as "data" attribute instead of setting a variable on "window".

Are there points in the code the reviewer needs to double check?

I didn't use shared_examples for testing InterpretService#explain, because I don't think that testing the same stuff for Issue and MergeRequest makes sense. Instead I'm testing Issue in roughly half of the specs and MergeRequest in the rest.

Why was this MR needed?

We don't display slash commands after issue / merge requests / comment is submitted. Hence, we should also remove them from Markdown preview. Having their outcome displayed as well is helpful.

Screenshots (if relevant)

preview-slash-commands

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #21531 (closed)

EE MR https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1707

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 182 commits

    Compare with previous version

  • added 2 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 859 commits

    Compare with previous version

  • added 859 commits

    Compare with previous version

  • added 859 commits

    Compare with previous version

  • added 1 commit

    • 823e54cf - Rename "humanized" to "explanation" and "humanize" to "explain"

    Compare with previous version

  • @rymai you may also be interested in taking a look at this MR.

  • added 1 commit

    • 9b8ec366 - Introduce parse_params block to remove duplication

    Compare with previous version

  • added 1 commit

    • 31cdbef7 - Fix regression in finding labels by name

    Compare with previous version

  • added 1 commit

    • d1da30dd - Reduce duplication in InterpretService

    Compare with previous version

  • username-removed-378947 unmarked as a Work In Progress

    unmarked as a Work In Progress

  • username-removed-378947 marked the task Changelog entry added, if necessary as completed

    marked the task Changelog entry added, if necessary as completed

  • added 114 commits

    Compare with previous version

  • @axil Please let me know if this requires documenting. We have doc/user/project/slash_commands.md, but I think that this feature is easy to discover and quite self-explanatory. What do you think?

  • added 1 commit

    • fd5fb135 - Display slash commands outcome when previewing Markdown

    Compare with previous version

  • @iamphill can you review the frontend changes here? As you can see the presentation of slash commands output is quite minimalistic and, if possible, I'd like to keep it like that in this MR. We can improve it in a follow-up MR, but this one is already quite big.

  • @adamniedzielski nice! Looks great & the frontend looks pretty simple as well :thumbsup:

    Is the backend all reviewed?

  • @iamphill I will review it!

  • changed milestone to %9.2

  • @iamphill Thanks! :smile:

    @rymai The backend is not 100% ready yet. I wanted to get the frontend review earlier because the changes are smaller. I can ping you when it's ready.

  • added 472 commits

    Compare with previous version

  • @rymai This should be ready for your review now.

  • mentioned in merge request !10810 (merged)

  • username-removed-128633 resolved all discussions

    resolved all discussions

  • @adamniedzielski Thanks, awesome work, I only had one suggestion.

  • @adamniedzielski I just noticed that now that https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10810/diffs is merged, this MR will need a rebase.

  • mentioned in issue #31583 (moved)

  • username-removed-378947 resolved all discussions

    resolved all discussions

  • added 761 commits

    Compare with previous version

  • added 8 commits

    Compare with previous version

  • @rymai I followed your suggestion, rebased and added explanation for the board move command that was added in the meantime (:smile:).

    Please confirm that it's ready to be merged and I'll update the EE MR.

  • @adamniedzielski Thanks, I left a few notes, LGTM otherwise! :tada:

  • added 1 commit

    • 579c9b70 - Display slash commands outcome when previewing Markdown

    Compare with previous version

  • username-removed-378947 resolved all discussions

    resolved all discussions

  • @adamniedzielski Thanks, looks good to me! :heart:

  • There are some legitimate test failures here :disappointed:.

  • It should be fixed now, I wasn't checking if response.references.commands is null.

  • added 1 commit

    • 45e4c665 - Display slash commands outcome when previewing Markdown

    Compare with previous version

  • @rymai I've updated the EE MR.

  • username-removed-128633 approved this merge request

    approved this merge request

  • mentioned in commit 8b336ae1

  • Please register or sign in to reply
    Loading