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

Comments and count missing from profile page #2588

Closed
jywarren opened this issue Apr 6, 2018 · 7 comments
Closed

Comments and count missing from profile page #2588

jywarren opened this issue Apr 6, 2018 · 7 comments
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute

Comments

@jywarren
Copy link
Member

jywarren commented Apr 6, 2018

Please describe the problem (or idea)

What happened just before the problem occurred? Or what problem could this idea solve?

@eustatic has certainly commented, but I don't see any on https://publiclab.org/profile/eustatic

I wonder if there's a variable missing from the profile method in:

https://github.com/publiclab/plots2/blob/master/app/controllers/users_controller.rb

We ought to test for that too -- a functional test with assert_not_nil assigns(:comments) maybe?

@jywarren jywarren added bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet labels Apr 6, 2018
@grvsachdeva
Copy link
Member

grvsachdeva commented Apr 6, 2018

okay I guess I know what the problem is, due to this #2373 newly generated comments are having status = 1 and while fetching comment_count we are taking considering those comments with status = 0 only. @jywarren please have a look at #2373 (comment) .Thanks.

@jywarren
Copy link
Member Author

jywarren commented Apr 6, 2018 via email

@grvsachdeva
Copy link
Member

grvsachdeva commented Apr 6, 2018

@jywarren we can change the status of all comments to 1 so that it matches node status pattern. By #2373 , I could only introduce the default field for comment status, but I guess for changing the status of all comments(old ones) migration need to be run on the production as I have stated here #2373 (comment).

@jywarren
Copy link
Member Author

jywarren commented Apr 9, 2018

I believe as in #2373 we already have, as you pointed out -- the migration has been run already. But maybe there was a problem -- i see there are ~613 comments in the db with status = 0, starting with:

"#<Comment cid: 18529, pid: 0, nid: 15584, uid: 516343, subject: \"\", comment: \"Hi @mridulnagpal , i have this doubt that this fea...\", hostname: \"\", timestamp: 1519158889, status: 0, format: 1, thread: \"0b/\", name: nil, mail: nil, homepage: nil, aid: 0>"

and ending with:

"#<Comment cid: 19325, pid: 0, nid: 12337, uid: 451808, subject: \"\", comment: \"Hey @matthew! I am trying to build same PPM kit yo...\", hostname: \"\", timestamp: 1523272549, status: 0, format: 1, thread: \"02/\", name: nil, mail: nil, homepage: nil, aid: 0>"

The first was 2018-02-20 and the last was today: 2018-04-09

So are we somehow not setting comment status for newly created comments properly?

Aha! We typically use node.add_comment -- a helper method, maybe we should deprecate this, but -- it still sets zero status:

plots2/app/models/node.rb

Lines 569 to 581 in 2f35d87

def add_comment(params = {})
thread = if !comments.empty? && !comments.last.nil?
comments.last.next_thread
else
'01/'
end
c = Comment.new(pid: 0,
nid: nid,
uid: params[:uid],
subject: '',
hostname: '',
comment: params[:body],
status: 0,

I can manually change all comments to status = 1 again with Comment.update_all ["status = ?", 1] -- shall I?

@grvsachdeva
Copy link
Member

thanks, @jywarren for pointing out the model node.rb , we can just change node.rb to set status as 1 and then you can run query manually to change the status of all comments. Also, as this issue comes out, I would see if in our codebase we are using query with status = 0 anywhere else. How does it sound?

@grvsachdeva
Copy link
Member

hi @jywarren I have checked our codebase for lines which could introduce comment with status = 0 , but can find only 2 appearances one as mentioned by you in node.rb and other is seed.rb file(which may someday trouble developer) so i opened a PR at #2615 fixing both of them after merging that you can run query to change status of all existing comments to 1. Thanks.

@cesswairimu
Copy link
Collaborator

The comments count are displayed correctly on the profile page currently and the link also works. Closing this. Thanks everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute
Projects
None yet
Development

No branches or pull requests

3 participants