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!
We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you ๐
If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!
Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.
[ ] ๐ Claim this issue: Comment below. If someone else has claimed it, ask if they've opened a pull request already and if they're stuck -- maybe you can help them solve a problem or move it along!
[ ] ๐ Update the file app/models/answer.rb in the plots2 repository (press the little pen Icon) and edit the line as shown below.
See this page for some help in taking your first steps!
Below is a "diff" showing in red (and a -) which lines to remove, and in green (and a +) which lines to add:
@@ -1,35 +0,0 @@
-class Answer < ApplicationRecord
- include CommentsShared
- include NodeShared
- extend RawStats
-
- belongs_to :node, foreign_key: 'nid'
- belongs_to :user, foreign_key: 'uid'
- has_many :answer_selections, foreign_key: 'aid'
- has_many :comments, foreign_key: 'aid', dependent: :destroy
-
- validates :content, presence: true
-
- scope :past_week, -> { where("created_at > ?", (Time.now - 7.days)) }
- scope :past_month, -> { where("created_at > ?", (Time.now - 1.months)) }
-
- def body
- finder = content.gsub(Callouts.const_get(:FINDER), Callouts.const_get(:PRETTYLINKMD))
- finder = finder.gsub(Callouts.const_get(:HASHTAGNUMBER), Callouts.const_get(:NODELINKMD))
- finder.gsub(Callouts.const_get(:HASHTAG), Callouts.const_get(:HASHLINKMD))
- end
-
- def body_markdown
- RDiscount.new(body, :autolink).to_html
- end
-
- # users who like this answer
- def likers
- answer_selections
- .joins(:user)
- .references(:rusers)
- .where(liking: true)
- .where('rusers.status': 1)
- .collect(&:user)
- end
-end
[ ] ๐พ Commit your changes
[ ] ๐ Start a Pull Request. There are two ways how you can start a pull request:
๐ฌโฐ - We encourage contributors to be respectful to the community and provide an update within a week of claiming a first-timers-only issue. We're happy to keep it assigned to you as long as you need if you update us with a request for more time or help, but if we don't see any activity a week after you claim it we may reassign it to give someone else a chance. Thank you in advance!
If this happens to you, don't sweat it! Grab another open issue.
๐- We encourage contributors to link to the original issue in their pull request so all users can easily see if someone's already started on it.
๐ฅ- If someone seems stuck, offer them some help! Otherwise, take a look at some other issues you can help with. Thanks!
Leave a comment below!
This also helps to complete this larger issue: #4094 as we are getting rid of the unique Answer model and all corresponding code!
This issue will also depend on #8511 to be completed before a pull request with this change will work -- because in that issue, we remove the tests that detect the presence of this code. I'm happy to help with this if any Outreachy folks would like to take it up!
@jywarren. Can I work on this?
Hey @nibble0101 , that would be great ๐
Let us know if you need some help with this issue ๐
@sagarpreet-chadha Thanks will get right to it.
Can i do this? i am new here. (outreachy)
Do you need help here?
Is someone working on this issue? I'd like to take it up.
Hi @TildaDares it turned out this was much more complex as there were just many more instances of "answer" throughout the code and tests. I think we'd LOVE any PR which removes a mention of answer/answers from parts of our codebase. Please look through these to see if there is one and if you can open a PR, we will review it! Thank you!
I'm starting here: https://github.com/publiclab/plots2/search?q=answer
Only the Ruby ones would be essential in a first round. I'm seeing:
https://github.com/publiclab/plots2/tree/main/test/functional/questions_controller_test.rb#L69
https://github.com/publiclab/plots2/blob/main/test/unit/comment_test.rb#L157-L176
https://github.com/publiclab/plots2/blob/main/app/controllers/stats_controller.rb#L66-L72