Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f76b258f
Commit
f76b258f
authored
May 04, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unneeded has_attribute guard for MR external diff storage
parent
32158f29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
26 deletions
+0
-26
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+0
-26
No files found.
app/models/merge_request_diff.rb
View file @
f76b258f
...
...
@@ -385,37 +385,12 @@ class MergeRequestDiff < ApplicationRecord
end
end
# Carrierwave defines `write_uploader` dynamically on this class, so `super`
# does not work. Alias the carrierwave method so we can call it when needed
alias_method
:carrierwave_write_uploader
,
:write_uploader
# The `external_diff`, `external_diff_store`, and `stored_externally`
# columns were introduced in GitLab 11.8, but some background migration specs
# use factories that rely on current code with an old schema. Without these
# `has_attribute?` guards, they fail with a `MissingAttributeError`.
#
# For more details, see: https://gitlab.com/gitlab-org/gitlab-foss/issues/44990
def
write_uploader
(
column
,
identifier
)
carrierwave_write_uploader
(
column
,
identifier
)
if
has_attribute?
(
column
)
end
def
update_external_diff_store
return
unless
has_attribute?
(
:external_diff_store
)
return
unless
saved_change_to_external_diff?
||
saved_change_to_stored_externally?
update_column
(
:external_diff_store
,
external_diff
.
object_store
)
end
def
saved_change_to_external_diff?
super
if
has_attribute?
(
:external_diff
)
end
def
stored_externally
super
if
has_attribute?
(
:stored_externally
)
end
alias_method
:stored_externally?
,
:stored_externally
# If enabled, yields the external file containing the diff. Otherwise, yields
# nil. This method is not thread-safe, but it *is* re-entrant, which allows
# multiple merge_request_diff_files to load their data efficiently
...
...
@@ -577,7 +552,6 @@ class MergeRequestDiff < ApplicationRecord
end
def
use_external_diff?
return
false
unless
has_attribute?
(
:external_diff
)
return
false
unless
Gitlab
.
config
.
external_diffs
.
enabled
case
Gitlab
.
config
.
external_diffs
.
when
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment