mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
code cleanup: rubocop: fix Layout/EmptyLinesAroundBlockBody in app/models/attachment.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18558 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fb04274fc0
commit
a8c1fc77ef
@ -180,7 +180,6 @@ Layout/EmptyLinesAroundArguments:
|
|||||||
# SupportedStyles: empty_lines, no_empty_lines
|
# SupportedStyles: empty_lines, no_empty_lines
|
||||||
Layout/EmptyLinesAroundBlockBody:
|
Layout/EmptyLinesAroundBlockBody:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/attachment.rb'
|
|
||||||
- 'app/models/setting.rb'
|
- 'app/models/setting.rb'
|
||||||
- 'db/schema.rb'
|
- 'db/schema.rb'
|
||||||
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
|
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
|
||||||
|
|||||||
@ -427,7 +427,6 @@ class Attachment < ActiveRecord::Base
|
|||||||
|
|
||||||
def reuse_existing_file_if_possible
|
def reuse_existing_file_if_possible
|
||||||
original_diskfile = nil
|
original_diskfile = nil
|
||||||
|
|
||||||
reused = with_lock do
|
reused = with_lock do
|
||||||
if existing = Attachment
|
if existing = Attachment
|
||||||
.where(digest: self.digest, filesize: self.filesize)
|
.where(digest: self.digest, filesize: self.filesize)
|
||||||
@ -435,14 +434,11 @@ class Attachment < ActiveRecord::Base
|
|||||||
self.id, self.disk_filename)
|
self.id, self.disk_filename)
|
||||||
.first
|
.first
|
||||||
existing.with_lock do
|
existing.with_lock do
|
||||||
|
|
||||||
original_diskfile = self.diskfile
|
original_diskfile = self.diskfile
|
||||||
existing_diskfile = existing.diskfile
|
existing_diskfile = existing.diskfile
|
||||||
|
|
||||||
if File.readable?(original_diskfile) &&
|
if File.readable?(original_diskfile) &&
|
||||||
File.readable?(existing_diskfile) &&
|
File.readable?(existing_diskfile) &&
|
||||||
FileUtils.identical?(original_diskfile, existing_diskfile)
|
FileUtils.identical?(original_diskfile, existing_diskfile)
|
||||||
|
|
||||||
self.update_columns disk_directory: existing.disk_directory,
|
self.update_columns disk_directory: existing.disk_directory,
|
||||||
disk_filename: existing.disk_filename
|
disk_filename: existing.disk_filename
|
||||||
end
|
end
|
||||||
@ -459,7 +455,6 @@ class Attachment < ActiveRecord::Base
|
|||||||
# anymore, thats why this is caught and ignored as well.
|
# anymore, thats why this is caught and ignored as well.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Physically deletes the file from the file system
|
# Physically deletes the file from the file system
|
||||||
def delete_from_disk!
|
def delete_from_disk!
|
||||||
if disk_filename.present? && File.exist?(diskfile)
|
if disk_filename.present? && File.exist?(diskfile)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user