Skip to content

Log assembly creation, update and (un)publication#2858

Merged
mrcasals merged 8 commits intomasterfrom
log/assemblies-actions
Mar 1, 2018
Merged

Log assembly creation, update and (un)publication#2858
mrcasals merged 8 commits intomasterfrom
log/assemblies-actions

Conversation

@mrcasals
Copy link
Copy Markdown
Contributor

@mrcasals mrcasals commented Feb 28, 2018

🎩 What? Why?

Logs assembly creation, publication and unpublication.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry

📷 Screenshots (optional)

Description

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 28, 2018

Codecov Report

Merging #2858 into master will increase coverage by 20.54%.
The diff coverage is 98.79%.

@@             Coverage Diff             @@
##           master    #2858       +/-   ##
===========================================
+ Coverage   78.18%   98.73%   +20.54%     
===========================================
  Files         474     1645     +1171     
  Lines        8693    39019    +30326     
===========================================
+ Hits         6797    38525    +31728     
+ Misses       1896      494     -1402

@mrcasals mrcasals force-pushed the log/assemblies-actions branch from 58d989c to 24e0862 Compare February 28, 2018 14:56
@mrcasals mrcasals changed the title Log assembly creation and (un)publication Log assembly creation, update and (un)publication Feb 28, 2018
def update_assembly
@assembly.assign_attributes(attributes)
@assembly.save! if @assembly.valid?
if @assembly.valid?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be wrapped in a transaction? Otherwise the assembly could be created without the log being updated.

Maybe it could be put inside the perform_action block so it has an implicit transaction? It could be a good pattern to future-proof this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wrapped the save and log creation. The valid? call does not need to be inside the transaction

authorize! :publish, current_assembly

UnpublishAssembly.call(current_assembly) do
UnpublishAssembly.call(current_assembly, current_user) do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Food for thought: Maybe we should do with commands the same we've done with form: Provide a command(symbol) helper that populates the contextual fields by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But you don't know if you need the form for a given command or not

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess you mean user xD. Same happens with controllers though. Not sure if it's a good approach, but looks like it's something we'll end up setting in most commands if we're tracing every change.

@mrcasals mrcasals force-pushed the log/assemblies-actions branch from 37a4d52 to edb95c6 Compare March 1, 2018 09:11
@mrcasals mrcasals force-pushed the log/assemblies-actions branch from edb95c6 to 7e5ab5c Compare March 1, 2018 09:29
@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Mar 1, 2018

Build is green, but it looks like GitHub is limiting the success commit statuses:

GitHub rate limited us while adding a commit status of success: You have triggered an abuse detection mechanism. Please wait a few minutes before you try again.

https://circleci.com/workflow-run/dcbd5471-2ba1-4db6-8fde-554a6775873e

Merging!

@mrcasals mrcasals merged commit 697c1db into master Mar 1, 2018
@mrcasals mrcasals deleted the log/assemblies-actions branch March 1, 2018 10:47
@ghost ghost removed the in-review label Mar 1, 2018
@mrcasals mrcasals modified the milestones: Release v.0.10.0, CDP2 Dec 10, 2018
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.

2 participants