Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ensuring that the organization folder is truly being created.

  • Loading branch information...
commit 63b91e93078325fc30f14eb70286da75ec65f57a 1 parent c611da0
cdubose authored

Showing 1 changed file with 7 additions and 9 deletions. Show diff stats Hide diff stats

  1. +7 9 app/models/organization.rb
16 app/models/organization.rb
@@ -140,21 +140,19 @@ def create_group
140 140 # 1. Locating the folder by name, if one exists, creating one if not
141 141 # 1. Ensuring that the audience holds the organization's audience and the contact is set as an admin
142 142 def ensure_folder
143   - if folder.nil?
144   - folder = Folder.new
145   - end
  143 + self.folder = Folder.new unless self.folder
146 144
147   - folder.audience = Audience.new if folder.audience.nil?
148   - folder.audience.sub_audiences << self.group unless folder.audience.sub_audiences.include?(self.group)
  145 + self.folder.audience = Audience.new if self.folder.audience.nil?
  146 + self.folder.audience.sub_audiences << self.group unless self.folder.audience.sub_audiences.include?(self.group)
149 147
150   - folder.name = self.name
  148 + self.folder.name = self.name
151 149
152 150 if self.contact
153   - folder.audience.users << self.contact unless folder.audience.user_ids.include?(self.contact.id)
154   - folder.folder_permissions.build(:user_id => self.contact.id, :permission => ::FolderPermission::PERMISSION_TYPES[:admin]) unless folder.admins.include?(self.contact)
  151 + self.folder.audience.users << self.contact unless self.folder.audience.user_ids.include?(self.contact.id)
  152 + self.folder.folder_permissions.build(:user_id => self.contact.id, :permission => ::FolderPermission::PERMISSION_TYPES[:admin]) unless self.folder.admins.include?(self.contact)
155 153 end
156 154
157   - folder.save
  155 + self.folder.save
158 156 true
159 157 end
160 158 end

0 comments on commit 63b91e9

Please sign in to comment.
Something went wrong with that request. Please try again.