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

Add instance explorer #1133

Merged
merged 5 commits into from
Mar 1, 2024

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Feb 16, 2024

Pull Request Description

This PR adds support for an "instance explorer" which allows viewing the communities, users, posts, and comments federated with a given instance. This is part of the existing instance page, which can be accessed by long-pressing posts/comments and pressing "Visit Instance". When an entity is tapped, we use the ResolveObject endpoint to find it on the user's local instance so they can proceed to interact with it as normal.
For the current instance, this explorer can also be accessed via the search page, where there is a new "Explore instance" button at the bottom that will navigate to the same instance page.

Future enhancements:

  • Add sorting to each view mode (currently everything is TopAll; however, note that the /communities page on the web UI doesn't have sorting either, so we're not much worse 😊).
  • Ensure that long-press and swipe actions are supported. This will take some extra work because we don't always have the expected blocs in place, plus we're dealing with additional complexity of entities from other instances.

NOTE: After I finished working on this, I discovered that ListingType.local does not seem to work when the Search endpoint is called for SearchType.users. It always returns users from all instances. As a result I have disabled this section of the instance page. However, all of the code is there, and it is not commented out (just hidden with a conditional), so we can maintain it going forward and unhide if/when that endpoint is fixed. (The demos still include the user section.)

Review without whitespace.

Issue Being Fixed

Issue Number: #1053

Screenshots / Recordings

Demo 1: Exploring the current instance via the search page

qemu-system-x86_64_32mXoFhajf.mp4

Demo 2: Exploring a remote instance (with object resolution to current instance)

qemu-system-x86_64_k1jOV05Izu.mp4

Checklist

  • Did you update CHANGELOG.md?
  • Did you use localized strings where applicable?
  • Did you add semanticLabels where applicable for accessibility?

@hjiangsu
Copy link
Member

I haven't reviewed the code yet but this looks really good! Thanks for working on this, this will definitely make instance exploration more accessible within the app!

Just a note, I'll probably look at this after the next general release is out (just so that I can focus on fixing some existing issues and get the next version rolled out as soon as I can)

Copy link
Member

@hjiangsu hjiangsu left a comment

Choose a reason for hiding this comment

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

Just a couple points of discussion!

One more general point would just be to add some more comments on top of the widget to explain what its being used for (e.g., buildCommentEntry is used to display a preview of a comment for the search/instance explorer)

@micahmo
Copy link
Member Author

micahmo commented Feb 27, 2024

add some more comments on top of the widget to explain what its being used for

Done!

@trymeouteh
Copy link

Looks amazing! Please add an option to explore communities, posts, comments, users on the entire fediverse as well, not just a specific instance.

@hjiangsu
Copy link
Member

Looks amazing! Please add an option to explore communities, posts, comments, users on the entire fediverse as well, not just a specific instance.

I don't believe that the Lemmy API gives us direct access to this information, so this might be more related to #508

@micahmo
Copy link
Member Author

micahmo commented Feb 27, 2024

Looks amazing! Please add an option to explore communities, posts, comments, users on the entire fediverse as well, not just a specific instance.

I don't believe that the Lemmy API gives us direct access to this information, so this might be more related to #508

We may be able to use a similar technique as I'm using here. I am just calling Search without a query string, and it returns "everything". In this case, I am filtering by Local, but we could also filter by All to see "everything". Note that this would only be things federated with the current instance, so not really everything, but maybe good enough for the feature being requested.

Either way, that would be a separate change and may also make more sense on the search page, like how we have trending communities now.

@hjiangsu
Copy link
Member

Just double checking - is this ready to be merged in?

@micahmo
Copy link
Member Author

micahmo commented Mar 1, 2024

Yes, should be good to go!

@hjiangsu hjiangsu merged commit de5de3f into thunder-app:develop Mar 1, 2024
1 check passed
@micahmo micahmo deleted the feature/instance-explorer branch March 1, 2024 16:22
@hjiangsu
Copy link
Member

hjiangsu commented Mar 1, 2024

After I finished working on this, I discovered that ListingType.local does not seem to work when the Search endpoint is called for SearchType.users. It always returns users from all instances.

Linking this issue since it's relevant to what you mentioned (seems like it'll be fixed in an upcoming release): LemmyNet/lemmy#4146

@micahmo micahmo mentioned this pull request Mar 5, 2024
3 tasks
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.

3 participants