diff options
-rw-r--r-- | app/models/merge_request.rb | 8 | ||||
-rw-r--r-- | changelogs/unreleased/force-reload-arguments-2.yml | 5 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8052a54c504..6f5ea6e29ab 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -48,8 +48,8 @@ class MergeRequest < ActiveRecord::Base # is the inverse of MergeRequest#merge_request_diff, which means it may not be # the latest diff, because we could have loaded any diff from this particular # MR. If we haven't already loaded a diff, then it's fine to load the latest. - def merge_request_diff(*args) - fallback = latest_merge_request_diff if args.empty? && !association(:merge_request_diff).loaded? + def merge_request_diff + fallback = latest_merge_request_diff unless association(:merge_request_diff).loaded? fallback || super end @@ -620,10 +620,6 @@ class MergeRequest < ActiveRecord::Base end end - def reload_merge_request_diff - merge_request_diff(true) - end - def viewable_diffs @viewable_diffs ||= merge_request_diffs.viewable.to_a end diff --git a/changelogs/unreleased/force-reload-arguments-2.yml b/changelogs/unreleased/force-reload-arguments-2.yml new file mode 100644 index 00000000000..23ab9433b3d --- /dev/null +++ b/changelogs/unreleased/force-reload-arguments-2.yml @@ -0,0 +1,5 @@ +--- +title: Passing an argument to force an association to reload is now deprecated +merge_request: 23894 +author: Jasper Maes +type: other diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 7fd5307b906..6793d4e8718 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -2092,7 +2092,7 @@ describe MergeRequest do head_commit_sha: commit.sha ) - subject.merge_request_diff(true) + subject.reload_merge_request_diff end end |