samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
184 stars 124 forks source link

Sipity::Workflow.activate! should be idempotent #2151

Closed jeremyf closed 6 years ago

jeremyf commented 6 years ago

The current state of documentation says the following:

Calling #activate! on a Sipity::Workflow a second time will deactivate that workflow. If you want your workflow setup script to be idempotent, you should add a check to see if it is already activated.

https://github.com/samvera/samvera.github.io/commit/30a31995769199d6ce5b06107cbda7d09d68e447#diff-c813ad58bd3e03065da783330bfbe7c8R77

I believe the following is the expected behavior:

Given a `Sipity::Workflow` object that is active == true
When I call `Sipity::Workflow.activate!` with the given workflow
Then the given Sipity::Workflow will still be active == true

The reported behavior is:

Given a `Sipity::Workflow` object that is active == true
When I call `Sipity::Workflow.activate!` with the given workflow
Then the given Sipity::Workflow is active == false
bess commented 6 years ago

👍 I wrote this documentation and can confirm this is the behavior I see when setting up a Hyrax project

mjgiarlo commented 6 years ago

As part of this work, pls also remove this TODO: https://github.com/samvera/hyrax/pull/2150/files#diff-2fdd2e6a4cf83fbbca6fdd8ba6b17fafR43

elrayle commented 6 years ago

@laritakr @bess @jeremyf Are there steps for testing this through the UI?

laritakr commented 6 years ago

@mjgiarlo Before my change, if you went to the tab to update the workflow and saved it with the same one marked, it would be deactivated. It now keeps whichever one active that you mark and save.

julesies commented 6 years ago

I tested this on nurax and don't experience this bug.