Skip to content

Automatically switch to post's organization on post show #384

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 9, 2018

Conversation

enricostano
Copy link
Contributor

@enricostano enricostano commented Jun 21, 2018

WAT

Context: user that pertains to multiple time banks.

Right now visiting /offers/666 the app will 💥 if the time bank the user selected is different than the requested Offer's organization.

Until now this was fine, but since we're introducing mobile push notifications we'll need to deal with this case. The proposed solution is to witch to the Post's organization if the user is an active member of it.

This is of course a temporary solution/hack ™️ until we finally tackle resources scoping under /organization.

Test

OffersController
  GET #show
    when the user is logged in
      when the requested offer
        is not active
          renders the 404 page
        is active
          and the user that created the offer is not active anymore
            renders the 404 page
          and the user that created the offer is active
            renders a successful response
            assigns the account destination of the transfer
            displays the offer's user details
            assigns the requested offer to @offer
      when the user pertains to multiple organizations
        and user's current organization is different than offer's organization
          displays the offer's user details
          sets the offer's organization as user's current organization
    when the user is not logged in
      assigns the requested offer to @offer
      doesn't display the offer's user details
    when the user is not a member of the organization where the offer is published
      doesn't display the offer's user details

@enricostano enricostano self-assigned this Jun 21, 2018
@enricostano enricostano changed the base branch from fix/set-current-org to develop July 3, 2018 09:52
@enricostano enricostano force-pushed the feature/set-current-org-on-post-show branch from 6c7d86e to 5b47720 Compare July 3, 2018 09:53
Copy link
Collaborator

@markets markets left a comment

Choose a reason for hiding this comment

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

cool hack @enricostano!

temporary they said... :trollface:

@sseerrggii
Copy link
Contributor

sseerrggii commented Jul 10, 2018

Looks good to me but I want to test more 😨

The login button was in the same line

Before

fireshot capture 91 - - https___www timeoverflow org_offers_24506

Now

fireshot capture 90 - - https___staging timeoverflow org_offers_25

@enricostano
Copy link
Contributor Author

enricostano commented Jul 11, 2018

The login button was in the same line

@sseerrggii yep, much easier to implement this way. In any case we'll need to review this UI at some point. Can we leave it separated for now?

EDIT: switch to English language to see how the text changed. We'll need to translate it after we merge this PR.

@sseerrggii
Copy link
Contributor

Test a little more, everything seems to work fine 👍

@enricostano enricostano merged commit c4fb4aa into develop Aug 9, 2018
@enricostano enricostano deleted the feature/set-current-org-on-post-show branch August 9, 2018 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants