Simplify state, return state only when we need it #219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #177
Remove useless state assignment and return state only when we need it
ASKING_REPLY_FEEDBACK
state is replaced byinput.startsWith(UPVOTE_PREFIX or DOWNVOTE_PREFIX)
.context.state
is mainly used for postback message. But now it's also used to distinguish stateASKING_ARTICLE_SUBMISSION_CONSENT
andASKING_REPLY_REQUEST_REASON
frominput.startsWith(SOURCE_PREFIX)
. Maybe we can use different prefixes for them in the future.Move reason message handler from [initState] to [askingReplyRequestReason]
initState
) toASKING_REPLY_REQUEST_REASON
.I don't update test in this PR, so we can see if there's fatal test fail after this refactoring.
Will fix test in another PR.
handles reason LIFF
should test in [askingReplyRequestReason.test].processes first article reason submission
is wrong,REASON_PREFIX
was processed in [initState] not [askingArticleSubmissionConsent].should block incorrect prefix
shouldn't inputREASON_PREFIX
now.