plots2 icon indicating copy to clipboard operation
plots2 copied to clipboard

rss feeds empty for banned users

Open btbonval opened this issue 12 years ago • 30 comments

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

The problem

The code for RSS exposes banned users, but blocks their research notes from the RSS feed. See these lines: https://github.com/publiclab/plots2/blob/master/app/controllers/users_controller.rb#L154-L163

It'd be better if the banned user was treated as non-existent, as is done with the profile.

Solution

Modify @author = DrupalUsers.find_by_name params[:author] to include status. This can be done using this query

@author = DrupalUsers.find_by_name_and_status( params[:author], 1 )

Steps to Fix

  • [ ] claim this issue with a comment here, below, and ask any clarifying questions you need
  • [ ] set up a repository locally following the README instructions, and make sure that all tests pass
  • [ ] try to fix the issue following the steps above, but even before you're done, you can:
  • [ ] commit your changes and start a pull request (see contributing to Public Lab software) but mark it as "in progress" if you have questions or if you haven't finished
  • [ ] alert someone via the developers list (see below) to have your pull request merged. This may take a few extra steps depending on when you do it, but we'll help you out!

Please email the developers list (see https://publiclab.org/wiki/developers) if you have questions, and take a look at our first-timers landing page for more information!

btbonval avatar Oct 17 '14 20:10 btbonval

I think it'd be using a User.where(status: 1, username: params[:author]) call!

jywarren avatar Nov 15 '16 00:11 jywarren

I'd like to try to work on this!

FlameFractal avatar Dec 18 '16 16:12 FlameFractal

That'd be great -- thank you and we're happy to help.

On Sun, Dec 18, 2016 at 11:40 AM, Flame Fractal [email protected] wrote:

I'd like to work on this!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-267831384, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ2DrTkadlmXxQzZe6vB-d-4JMtJbks5rJWHvgaJpZM4CwHX0 .

jywarren avatar Dec 18 '16 16:12 jywarren

@FlameFractal If you don't mind can look at other first-timer issues not labelled with the gcin label. This will be made as an Google Code-in Task.

ananyo2012 avatar Dec 18 '16 17:12 ananyo2012

Sorry, didn't know that. It's just that all of the 9 issues currently in first-timers-only appeared to be claimed, albeit many of 'em not updated in a while, I didn't wanna barge in their progress!

FlameFractal avatar Dec 18 '16 17:12 FlameFractal

Not a problem! Perhaps there's a first timers issue someone's been stuck on to a while and could use another set of eyes on it?

On Dec 18, 2016 12:23 PM, "Flame Fractal" [email protected] wrote:

Sorry, didn't know that. It's just that all of the 9 issues currently in first-timers-only https://github.com/publiclab/plots2/labels/first-timers-only appeared to be claimed, albeit not updated in a while, I didn't wanna barge in their progress!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-267833922, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ8CtyJbfZ3t7sCAcBIG-xe5C05geks5rJWwCgaJpZM4CwHX0 .

jywarren avatar Dec 18 '16 17:12 jywarren

Uh there are some fto-candidate issues that you can see in the mean time. They are close to becoming first-timer issues. In fact they will be made first-timer issues soon.

ananyo2012 avatar Dec 18 '16 17:12 ananyo2012

Hi, @FlameFractal -- GCI has wrapped up and this one is still up for grabs -- we'd love to have your contribution here if you're still interested!

jywarren avatar Feb 03 '17 16:02 jywarren

@jywarren Does this issue still need someone to look at it? I'd be happy to work on this over the next several days. Thanks!

jbkimble avatar Feb 25 '17 17:02 jbkimble

It seems to still be open, please take a try!

On Feb 25, 2017 12:46 PM, "Jon Kimble" [email protected] wrote:

@jywarren https://github.com/jywarren Does this issue still need someone to look at it? I'd be happy to work on this over the next several days. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-282499834, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ8eJFsvprzs9PKcjdgvBkBqDzo8eks5rgGj3gaJpZM4CwHX0 .

jywarren avatar Feb 25 '17 19:02 jywarren

@jywarren Awesome, I'm on it!

jbkimble avatar Feb 25 '17 22:02 jbkimble

@jywarren Hi there, would be interested in taking this on. If it isn't otherwise claimed as in progress. Didn't see a PR up that matched. Thought I'd ask.

Sh1pley avatar Mar 27 '17 16:03 Sh1pley

Yes please! Thank you!

On Mar 27, 2017 12:38 PM, "Jesse Shipley" [email protected] wrote:

@jywarren https://github.com/jywarren Hi there, would be interested in taking this on. If it isn't otherwise claimed as in progress. Didn't see a PR up that matched. Thought I'd ask.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-289510257, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ08ni0x9gesEk0EheSWLnlZwNyD9ks5rp-XogaJpZM4CwHX0 .

jywarren avatar Mar 28 '17 20:03 jywarren

@jywarren got it all installed locally and ran tests, got one failure: screen shot 2017-03-29 at 11 19 26 am

Is this something I should just press on from (known issue) or something that is broken on my side? seems from the error message that its a fail based on expected order? Not 100% sure as I haven't completely dove in to the code base around it yet.

Sh1pley avatar Mar 29 '17 17:03 Sh1pley

hi sorry for being late i want to apply for gsoc and looking for first time bug is there any ? which i can take?

sharawatankit avatar Mar 30 '17 20:03 sharawatankit

Hey, thank you for the email. I am excited to get started with Open Source. I am a student at the Turing School of Software & Design, and have been learning back end Rails apps for the last 6 months. I dove into the code base and see how the author .find_by_id and status is used in the users controller. I see that rss is a separate route, but a little foggy on implementing the rss to ignore a banned user, as the users controller already doesn’t parse their notes. Is this a change that should live in the users controller, users model, or somewhere in the rss service?

Haha, sorry for all of my questions out of the gate, pretty excited to get started on a preexisting app.

Thanks,

Jesse

On Mar 30, 2017, at 2:38 PM, ankit [email protected] wrote:

hi sorry for being late i want to apply for gsoc and looking for first time bug is there any ? which i can take?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-290537701, or mute the thread https://github.com/notifications/unsubscribe-auth/ALdxssiowExlrzD9U5Ove0JTfxlgkMnMks5rrBLLgaJpZM4CwHX0.

Sh1pley avatar Mar 31 '17 03:03 Sh1pley

Hi, Jesse, it does look like an ordering issue. I wonder if it's related to timestamps, perhaps? Does it happen every time you run tests?

We may be able to ignore it if it does not happen on tests on our TravisCI testing service once you submit a commit, but we should probably pin down the problem anyways.

As to where to screen for banned users, I believe RSS feeds are assembled in the feeds controller. We can likely add a filter for user status to the activerecord queries there. I'm happy to offer more help if you need!

Ankit, please check out our welcome page at http://github.com/publiclab/plots2/projects/2, we're happy to have you help!

On Mar 30, 2017 10:18 PM, "Jesse Shipley" [email protected] wrote:

Hey, thank you for the email. I am excited to get started with Open Source. I am a student at the Turing School of Software & Design, and have been learning back end Rails apps for the last 6 months. I dove into the code base and see how the author .find_by_id and status is used in the users controller. I see that rss is a separate route, but a little foggy on implementing the rss to ignore a banned user, as the users controller already doesn’t parse their notes. Is this a change that should live in the users controller, users model, or somewhere in the rss service?

Haha, sorry for all of my questions out of the gate, pretty excited to get started on a preexisting app.

Thanks,

Jesse

On Mar 30, 2017, at 2:38 PM, ankit [email protected] wrote:

hi sorry for being late i want to apply for gsoc and looking for first time bug is there any ? which i can take?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/publiclab/plots2/issues/171#issuecomment-290537701>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ ALdxssiowExlrzD9U5Ove0JTfxlgkMnMks5rrBLLgaJpZM4CwHX0>.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/171#issuecomment-290605051, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJwfG-XIYUykzpkY9s9e9HK-ZGixZks5rrHCFgaJpZM4CwHX0 .

jywarren avatar Mar 31 '17 12:03 jywarren

@jywarren Yeah same fail on each run. I will look past it and work on the RSS card, and like you said let Travis and his all seeing-ness catch it, if its actually an issue.

Sh1pley avatar Apr 01 '17 04:04 Sh1pley

@jywarren Also one more question. Is there a possible banned user that I can try and send a request to /feed/:author to see what the current response is. And I am assuming that the desired response is just 404 if specified author has been banned? like it/they never existed?

thanks again.

Sh1pley avatar Apr 01 '17 04:04 Sh1pley

Hi, thanks -- looks like Travis doesn't care, so maybe we should open a separate issue. It is odd though! The test is here: https://github.com/publiclab/plots2/blob/master/test/functional/tag_controller_test.rb#L117 and maybe there's something to do with sqlite ordering... sometimes these kinds of failures can be quite subtle.

Anyhow I see your changes at #1361 -- thanks! I think a 404 would be perfect. Do you think this behavior merits a test, perhaps in https://github.com/publiclab/plots2/blob/master/test/functional/users_controller_test.rb ? Note that we haven't been testing for user rss feeds, but it'd be pretty easy to write one for the basic feed and then one for a banned user (see the fixtures -- we have one, I'm sure). Would you mind giving that a try?

Thanks so much for your PR!

jywarren avatar Apr 03 '17 00:04 jywarren