noosfero | Adds migration to update topic_creation and wall_access types (9d1892a2)
Gabriel Silva
gitlab at mg.gitlab.com
Sun Jan 22 13:49:50 BRST 2017
New comment for Commit 9d1892a2 on db/migrate/20170120221747_update_access_level_settings.rb:
https://gitlab.com/noosfero/noosfero/commit/9d1892a22030d0a4e0e5eb7eac818480111fb7f0#note_21826804
> + data = YAML.load(person['data'] || {}.to_yaml)
> + data[:wall_access] = valid_levels[data[:wall_access]] || valid_levels['self']
> + update("UPDATE profiles SET data=#{connection.quote(data.to_yaml)} WHERE id=#{person['id']}")
> + end
> +
> + select_all("SELECT id, setting FROM articles WHERE type='Forum' AND setting LIKE '%:topic_creation:%'").each do |forum|
> + data = YAML.load(forum['setting'] || {}.to_yaml)
> + data[:topic_creation] = valid_levels[data[:topic_creation]] || valid_levels['self']
> + update("UPDATE articles SET setting=#{connection.quote(data.to_yaml)} WHERE id=#{forum['id']}")
> + end
> + end
> +
> + def down
> + say "this migration can't be reverted"
> + end
> +end
@diguliu this is the migration I have in mind. `users` is the only label being translated, the rest shall be fine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170122/4c53b2e0/attachment.html>
More information about the Noosfero-dev
mailing list