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

Safe search filter #155

Closed
wants to merge 10 commits into from
Closed

Safe search filter #155

wants to merge 10 commits into from

Conversation

Jem256
Copy link
Contributor

@Jem256 Jem256 commented Dec 28, 2022

Fix: #89

I would like a review of my work, whether I'm going in the right direction as well as help with how I can get the icon action to dispatch the filter function I have written

@Jem256 Jem256 marked this pull request as draft December 28, 2022 15:23
@Jem256 Jem256 marked this pull request as ready for review December 28, 2022 15:26
const { TemplateView, AvatarView } = require('hydrogen-view-sdk');
const AvatarViewModel = require('../viewmodels/AvatarViewModel');

class FilterCardView extends TemplateView {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be easier to combine this logic into RoomCardView?

I'm not totally opposed to having something separate but feels like could be combined

return false;
});
if (contains === true) {
return new FilterCardView(room);
Copy link
Contributor

@MadLittleMods MadLittleMods Jan 4, 2023

Choose a reason for hiding this comment

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

Does the room-list properly update if you toggle safe-search on and off? My guess is no and it might be tricky to force Hydrogen to re-render here since we're using a ListView.

We probably need to set a isNsfw: true|false boolean option on the room object itself in shared/viewmodels/RoomDirectoryViewModel.js#L69-L88

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the room list doesn't update. How would setting the boolean on the room object enable an update in the list? I don't understand

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it would directly but we probably need to do something like that. The views listen to changes that are emitted.

We probably need to make a class Room extends EventEmitter similar to what Hydrogen does so we can update the the isNsfw property and emit an update for the view to listen and update on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I create a class Room extends Eventmitter in my last commit but I still can't figure out how the changes will be emitted between the class and the view

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's also this issue from Hydrogen that I think relates to our problem

Copy link
Contributor

Choose a reason for hiding this comment

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

@Jem256 I'm no Hydrogen expert to be able to explain or know exactly what to do here. I'd just have to hack on it myself in order to give any guidance. You might get some good notes by asking in Hydrogen room on Matrix or checking out the Hydrogen code base to find a similar pattern and how they solved it.

@Jem256 Jem256 marked this pull request as draft January 5, 2023 16:45
@MadLittleMods MadLittleMods added A-room-directory Room directory landing page where you can explore the list of rooms A-moderation Moderating content and rooms (safe search) labels May 2, 2023
@MadLittleMods
Copy link
Contributor

Closing as this feature just landed via #208

@Jem256 Thanks for making the effort to try this out! Sorry, I couldn't come with more Hydrogen knowledge to make this more possible for you to accomplish 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-moderation Moderating content and rooms (safe search) A-room-directory Room directory landing page where you can explore the list of rooms community-contribution T-Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add NSFW safe search filter to room directory landing page
2 participants