diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 21:09:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 21:09:27 +0300 |
commit | bf213f07c8146b7121240af90a07cb4b2ecc41fa (patch) | |
tree | 184537ad2334124c5090f2a729a9fd58bccf6b51 /app/models/suggestion.rb | |
parent | dd2da214c9644ef1064061d706dfeec50f9fad8f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/suggestion.rb')
-rw-r--r-- | app/models/suggestion.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/app/models/suggestion.rb b/app/models/suggestion.rb index 94f3a140098..c027a0d140e 100644 --- a/app/models/suggestion.rb +++ b/app/models/suggestion.rb @@ -43,12 +43,12 @@ class Suggestion < ApplicationRecord def inapplicable_reason(cached: true) strong_memoize("inapplicable_reason_#{cached}") do - next :applied if applied? - next :merge_request_merged if noteable.merged? - next :merge_request_closed if noteable.closed? - next :source_branch_deleted unless noteable.source_branch_exists? - next :outdated if outdated?(cached: cached) || !note.active? - next :same_content unless different_content? + next _("Can't apply this suggestion.") if applied? + next _("This merge request was merged. To apply this suggestion, edit this file directly.") if noteable.merged? + next _("This merge request is closed. To apply this suggestion, edit this file directly.") if noteable.closed? + next _("Can't apply as the source branch was deleted.") unless noteable.source_branch_exists? + next outdated_reason if outdated?(cached: cached) || !note.active? + next _("This suggestion already matches its content.") unless different_content? end end @@ -73,4 +73,12 @@ class Suggestion < ApplicationRecord def different_content? from_content != to_content end + + def outdated_reason + if single_line? + _("Can't apply as this line was changed in a more recent version.") + else + _("Can't apply as these lines were changed in a more recent version.") + end + end end |