-
Notifications
You must be signed in to change notification settings - Fork 11
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
Safe search filter #155
Conversation
shared/views/FilterCardView.js
Outdated
const { TemplateView, AvatarView } = require('hydrogen-view-sdk'); | ||
const AvatarViewModel = require('../viewmodels/AvatarViewModel'); | ||
|
||
class FilterCardView extends TemplateView { |
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.
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
shared/views/RoomDirectoryView.js
Outdated
return false; | ||
}); | ||
if (contains === true) { | ||
return new FilterCardView(room); |
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.
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
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.
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
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 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.
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 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
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.
There's also this issue from Hydrogen that I think relates to our problem
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.
@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.
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
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