Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor update the project / workflow contents #2289

Merged
merged 4 commits into from
Apr 3, 2017

Conversation

camallen
Copy link
Contributor

@camallen camallen commented Apr 3, 2017

closes #2212, second attempt at #2169

Refactor the controller actions to not require the content relations in the extended_cache_key. Also ensure we touch the parent translated resource when updating the content child relations, think just content updates like workflow task text changes.

Review checklist

  • First, the most important one: is this PR small enough that you can actually review it? Feel free to just reject a branch if the changes are hard to review due to the length of the diff.
  • If there are any migrations, will they the previous version of the app work correctly after they've been run (e.g. the don't remove columns still known about by ActiveRecord).
  • If anything changed with regards to the public API, are those changes also documented in the apiary.apib file?
  • Are all the changes covered by tests? Think about any possible edge cases that might be left untested.

camallen added 2 commits April 3, 2017 15:16
ensure the parent model gets the updated_at timestamp touched to invalidate any cache keys
yield ps if block_given?
content = ps.slice(*content_fields)
content[:language] = ps[:primary_language]
if ps.has_key? :urls

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Hash#key? instead of Hash#has_key?.

end
reject_live_project_changes(workflow, update_params)
def build_update_hash(update_params, resource)
if update_params.has_key? :tasks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Hash#key? instead of Hash#has_key?.

resource.tags = tags unless tags.nil?

if !content_attributes.blank? || !tags.nil?
resource.updated_at = Time.zone.now
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably just allow the tag belongs_to to touch the project resource here instead of manually setting the TS for the save action.

Copy link
Contributor

@marten marten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but it'd be nice to test this out on staging

@camallen camallen merged commit 702f2c5 into zooniverse:master Apr 3, 2017
@camallen camallen deleted the fix_revert_update_touch_pr branch April 4, 2017 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PUT request for changing a task's text do not save on the backend
3 participants