gitlab-org--gitlab-foss/app/services
Hannes Rosenögger 623f6c5f09 Merge branch 'fix-underscore-notes' into 'master'
Fix cross-references that contain underscores

### What does this MR do?

Cross-references that contain underscores confuse the Markdown renderer and don't work properly. For example:

1. In  `myacct/project_one#456`, add a comment that includes a reference to `myacct/project_two#123`.
2. The comment in `myacct/project_one#456` links correctly.
3. The system note in `myacct/project_two#123` is incorrectly linked as:

`mentioned in issue myacct/projectone#456_`

This MR removes the use of the `_` character in the system notes to prevent Markdown confusion.

See a full discussion in #1160.

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

To preserve backwards compatibility with existing system notes, there is a SQL wildcard match for notes having underscores. This seemed safer than migrating all notes.

### Why was this MR needed?

In an ideal world, the Markdown parser would be able to handle references containing underscores with or without escape sequences. However, there are a number of issues:

1. RedCarpet's parser for emphasis block is pretty dumb: it treats `#` as a word break and thus even the `intra_word_emphasis` flag has no effect.
2. The parser is in C and can't be changed easily.
3. There is no way to insert an escape sequence for emphasis blocks.

The only way around this is to switch to something like CommonMark, which does support escape sequences.

### What are the relevant issue numbers / [Feature requests](http://feedback.gitlab.com/)?

Issue #1160

### Screenshots

Before:

![Screen_Shot_2015-03-19_at_1.39.29_AM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/a1db4b96c0df2f10d9855ed5abe976ca/Screen_Shot_2015-03-19_at_1.39.29_AM.png)

After:

![Screen_Shot_2015-03-19_at_1.39.35_AM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/189a062c2d19645eec1782ac1f0d4f2f/Screen_Shot_2015-03-19_at_1.39.35_AM.png)

See merge request !385
2015-03-19 21:20:45 +00:00
..
files Web Editor: save to new branch 2015-02-24 11:43:20 +02:00
issues Send notifications and leave system comments when bulk updating issues. 2015-03-06 15:01:13 +01:00
merge_requests Fix condensed range in MR push comment. 2015-03-18 16:37:29 +01:00
milestones
notes Added comment notification events to HipChat and Slack services. 2015-03-06 06:54:00 -08:00
oauth2 Rubocop: no trailing newlines 2015-02-02 21:53:27 -08:00
projects Merge branch 'fix-restricted-visibility' into 'master' 2015-03-16 17:49:46 +00:00
search Adding in snippet search functionality 2014-08-29 15:32:07 -04:00
archive_repository_service.rb
base_service.rb Enforce restricted visibilities for snippets 2015-03-08 17:57:08 -06:00
compare_service.rb Comment typo. 2014-08-29 20:11:57 +02:00
create_branch_service.rb Ecevute hooks and services when branches are created/deleted through web. 2015-03-13 16:07:02 +01:00
create_snippet_service.rb Enforce restricted visibilities for snippets 2015-03-08 17:57:08 -06:00
create_tag_service.rb Use PushDataBuilder where applicable. 2015-03-13 16:06:56 +01:00
delete_branch_service.rb Ecevute hooks and services when branches are created/deleted through web. 2015-03-13 16:07:02 +01:00
delete_tag_service.rb Move tag deletion to service and execute hooks and services. 2015-03-13 16:07:08 +01:00
event_create_service.rb Use PushDataBuilder where applicable. 2015-03-13 16:06:56 +01:00
git_push_service.rb Fewer constants, more helpers. 2015-03-19 10:34:04 +01:00
git_tag_push_service.rb More consistent method naming. 2015-03-13 16:07:02 +01:00
gravatar_service.rb Improve application settings and write tests 2015-01-08 09:53:35 -08:00
issuable_base_service.rb Add labels notes 2015-02-08 22:35:41 +06:00
notification_service.rb Fix cross references when usernames, milestones, or project names contain underscores. 2015-03-19 07:07:30 -07:00
system_hooks_service.rb Generate valid json for hooks 2015-03-10 10:07:25 +01:00
test_hook_service.rb Fix test hook and tests 2015-01-12 09:08:25 -08:00
update_snippet_service.rb Enforce restricted visibilities for snippets 2015-03-08 17:57:08 -06:00