[obs-commits] [openSUSE/open-build-service] 09b8d8: [api] Refactor the attribute controller
Branch: refs/heads/master Home: https://github.com/openSUSE/open-build-service Commit: 09b8d88f480e33216322d0b826676c57d9646645 https://github.com/openSUSE/open-build-service/commit/09b8d88f480e33216322d0... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb M src/api/app/mixins/has_attributes.rb M src/api/config/routes.rb M src/api/test/functional/attributes_test.rb M src/api/test/unit/attribute_test.rb Log Message: ----------- [api] Refactor the attribute controller Extract functions and make the routes match the request - and quite some followup Commit: 63767e40a135c6f171f49530e7a6ebe0ed3d52ca https://github.com/openSUSE/open-build-service/commit/63767e40a135c6f171f495... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb Log Message: ----------- [api] Replace two post ifs with a block Commit: 5a7eaf7f161f890c9cb1bbe9c2012991ee524a89 https://github.com/openSUSE/open-build-service/commit/5a7eaf7f161f890c9cb1bb... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/mixins/has_attributes.rb M src/api/app/models/attrib.rb Log Message: ----------- [api] Refactor find_attribute function There is no need to use string where clauses Commit: 5e73c20f103ac9a524c2ddd3d96e1227ed5b5cd8 https://github.com/openSUSE/open-build-service/commit/5e73c20f103ac9a524c2dd... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/mixins/has_attributes.rb Log Message: ----------- [api] Do not rewrite exceptions for saving attributes if the namespace is not found, it's a 404 not a 400 Commit: f392f32f2eb5594cffe1423ce586990fec1eccca https://github.com/openSUSE/open-build-service/commit/f392f32f2eb5594cffe142... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/models/attrib.rb M src/api/spec/models/attrib_spec.rb Log Message: ----------- [api] Allow to resort attribute values update_with_associations ignored values that were the same after sorting, but this makes manual resorting impossible Commit: 9b21d67d739413f5b77aa697a222562b0a5593d6 https://github.com/openSUSE/open-build-service/commit/9b21d67d739413f5b77aa6... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/test/functional/source_controller_test.rb Log Message: ----------- [api] Make source controller test more reliable test_get_project_meta_history relies on no other test writing to kde4/_project, but that's not guaranteed. So replace the hard coded rev=1 with the revision we have before the actual test runs The underlying reason is that attribute creation and deletion now stores _attributes in the model (which was lost in cases before) Commit: 686cd04073a3f50fecd42c37bf86cd1fb226f283 https://github.com/openSUSE/open-build-service/commit/686cd04073a3f50fecd42c... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb M src/api/app/controllers/webui/attribute_controller.rb M src/api/app/mixins/has_attributes.rb M src/api/app/models/attrib.rb M src/api/lib/backend/api/sources/package.rb M src/api/lib/backend/api/sources/project.rb A src/api/spec/cassettes/BsRequestAction_Differ_QueryBuilder/_build/with_a_maintenance_release_target_project/has_proper_diff.yml M src/api/spec/factories/project.rb M src/api/spec/features/webui/attributes_spec.rb M src/api/spec/features/webui/maintenance_workflow_spec.rb M src/api/spec/models/attrib_spec.rb M src/api/spec/models/bs_request_action/differ/query_builder_spec.rb M src/api/spec/models/user_spec.rb M src/api/test/functional/attributes_test.rb Log Message: ----------- [frontend] Simplify storage of attributes into backend We need the _attributes file in the backend for revision storage, but the only code that actually wrote was the attribute controller in the api. All attributes created, updated or deleted through the webui weren't recorded as revision. So simplify the storage and let the model handle it. This way we don't have to duplicate the code too much. I added a write_attributes to the webui controller though as the API has tests that the revision is not increased on commits that do not update values (which is a bit questionable, but I didn't want to break tests) Commit: 77b5ebeae306fc50a1678a9d1acf588459f31b67 https://github.com/openSUSE/open-build-service/commit/77b5ebeae306fc50a1678a... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb M src/api/test/functional/attributes_test.rb Log Message: ----------- [api] Streamline rails usage in attribute controller Don't double check the route matching, use find_by_name where not overloaded by class methods Use before_filter instead of calling method Commit: c15ee7ec74eff25b8cec5ef78ac5a19ecaaaa054 https://github.com/openSUSE/open-build-service/commit/c15ee7ec74eff25b8cec5e... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb A src/api/app/controllers/attribute_namespace_controller.rb M src/api/config/routes.rb Log Message: ----------- [api] Split out attribute_namespace controller These routes are distinct in their requirements Commit: 718e78638f1095ab62598d3e256528af28ad5a70 https://github.com/openSUSE/open-build-service/commit/718e78638f1095ab62598d... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb M src/api/app/controllers/attribute_namespace_controller.rb A src/api/app/controllers/source_attribute_controller.rb R src/api/app/views/attribute/attribute_definition.xml.builder R src/api/app/views/attribute/namespace_definition.xml.builder A src/api/app/views/attribute/show.xml.builder A src/api/app/views/attribute_namespace/show.xml.builder M src/api/config/routes.rb Log Message: ----------- [api] Split out SourceAttributeController With this the 3 tasks of the attribute controller are clearly split: - Namespace handling in AttributeNamespace - Attribute definition in AttributeController - Attribute Containers in SourceAttributeController Commit: b41c687c299bdb36844be67e715f7889538f9ec5 https://github.com/openSUSE/open-build-service/commit/b41c687c299bdb36844be6... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/attribute_controller.rb Log Message: ----------- [api] Cleanup attribute controller a little Now that it only has one tasks, we can shorten the function names Commit: 7cd20dd23d7dfa51baff2bfe0e47d2e3fd475993 https://github.com/openSUSE/open-build-service/commit/7cd20dd23d7dfa51baff2b... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M src/api/app/controllers/source_attribute_controller.rb M src/api/app/controllers/webui/project_controller.rb M src/api/app/models/attrib_type.rb M src/api/app/models/user.rb M src/api/config/routes.rb M src/api/test/functional/attributes_test.rb Log Message: ----------- [api] Refactor SourceAttributeController Rely more on routes and on the model classes doing the proper things, this way we avoid duplicating code Commit: 368efa8940cf3d78d32511203c43ae065261a7ad https://github.com/openSUSE/open-build-service/commit/368efa8940cf3d78d32511... Author: Stephan Kulow <coolo@suse.de> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M ReleaseNotes-2.10 M src/api/test/functional/attributes_test.rb Log Message: ----------- [api] Document the removal of attribute routes Commit: 397520c39c861cb01864981d1d6b5b4bed5ff116 https://github.com/openSUSE/open-build-service/commit/397520c39c861cb0186498... Author: Stephan Kulow <stephan@kulow.org> Date: 2018-06-26 (Tue, 26 Jun 2018) Changed paths: M ReleaseNotes-2.10 M src/api/app/controllers/attribute_controller.rb A src/api/app/controllers/attribute_namespace_controller.rb A src/api/app/controllers/source_attribute_controller.rb M src/api/app/controllers/webui/attribute_controller.rb M src/api/app/controllers/webui/project_controller.rb M src/api/app/mixins/has_attributes.rb M src/api/app/models/attrib.rb M src/api/app/models/attrib_type.rb M src/api/app/models/user.rb R src/api/app/views/attribute/attribute_definition.xml.builder R src/api/app/views/attribute/namespace_definition.xml.builder A src/api/app/views/attribute/show.xml.builder A src/api/app/views/attribute_namespace/show.xml.builder M src/api/config/routes.rb M src/api/lib/backend/api/sources/package.rb M src/api/lib/backend/api/sources/project.rb A src/api/spec/cassettes/BsRequestAction_Differ_QueryBuilder/_build/with_a_maintenance_release_target_project/has_proper_diff.yml M src/api/spec/factories/project.rb M src/api/spec/features/webui/attributes_spec.rb M src/api/spec/features/webui/maintenance_workflow_spec.rb M src/api/spec/models/attrib_spec.rb M src/api/spec/models/bs_request_action/differ/query_builder_spec.rb M src/api/spec/models/user_spec.rb M src/api/test/functional/attributes_test.rb M src/api/test/functional/source_controller_test.rb M src/api/test/unit/attribute_test.rb Log Message: ----------- Merge pull request #5165 from coolo/attribute_events2 More attribute refactoring Compare: https://github.com/openSUSE/open-build-service/compare/2d29d7398b5d...397520... **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
participants (1)
-
Stephan Kulow