Update the regular expression in the help controller used to prefix relative
links on the help page with /help/. As suggested by @rymai, the look-ahead
pattern to detect external links is simplified from `[a-zA-Z0-9.+-]` to `\w`.
Update the help controller to correctly handle relative links on the help pages
when the relative link is before an external link on the same line in the
markdown file.
Test cases have been implement to check for
- relative links before external link on same line,
- HTTPS in query part of link,
- URLs without '//' and
- protocol-relative links.
We recently started adding YAML frontmatter in docs so that we can
show more information, but that only works for the docs portal at
docs.gitlab.com.
For example, we want to add a last_updated entry
https://gitlab.com/gitlab-org/gitlab-ce/issues/37677
Whereas this is useful for the docs portal, it looks ugly for docs
under /help.
An external link was recently added but was broken because
'https://gitlab.com/help/' was prepended to every link in the page.
Since no link in the main help readme begins with "help" and since doing
so wouldn't make sense, the substitution conditionaly prepending "help"
can be simplified and reused.
Signed-off-by: David Wagner <david@marvid.fr>
In Rails 4.2 and below, skipping callbacks (skip_before_action, skip_after_action, etc.) that use methods which do not exist will not throw any errors.
On the other hand, Rails 5 does. See https://github.com/rails/rails/pull/19029
After testing with Rails 5 I noticed there are some methods that don't actually exist (because they were renamed, usually), this fixes a few instances of those.
reject_blocked! was introduced in c9def945d4, I can't find any references to reject_blocked ever existing.
Prior, because the link "api/README.md" was matched twice, the first
link became "help/help/api/README.md". Now we do a negative lookahead to
make sure the link doesn't start with `help/`.
This fix is still not ideal, see TODO note.