From 1cfa8326aa8b71d2a6102896da6b8366b9c4faf7 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 20 Oct 2015 09:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AF=BE=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 7 +------ .../lib/acts_as_attachable.rb | 20 ++++++++----------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 0f728fc00..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -442,12 +442,7 @@ class Attachment < ActiveRecord::Base def self.attach_filesex(obj, attachments,attachment_type) - if obj.is_public? - public_status = true - else - public_status = false - end - result = obj.save_attachmentsex(attachments, User.current,attachment_type, public_status) + result = obj.save_attachmentsex(attachments, User.current,attachment_type) obj.attach_saved_attachments result end diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 9378013f9..682714b9b 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -93,13 +93,13 @@ module Redmine end end - def save_attachmentsex(attachments, author=User.current,attachment_type, public_status) + def save_attachmentsex(attachments, author=User.current,attachment_type) @curattachment_type = attachment_type - result = save_attachments(attachments,author, public_status) + result = save_attachments(attachments,author) result end - def save_attachments(attachments, author=User.current,public_status) + def save_attachments(attachments, author=User.current) # 清除临时文件 if attachments tempAttach = attachments[:dummy] @@ -140,16 +140,12 @@ module Redmine end end end - if public_status - if a && !attachment['is_public_checkbox'] - a.is_public = false - elsif a && attachment['is_public_checkbox'] - a.is_public = true - end - else - a.is_public = false - end + if a && !attachment['is_public_checkbox'] + a.is_public = false + elsif a && attachment['is_public_checkbox'] + a.is_public = true + end set_attachment_public(a) if a next unless a a.description = attachment['description'].to_s.strip