Skip to content

Commit

Permalink
ensure uploads inherit privacy from comment if any
Browse files Browse the repository at this point in the history
  • Loading branch information
jrom committed Sep 8, 2011
1 parent 4016e59 commit 540a2b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/models/upload.rb
Expand Up @@ -18,6 +18,7 @@ class Upload < RoleRecord

before_create :copy_ownership_from_comment
after_create :log_create
before_save :inherit_privacy

attr_accessible :asset,
:page_id,
Expand Down Expand Up @@ -222,7 +223,13 @@ def copy_ownership_from_comment
end
true
end


def inherit_privacy
if comment_id
self.is_private = comment.is_private
end
end

def update_comment_to_show_delete
if self.comment && self.comment.body.blank? && self.comment.uploads.count == 1
self.comment.update_attributes(:body => "File deleted")
Expand Down

0 comments on commit 540a2b3

Please sign in to comment.