-
Notifications
You must be signed in to change notification settings - Fork 741
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
Extend make visible in stats #2168
Conversation
…wn and therefore cannot be selected
…t is not visible, included translations
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.
Thanks for taking this on! 🎉 Looking good so far!
@@ -10,6 +10,7 @@ import { | |||
faDoorOpen, | |||
faDoorClosed, | |||
faExclamationTriangle, | |||
faEyeSlash, |
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.
You'll want to update this part of the file to use this new icon.
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.
I was able to use the icon eventually. I repeated it everywhere the tooltip is displayed. What I did is to pass the visibility status as a prop key. I will post the diff here for reference.
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.
Here is where the conditional rendering is effected.
… where applicable
Is there a reason why the tests that are failing are not even remotely related to the things I did? |
@uzorjchibuzor You likely have conflicting local settings for things like ESLint and Prettier–I know I did. Navigate to |
I wanted to install a VSCode extension before I tried your suggestion. Hope it works. My Linting is horrible. |
I think I passed ESLint, CircleCI is Capybara, Let me know if I need to fix anything. |
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.
Thanks so much for taking this on 🎉 Awesome work 🙌
sible, not_visible) resolves to false, it will be removed from the returned hash so as not to cause a Type error in the StoryAction.jsx
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.
This is coming along really well 🙌 🎉 Thanks for all the updates!
There's one edge case that we should address!
@@ -127,6 +127,6 @@ def associated_strategies | |||
Strategy.where(user: @viewers).each do |strategy| | |||
strategy_ids << strategy.id if strategy.viewer?(current_user) | |||
end | |||
Strategy.where(id: strategy_ids).order(created_at: :desc) | |||
Strategy.is_visible.where(id: strategy_ids).order(created_at: :desc) |
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.
An edge case that we should account for is what happens when we create a Moment with a Strategy/Category/Mood OR a Strategy with a Category that is visible when created, but is later edited to be not visible?
Example:
- Create a Moment with a Strategy that is visible
- Edit the Strategy and make it not visible
- View the Moment and the non-visible Strategy is still listed (this is fine!)
- Edit the Moment and the Strategy is not in the list (this is the issue!)
I think the expected behaviour for 4) should be that we can view the selected Strategy. If we uncheck the box for it and save our changes, then we can no longer add it back.
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.
Do you mean that if an element is tagged, it should remain visible to the parent?
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.
I think if it's already tagged, but the tag is made not visible, it should still be visible to the post (or parent like you said) that it's being used in.
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.
I think I understand now. It's late here but I should have a commit tomorrow, I will have to do away with the scope Concern though.
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.
Thanks for the updates and adding tests along the way! This is coming along great 🎉
spec/requests/strategies_spec.rb
Outdated
@@ -142,6 +151,18 @@ | |||
end | |||
end | |||
|
|||
it 'reders associated category in dropdown regardless of visibility status' do |
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.
Grammar: reders
should be spelled as renders
@@ -109,9 +109,9 @@ def moment_params | |||
end | |||
|
|||
def set_association_variables! | |||
@categories = current_user.categories.order(created_at: :desc) | |||
@categories = current_user.categories.is_visible.or(Category.where(id: @moment.category_ids)).order(created_at: :desc) |
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.
I found a bug:
- Create a Moment with a visible Category
- Edit the Category to be not visible
- Edit the Moment and uncheck the Category and hit "Submit"
- The Category is not removed (it should be removed)
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.
I think I understand but I want to recreate this to be sure,
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.
The issue is that if we're editing a Moment or Strategy, we're overriding tags that are removed before they are saved.
@category = Category.new | ||
@moods = current_user.moods.order(created_at: :desc) | ||
@moods = current_user.moods.is_visible.or(Mood.where(id: @moment.mood_ids)).order(created_at: :desc) |
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.
Similar bug as above, but for Moods!
@@ -127,6 +127,6 @@ def associated_strategies | |||
Strategy.where(user: @viewers).each do |strategy| | |||
strategy_ids << strategy.id if strategy.viewer?(current_user) | |||
end | |||
Strategy.where(id: strategy_ids).order(created_at: :desc) | |||
Strategy.is_visible.where(id: strategy_ids).or(Strategy.where(id: @moment.strategy_ids)).order(created_at: :desc) |
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.
Similar bug as above, but for Strategies!
@@ -52,7 +52,7 @@ def edit | |||
redirect_to_path(strategy_path(@strategy)) | |||
end | |||
@viewers = current_user.allies_by_status(:accepted) | |||
@categories = current_user.categories.order('created_at DESC') | |||
@categories = current_user.categories.is_visible.or(Category.where(id: @strategy.category_ids)).order('created_at DESC') |
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.
I found a bug:
- Create a Strategy with a visible Category
- Edit the Category to be not visible
- Edit the Strategy and uncheck the Category and hit "Submit"
- The Category is not removed (it should be removed)
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.
the commit message is supposed to say Moment and Strategy is now able to remove associations when no params is passed to the controller by a before_save callback
…s is passed to the controller by a before_save callback
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.
Fantastic work!! Thanks for all the updates as well 🎉
Closes #2142
Reviewing this pull request? Check out our Code Review Practices guide if you haven't already!