Commit b2f60bb9 authored by Sean McGivern's avatar Sean McGivern

Fix auto-MR-close text from branch name

Rails's form helpers use the `$attr_before_type_cast` method where
available, and this value only appears to be updated on assignment, not
when the object is mutated in some other way:

    [1] pry(main)> mr = MergeRequest.new
    => #<MergeRequest:0x007fcf28395d88 ...>
    [2] pry(main)> mr.description = 'foo'
    => "foo"
    [3] pry(main)> mr.description << ' bar'
    => "foo bar"
    [4] pry(main)> mr.description
    => "foo bar"
    [5] pry(main)> mr.description_before_type_cast
    => "foo"
    [6] pry(main)> mr.description += ' bar'
    => "foo bar bar"
    [7] pry(main)> mr.description_before_type_cast
    => "foo bar bar"
parent 707e8d43
...@@ -13,6 +13,7 @@ v 8.9.0 (unreleased) ...@@ -13,6 +13,7 @@ v 8.9.0 (unreleased)
- Fix endless redirections when accessing user OAuth applications when they are disabled - Fix endless redirections when accessing user OAuth applications when they are disabled
- Allow enabling wiki page events from Webhook management UI - Allow enabling wiki page events from Webhook management UI
- Bump rouge to 1.11.0 - Bump rouge to 1.11.0
- Fix MR-auto-close text added to description
- Fix issue with arrow keys not working in search autocomplete dropdown - Fix issue with arrow keys not working in search autocomplete dropdown
- Fix an issue where note polling stopped working if a window was in the - Fix an issue where note polling stopped working if a window was in the
background during a refresh. background during a refresh.
......
...@@ -83,7 +83,7 @@ module MergeRequests ...@@ -83,7 +83,7 @@ module MergeRequests
closes_issue = "Closes ##{iid}" closes_issue = "Closes ##{iid}"
if merge_request.description.present? if merge_request.description.present?
merge_request.description << closes_issue.prepend("\n") merge_request.description += closes_issue.prepend("\n")
else else
merge_request.description = closes_issue merge_request.description = closes_issue
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment