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

Disable add tags for first-time-posterss #9770

Merged
merged 2 commits into from
Jun 15, 2021

Conversation

17sushmita
Copy link
Member

Fixes #9769

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

For first-time poster:
image

For author, coauthors, admin or moderators:
image

@gitpod-io
Copy link

gitpod-io bot commented Jun 9, 2021

@codecov
Copy link

codecov bot commented Jun 10, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@471e413). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9770   +/-   ##
=======================================
  Coverage        ?   82.17%           
=======================================
  Files           ?       98           
  Lines           ?     5934           
  Branches        ?        0           
=======================================
  Hits            ?     4876           
  Misses          ?     1058           
  Partials        ?        0           

<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'])) %>
Copy link
Contributor

@RuthNjeri RuthNjeri Jun 10, 2021

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?

Screenshot 2021-06-10 at 17 52 38

Copy link
Member Author

@17sushmita 17sushmita Jun 10, 2021

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!

@codeclimate
Copy link

codeclimate bot commented Jun 10, 2021

Code Climate has analyzed commit ba2eff9 and detected 0 issues on this pull request.

View more on Code Climate.

@17sushmita 17sushmita requested a review from RuthNjeri June 10, 2021 16:54
Copy link
Collaborator

@Tlazypanda Tlazypanda left a comment

Choose a reason for hiding this comment

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

@17sushmita lgtm 🎉

Copy link
Collaborator

@cesswairimu cesswairimu left a comment

Choose a reason for hiding this comment

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

Looking great 🎉 🎉

Copy link
Contributor

@RuthNjeri RuthNjeri left a comment

Choose a reason for hiding this comment

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

Great job @17sushmita 🎉

@RuthNjeri RuthNjeri merged commit b61da63 into publiclab:main Jun 15, 2021
<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'])) %>
Copy link
Member

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:

Screenshot 2021-07-05 at 15 16 34

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

Screenshot 2021-07-05 at 15 21 42

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you provide more information regarding this? I wasn't able to reproduce this error. I created a new account on publiclab which had no posts and visited your profile and it is accessible.
image

Copy link
Member

@TildaDares TildaDares Jul 5, 2021

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.

Copy link
Member Author

@17sushmita 17sushmita Jul 5, 2021

Choose a reason for hiding this comment

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

I just created this user 1700sushmita and still working fine🧐
image
also from new user to the previous account-
image

Copy link
Member Author

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.

reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* disable add tags for first-time-posterss

* added condition if coauthor exists or not
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* disable add tags for first-time-posterss

* added condition if coauthor exists or not
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.

Disable and Gray out Add Tag button for a first-time poster
5 participants