-
Notifications
You must be signed in to change notification settings - Fork 31
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
Automatic collapse child comments #841
Automatic collapse child comments #841
Conversation
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 PR! This is a useful feature.
Regarding the settings icon, I think "arrow.down.and.line.horizontal.and.arrow.up"
would be a good choice. This is what we use elsewhere in the app to represent collapsing a comment.
I did notice a small issue. When a comment is collapsed, its children should be hidden completely. However, when a post is first opened with the new setting enabled, all of the children are visible, even those whose parents are collapsed.
Here's what it look like currently:
Here's what it should look like:
The correct appearance can be reached by expanding and re-collapsing each top-layer (orange-colored) comment.
To hide comments completely, you can set the isParentCollapsed
value to true
.
Good catch @Sjmarf , I'll check to see why that collapse behaviour is happening. I'll also update the icon too. Thanks |
- Updated collapseComment flag name to be more consistent
Adding the feature flag to I do find that it looks better this way and the user can see amount of replies in the bottom portion of the comment box. However, clicking on it collapses the comment which means the user has to press the comment twice to see child comments. Looking at ways to work around that right now, any suggestions? I also need to put |
Hmm yeah that's a little tricky. I think we'd need to have Maybe instead of determining |
Ok updated logic: |
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.
Looks good! I like the new settings location.
For some reason every time I try to revert the enum, it discards the change and makes a blank commit. Unsure why that's happening, maybe due to git hooks? Not sure |
This is due to the Swiftformat hook. |
I actually think I can implement the Apollo style collapse (where it displays n replies below the comment box) sooner rather than later. I have the functionality down just working on UI. Please hold off on merging. |
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.
Yep, that fixed it!
This introduced a bug, though. If you click "show n replies", then go to a user profile, then click "back", the comment tree is collapsed again but the "show n replies" button is hidden.
Before the most recent fix, the "Show n replies" button would be (correctly) shown in this situation.
That was because I removed the |
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.
Because the comments section uses a LazyVStack
, using .onDisappear
makes the "Show n replies" button appear again on an expanded comment if you scroll down the comments and then back up.
@Sjmarf Not sure what the best solution to this would be. I tried to set I tried debugging and it's showing as retaining the hidden variable but not resetting collapse. I guess it's particularly tricky in this case because
Would that be an acceptable bug to ship with? Will take me some more time to investigate the root cause of it and I'm not sure how much time I can dedicate this week. If you have a hunch as to why this behaviour is happening please let me know. |
I'll take a look at it this weekend and see if I can find the issue 👍 |
Looks like it's caused by the .task {
if commentTracker.comments.isEmpty {
await loadComments()
}
} |
- removed onDisappear, no longer needed
Thanks so much for checking, I've added those changes now! |
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.
Looks good to go!
Is there something I need to fix to get it merged? I noticed some build failures but logs say something about access |
Every time you make a change, the checks need to re-run. For organisation members this happens automatically, but for everyone else it has to be approved by an organisation member :( Also occasionally the checks do fail for no apparent reason and we just have to re-run them. Feel free to merge this whenever you like (if you're able to? If not lmk and I'll merge it). |
Okay sounds good. I don't think it lets me merge unless all checks are passed. |
Huh, I see the I've not seen that before |
Not sure what the build settings for this project are, but maybe this is it: kishikawakatsumi/xcresulttool#691 (comment)
|
Thanks - Jake's put a PR up to fix it, once that's in I'll rerun the checks 👍 |
Builds and checks pass locally--we're still getting our CI stuff worked out for forked builds, so once this PR is merge-compatible I'll run the checks again locally and bypass CI to merge |
…llapse-child-comments # Conflicts: # Mlem/Views/Shared/Comments/Comment Item.swift # Mlem/Views/Shared/Posts/Expanded Post.swift # Mlem/Views/Tabs/Profile/UserView+Logic.swift
Sorry for the delay, busy week. Should be good to go now. |
Build and test work locally. I'm bypassing branch protections to merge without CI; if this breaks |
Checklist
- list issue(s) here
Pull Request Information
About this Pull Request
Adding a feature that automatically collapses child comments when a user loads a page. A feature toggle is added to the settings with the default being off.
Screenshots and Videos
Additional Context
Other apps such as Apollo have this feature and thought it would be a good addition. Please let me know if I should change naming conventions. The icon in the settings page is missing too, was not sure what the best one is available for that.
Apollo did have different UI for this feature, it would say [X amount of replies] under each parent comments and would load comments if a user clicked that. I can add that functionality but just did core functionality for now while I wait for feedback.