-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Disable add tags for first-time-posterss #9770
Conversation
Codecov Report
@@ Coverage Diff @@
## main #9770 +/- ##
=======================================
Coverage ? 82.17%
=======================================
Files ? 98
Lines ? 5934
Branches ? 0
=======================================
Hits ? 4876
Misses ? 1058
Partials ? 0 |
app/views/tag/_tagging.html.erb
Outdated
<a data-toggle="tooltip" title="Add tags/View all" aria-label="Add tags/View all" id="tags-open" class="btn btn-circle btn-circle-sm tags-open" style="float:left;"> | ||
<i class="fa fa-plus" style="color:#808080;"></i> | ||
</a> | ||
<% if current_user.first_time_poster && !(current_user.username == @node.author.username || @node.coauthors.exists?(username: current_user.username) || logged_in_as(['admin', 'moderator'])) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @17sushmita, there is a test failing because of this line @node.coauthors.exists?
, perhaps if a node has no coauthors it returns nil and becomes nil.exists?
and maybe that's why the test is failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah! I should check if a coauthor exists in AND condition. Thank you!
Code Climate has analyzed commit ba2eff9 and detected 0 issues on this pull request. View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@17sushmita lgtm 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great 🎉 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @17sushmita 🎉
<a data-toggle="tooltip" title="Add tags/View all" aria-label="Add tags/View all" id="tags-open" class="btn btn-circle btn-circle-sm tags-open" style="float:left;"> | ||
<i class="fa fa-plus" style="color:#808080;"></i> | ||
</a> | ||
<% if current_user.first_time_poster && !(current_user.username == @node.author.username || ( @node.coauthors && @node.coauthors.exists?(username: current_user.username)) || logged_in_as(['admin', 'moderator'])) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@17sushmita This line is giving me errors in my local env. When I log in as a user who has not created any posts and then try to visit my profile page, it displays this:
I think the issue is that since the user has no posts then @node
is null. Can you try it on your end and see if you have the same issue? Thanks!
It's the same on https://stable.publiclab.org/ too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@17sushmita Try visiting the profile of the newly created user while logged into that account. I just created a new user and it's the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got the error while visiting the new user's own profile.
* disable add tags for first-time-posterss * added condition if coauthor exists or not
* disable add tags for first-time-posterss * added condition if coauthor exists or not
Fixes #9769
rake test
@publiclab/reviewers
for help, in a comment belowFor first-time poster:
![image](https://user-images.githubusercontent.com/42088159/121437150-74b60100-c99f-11eb-898e-e2cef9b1e8b2.png)
For author, coauthors, admin or moderators:
![image](https://user-images.githubusercontent.com/42088159/121437483-0de51780-c9a0-11eb-9d98-ac869e695cff.png)