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

Already on GitHub? Sign in to your account

AO3-5148: Fix broken redirect when replying from inbox #3032

Merged
merged 3 commits into from Sep 8, 2017

Conversation

Projects
None yet
4 participants
Owner

elzj commented Sep 7, 2017

Issue

https://otwarchive.atlassian.net/browse/AO3-5148

Purpose

Fixes issue where replying to a comment from your inbox, with filters set, would error after creating the reply and attempting to redirect you. Also fixes the same issue with the review action from the inbox, and adds a couple of checks for a potentially nil request.referer.

Testing

Replying to and approving comments from the inbox should work with or without filters set.

elzj added some commits Sep 7, 2017

- if request.referer.match(/inbox/)
- redirect_to user_inbox_path(current_user, filters: params[:filters], page: params[:page])
- elsif request.referer.match(/new/)
+ if request.referer&.match(/inbox/)
@houndci-bot

houndci-bot Sep 7, 2017

Avoid more than 3 levels of block nesting.

@@ -331,7 +331,7 @@ def review
respond_to do |format|
format.html do
if params[:approved_from] == "inbox"
- redirect_to user_inbox_path(current_user, page: params[:page], filters: params[:filters]) and return
+ redirect_to user_inbox_path(current_user, page: params[:page], filters: filter_params[:filters]) and return
@houndci-bot

houndci-bot Sep 7, 2017

Use && instead of and.

Contributor

zz9pzza commented Sep 7, 2017

It looks reasonable to me, but I can hear the requests for tests :)

Owner

sarken commented Sep 7, 2017

james nailed it ;)

@sarken sarken merged commit a579e45 into otwcode:master Sep 8, 2017

3 of 4 checks passed

codeclimate 2 issues to fix
Details
Scrutinizer 9 new issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound 2 violations found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment