|
|
|
@ -79,9 +79,11 @@ module Redmine
|
|
|
|
|
if res.is_public
|
|
|
|
|
if( (self.class.to_s=="Project" && self.is_public == false) ||
|
|
|
|
|
(self.has_attribute?(:project) && self.project && self.project.is_public == false) ||
|
|
|
|
|
(self.has_attribute?(:board) && self.board.project && self.board.project.is_public == false) ||
|
|
|
|
|
(self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) ||
|
|
|
|
|
(self.class.to_s=="Course" && self.is_public == false) ||
|
|
|
|
|
(self.has_attribute?(:course) && self.course && self.course.is_public == false)
|
|
|
|
|
(self.has_attribute?(:course) && self.course && self.course.is_public == false) ||
|
|
|
|
|
(self.has_attribute?(:board) && self.board.course && self.board.course.is_public == false)
|
|
|
|
|
)
|
|
|
|
|
res.is_public = false
|
|
|
|
|
end
|
|
|
|
@ -120,18 +122,22 @@ module Redmine
|
|
|
|
|
end
|
|
|
|
|
if attachments.is_a?(Array)
|
|
|
|
|
attachments.each do |attachment|
|
|
|
|
|
next unless attachment.is_a?(Hash)
|
|
|
|
|
a = nil
|
|
|
|
|
if file = attachment['file']
|
|
|
|
|
next unless file.size > 0
|
|
|
|
|
a = Attachment.create(:file => file, :author => author)
|
|
|
|
|
elsif token = attachment['token']
|
|
|
|
|
a = Attachment.find_by_token(token)
|
|
|
|
|
next unless a
|
|
|
|
|
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
|
|
|
|
a.content_type = attachment['content_type']
|
|
|
|
|
if attachment.is_a?(Hash)
|
|
|
|
|
a = nil
|
|
|
|
|
file = attachment['file']
|
|
|
|
|
token = attachment['token']
|
|
|
|
|
t = file && file.size > 0
|
|
|
|
|
if file && file.size > 0
|
|
|
|
|
a = Attachment.create(:file => file, :author => author)
|
|
|
|
|
elsif token
|
|
|
|
|
a = Attachment.find_by_token_only(token)
|
|
|
|
|
if a
|
|
|
|
|
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
|
|
|
|
a.content_type = attachment['content_type']
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if !attachment[:is_public]
|
|
|
|
|
if a && !attachment[:is_public]
|
|
|
|
|
a.is_public = false
|
|
|
|
|
end
|
|
|
|
|
set_attachment_public(a)
|
|
|
|
|