{"action":"created","issue":{"url":"https://api.github.com/repos/opf/openproject/issues/3270","labels_url":"https://api.github.com/repos/opf/openproject/issues/3270/labels{/name}","comments_url":"https://api.github.com/repos/opf/openproject/issues/3270/comments","events_url":"https://api.github.com/repos/opf/openproject/issues/3270/events","html_url":"https://github.com/opf/openproject/pull/3270","id":96776083,"number":3270,"title":"Typed Settings","user":{"login":"NobodysNightmare","id":453584,"avatar_url":"https://avatars.githubusercontent.com/u/453584?v=3","gravatar_id":"","url":"https://api.github.com/users/NobodysNightmare","html_url":"https://github.com/NobodysNightmare","followers_url":"https://api.github.com/users/NobodysNightmare/followers","following_url":"https://api.github.com/users/NobodysNightmare/following{/other_user}","gists_url":"https://api.github.com/users/NobodysNightmare/gists{/gist_id}","starred_url":"https://api.github.com/users/NobodysNightmare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NobodysNightmare/subscriptions","organizations_url":"https://api.github.com/users/NobodysNightmare/orgs","repos_url":"https://api.github.com/users/NobodysNightmare/repos","events_url":"https://api.github.com/users/NobodysNightmare/events{/privacy}","received_events_url":"https://api.github.com/users/NobodysNightmare/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/opf/openproject/labels/housekeeping","name":"housekeeping","color":"dd99dd"},{"url":"https://api.github.com/repos/opf/openproject/labels/work%20in%20progress","name":"work in progress","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-23T10:03:49Z","updated_at":"2015-07-23T12:37:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/opf/openproject/pulls/3270","html_url":"https://github.com/opf/openproject/pull/3270","diff_url":"https://github.com/opf/openproject/pull/3270.diff","patch_url":"https://github.com/opf/openproject/pull/3270.patch"},"body":"## Work Package\r\n\r\nI see this PR as part of general housekeeping tasks around OpenProject: https://community.openproject.org/work_packages/18714\r\n\r\n## Description\r\n\r\nCalling `Setting.foo_setting` currently most of the times returns a string in many cases where you actually expect other types to be returned (such as numbers and booleans).\r\n\r\nThis PR proposes to use the already existing and sporadically used `format` option of the settings to correctly type the return value of `Setting` calls.\r\n\r\nI can see this breaking in many places, because currently code is written like this:\r\n\r\n````\r\nif Setting.foo_setting == '1'\r\n  call_me Setting.bar_setting.to_i\r\nend\r\n````\r\n\r\nBut I think I should be worth it long-term-ish. Just want to gather some feedback before adding format information to the whole `settings.yml`.\r\n\r\n## Considerations\r\n\r\n* stuff will break\r\n* you need to clear the rails cache for changes in return values to become visible"},"comment":{"url":"https://api.github.com/repos/opf/openproject/issues/comments/124082343","html_url":"https://github.com/opf/openproject/pull/3270#issuecomment-124082343","issue_url":"https://api.github.com/repos/opf/openproject/issues/3270","id":124082343,"user":{"login":"linki","id":36162,"avatar_url":"https://avatars.githubusercontent.com/u/36162?v=3","gravatar_id":"","url":"https://api.github.com/users/linki","html_url":"https://github.com/linki","followers_url":"https://api.github.com/users/linki/followers","following_url":"https://api.github.com/users/linki/following{/other_user}","gists_url":"https://api.github.com/users/linki/gists{/gist_id}","starred_url":"https://api.github.com/users/linki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linki/subscriptions","organizations_url":"https://api.github.com/users/linki/orgs","repos_url":"https://api.github.com/users/linki/repos","events_url":"https://api.github.com/users/linki/events{/privacy}","received_events_url":"https://api.github.com/users/linki/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T12:37:05Z","updated_at":"2015-07-23T12:37:05Z","body":":+1: for typed settings (and configuration). the implementation is terrible. (no offense, it fits the rest of the code.) i would seriously consider refactoring that part at some point as settings are a very central aspect. therefore, i strongly suggest you to write some tests for this."}}