Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

DownloadCracker tutorial step #385

Merged
merged 3 commits into from
Feb 13, 2018

Conversation

renatomassaro
Copy link
Member

@renatomassaro renatomassaro commented Feb 12, 2018

Most of this PR work was directed to making the Storyline message flow more flexible

  • Add Step.callback_actions:

    • {:send_email, email_id, email_meta, send_opts}
    • {:send_reply, reply_id, send_opts}
  • Redesigned Steps to have emails and replies, both of which are messages (emails may only be sent by the NPC, while replies may only sent by the player).

    • Implementation
    • Fix specs
  • New reply and on_email macros

  • Clean up PoC implementation

  • Doc everything

  • Prepare the transition to the next step after DownloadCracker

Incidental

  • Event.emit_after with support for Event.relay
  • Breakdown of Listenable macros into listenable/1 and listen/2.
  • Added flush helper on Event.State.Timer for testing and system restarts
  • Enhanced callbacks and story_listen macro on Step.Macros
  • Added on_process_started listener macro on Step.Macros
  • assert_reply/5 helper/macro for Helix.Test.Story.Macros
  • Now the Listener.meta has its keys automatically atomized for ease of use.

This change is Reviewable

@renatomassaro
Copy link
Member Author

Reviewed 28 of 31 files at r1, 5 of 5 files at r2.
Review status: all files reviewed at latest revision, 8 unresolved discussions.


lib/core/listener/event/handler/listener.ex, line 20 at r2 (raw file):

  """
  def listener_handler(event) do
    # OPTMIZE: There's room for optimization on this function. Some events may

OPTIMIZE (missing an i). This is actually quite important because this is a tag, and project-wide ag/grep wouldn't find it.


lib/event/dispatcher.ex, line 245 at r2 (raw file):

    StoryHandler.Story,
    :event_handler

Add this info to events.json


lib/software/process/file/transfer.ex, line 218 at r2 (raw file):

    end

    # REVIEW: `upload` should use a `source_file`, no?

Review


lib/story/action/story.ex, line 130 at r2 (raw file):

        {:ok, _, email} <- EmailInternal.send_reply(step, reply_id),
        {:ok, _} <- StepInternal.lock_reply(step, reply_id),
        {:ok, _} <- StepInternal.save_email(step, reply_id)

Maybe tag as OPTIMIZE as well?


lib/story/event/handler/story.ex, line 124 at r2 (raw file):

  end

  defp handle_action({:send_email, email_id, meta, opts}, step, _story_step) do

docp


lib/story/event/handler/story.ex, line 132 at r2 (raw file):

  end

  defp handle_action({:send_reply, reply_id, opts}, step, story_step) do

docp


lib/story/event/handler/story.ex, line 208 at r2 (raw file):

  end

  defp emit(event, from: source_event),

docp


lib/story/model/step/macros.ex, line 388 at r2 (raw file):

              end

            [do: :complete, send_opts: send_opts] ->

Not do: complete (conflicts with do: block) OR not :complete


Comments from Reviewable

@renatomassaro
Copy link
Member Author

Reviewed 7 of 7 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@renatomassaro
Copy link
Member Author

Reviewed 1 of 1 files at r4.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@renatomassaro renatomassaro merged commit 41f2031 into HackerExperience:master Feb 13, 2018
@renatomassaro renatomassaro deleted the tutorial-dlcrc branch February 13, 2018 10:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant