-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #381 from decko-commons/subcards
tweaks to subcard handling
- Loading branch information
Showing
25 changed files
with
203 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.8.0 | ||
0.8.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
class Card | ||
class ActManager | ||
# methods for handling delayed events | ||
module EventDelay | ||
# If active jobs (and hence the integrate_with_delay events) don't run | ||
# in a background process then Card::Env.deserialize! decouples the | ||
# controller's params hash and the Card::Env's params hash with the | ||
# effect that params changes in the CardController get lost | ||
# (a crucial example are success params that are processed in | ||
# CardController#soft_redirect) | ||
def contextualize_delayed_event act_id, card, env, auth | ||
if delaying? | ||
contextualize_for_delay(act_id, card, env, auth) { yield } | ||
else | ||
yield | ||
end | ||
end | ||
|
||
def delaying? | ||
const_defined?("Delayed") && | ||
Delayed::Worker.delay_jobs && | ||
Card.config.active_job.queue_adapter == :delayed_job | ||
end | ||
|
||
# The whole ActManager setup is gone once we reach a integrate with delay | ||
# event processed by ActiveJob. | ||
# This is the improvised resetup to get subcards working. | ||
def contextualize_for_delay act_id, card, env, auth, &block | ||
self.act = Act.find act_id if act_id | ||
with_env_and_auth env, auth do | ||
return yield unless act | ||
|
||
run_act(act.card || card) do | ||
act_card.director.run_delayed_event act, &block | ||
end | ||
end | ||
end | ||
|
||
def with_env_and_auth env, auth | ||
Card::Auth.with auth do | ||
Card::Env.with env do | ||
yield | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.