noosfero | Removes settings_item default value translation (!1089)

Gabriel Silva gitlab at mg.gitlab.com
Fri Jan 20 22:20:22 BRST 2017


New comment for Merge Request !1089 on db/migrate/20170120221747_update_access_level_settings.rb:

https://gitlab.com/noosfero/noosfero/merge_requests/1089#note_21788866

> +      data = YAML.load(person['data'] || {}.to_yaml)
> +      data[:wall_access] = valid_levels[data[:wall_access]]
> +      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]]
> +      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/20170121/03f89781/attachment-0001.html>


More information about the Noosfero-dev mailing list