Skip to content
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

Hide the "respond" UI items when not logged in #824

Merged
merged 3 commits into from
Jan 20, 2021

Conversation

h-m-m
Copy link
Collaborator

@h-m-m h-m-m commented Jan 18, 2021

Why

This addresses one of the items in #819

We'll probably want more logic involved later. For now, it's okay hide all "respond" UI items when not logged in. The only time they should show up for users not logged in is when the system is in peer-to-peer mode

Pre-Merge Checklist

  • All new features have been described in the pull request
  • Security & accessibility have been considered
  • All outstanding questions and concerns have been resolved
  • Any next steps that seem like good ideas have been created as issues for future discussion & implementation
  • High quality tests have been added, or an explanation has been given why the features cannot be tested
  • New features have been documented, and the code is understandable and well commented
  • Entry added to CHANGELOG.md if appropriate

What

Also, I added some tests, pulling some test data from my dev environment

When not logged in, viewing tiles:
Screen Shot 2021-01-18 at 2 01 46 PM

When not logged in, viewing the list:

Screen Shot 2021-01-18 at 2 01 40 PM

When logged in viewing tiles:
Screen Shot 2021-01-18 at 2 02 04 PM

When logged in viewing the list:
Screen Shot 2021-01-18 at 2 01 16 PM

How

The two key changes are

  • a line in the controller that makes the respond link conditional
  • a line in the list view that hides the "Respond" header of no controllers have data for it

Testing

Next Steps

Outstanding Questions, Concerns and Other Notes

Accessibility

This should not change accessibility as it makes an existing UI element entirely hidden conditionally

Security

This is pretty reasonable, security-wise. The decision to expose the information is being made server-side, so there's no way a user could spy on the info only from the client. That, and the URLs that are being exposed have authorization controls around them, so there's not much risk if they were exposed.

Meta

@h-m-m
Copy link
Collaborator Author

h-m-m commented Jan 18, 2021

Please critique my Vue and JS testing, as it's been since whenever I last touched JS on this project that I wrote anything in Vue or tried to test JS. I'm particularly interested in cleaner ways of expressing the tests due to not remembering all the methods that are available

Copy link
Collaborator

@solebared solebared left a comment

Choose a reason for hiding this comment

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

LGTM! Made some vue-testing suggestions as requested, though nothing that necessarily needs changed.

Not specific to this PR but i'm not a fan of using big chunks of json fixture data in specs. Among other issues, they often change drastically between commits and it's very difficult to know what part of the diff were germane to the code/spec changes and what is coincidental.

app/javascript/pages/browse/ListBrowser.vue Outdated Show resolved Hide resolved
spec/javascript/pages/browse/ListBrowser.spec.js Outdated Show resolved Hide resolved
spec/javascript/pages/browse/ListBrowser.spec.js Outdated Show resolved Hide resolved
@h-m-m
Copy link
Collaborator Author

h-m-m commented Jan 19, 2021

LGTM! Made some vue-testing suggestions as requested, though nothing that necessarily needs changed.

Thanks!

Not specific to this PR but i'm not a fan of using big chunks of json fixture data in specs. Among other issues, they often change drastically between commits and it's very difficult to know what part of the diff were germane to the code/spec changes and what is coincidental.

I agree with those negatives. I'd still some way to verify that the data that we expect Rails to emit is then consumed properly by by the JS. Do you have any suggestions for that?

@h-m-m h-m-m force-pushed the conditionally-hide-contribution-response branch from 35792b2 to 2498c31 Compare January 19, 2021 15:11
@h-m-m h-m-m marked this pull request as ready for review January 19, 2021 15:13
@solebared solebared mentioned this pull request Jan 19, 2021
13 tasks
Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

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

Love it!

@@ -16,6 +16,7 @@ This changelog also serves to acknowledge the incredible people who've contribut
* Allow custom text on landing page to override default text #769, #780
* Add Rubocop #793
* Show the "Contributions" link in the navbar for P2P users even if they aren't logged in
* Hide the respond button on contributions when nobody is logged in. (We'll add more functionality later for the peer-to-peer scneario) #819
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

@@ -1,16 +1,36 @@
import {assert} from 'chai'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why isn't assert needed from chai anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that's because our setup.js file brings it in, and that setup file is explicitly included in

"test": "mochapack --webpack-config config/webpack/test.js --require spec/javascript/setup.js --colors -u bdd-lazy-var/global 'spec/javascript/**/*.spec.js'"

@solebared solebared merged commit 83125fe into main Jan 20, 2021
@solebared solebared deleted the conditionally-hide-contribution-response branch January 20, 2021 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants