noosfero | WIP: Improvements on AccessLevel class, in order to center how noosfero display content to users. (!1361)

Rodrigo Souto gitlab at mg.gitlab.com
Tue Dec 19 13:08:11 BRST 2017


Rodrigo Souto started a new discussion on app/concerns/levels.rb:

>  class Levels
> +  # This helper is used to retrieve a level based on the slider option selected
> +  # by the user.
> +  module SliderHelper

It's not sustainable to keep this "kind checking" on modules. Maybe we should pass a symbol as parameter to `update_content_access` indicating what kind of access should be updated. This way we solve the "kind checking" problem and also enable the possibility of having multiple different accesses on a single model.

Something like:
```
def update_content_access(access, level)
  access_level = self.send(#{access}_access_levels)[level.to_i]
  self.send("#{access}_access=", Levels.levels[access_level])
end

...

profile.update_content_access(:wall, 3)
```

Also instead of `update_content_access`, what do you think about `update_access_level` as signature for this method?

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1361#note_52002019
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20171219/ee749d35/attachment.html>


More information about the Noosfero-dev mailing list