-
Notifications
You must be signed in to change notification settings - Fork 334
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
Make confirm popup for adult consent #2419
Merged
Merged
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
fff198a
Make confirm popup for adult consent
SleeplessOne1917 d51cf75
Fix import
SleeplessOne1917 588bacb
Merge branch 'main' into content-warning
SleeplessOne1917 b1fc470
Fix blur and adjust user settings
SleeplessOne1917 e98d1c9
Merge branch 'content-warning' of https://github.com/LemmyNet/lemmy-u…
SleeplessOne1917 3cae1b5
Merge branch 'main' into content-warning
SleeplessOne1917 0413fd6
Make confirmation popup more stylish
SleeplessOne1917 fea5ff1
Add setting to site settings form
SleeplessOne1917 fb38faf
Fix modal bug
SleeplessOne1917 c430678
Put adult consent logic all in one place
SleeplessOne1917 4fc425b
Make modal use markdown
SleeplessOne1917 b6d7efd
Fix consent modal showing up for currently logged in admin
SleeplessOne1917 42bc4ab
Add go-back redirect countdown
SleeplessOne1917 9869b00
Center modal title
SleeplessOne1917 afae55c
Handle enable_nsfw correctly
SleeplessOne1917 1e76395
Blur background of modal to hide spicy things
SleeplessOne1917 160048c
Add translations
SleeplessOne1917 5197206
Remove delay between page loading and being blurred
SleeplessOne1917 f97f396
Merge branch 'main' into content-warning
SleeplessOne1917 bbce909
Merge branch 'main' into content-warning
SleeplessOne1917 8e5599e
Revert "Remove delay between page loading and being blurred"
matc-pub 1b4903d
Blur SSR by default when content warning is set
matc-pub ce72377
Make blur work correctly
SleeplessOne1917 3cbe7e1
Prevent images from downloading without consent
SleeplessOne1917 d5cfc73
Autoexpand
SleeplessOne1917 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule lemmy-translations
updated
7 files
+8 −1 | translations/bg.json | |
+9 −1 | translations/da.json | |
+8 −1 | translations/en.json | |
+12 −1 | translations/eo.json | |
+10 −1 | translations/es.json | |
+22 −3 | translations/fr.json | |
+8 −1 | translations/gl.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -461,3 +461,7 @@ br.big { | |
.totp-link { | ||
width: fit-content; | ||
} | ||
|
||
#adultConsentModal { | ||
backdrop-filter: blur(10px); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why not just set an
invisible
class depending on the contentWarning?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.
Currently I handle the blur by setting the
background-filter
for the top level of the modal element. I've tried doing it by putting a class on app, but that always ended up blurring out the modal as well. Another approach I tried was just having all of the lifecycle methods and event handlers be handled in the original top-levelApp
component. This seemed to work, but would cause the loading skeleton to flash in the blurred background each second the redirect time counts down.I'm going to see if I can handle this all at the very top level
componentDidRoute
. I strongly suspect the issue is due to the order rendering is done in. Before my most recent change, the logic for showing the modal didn't run until after the top levelApp
component mounted and rendered. In the current iteration,componentDidMount
for the consent modal is being called simultaneously with thecomponentDidMount
for theApp
component. I think moving this logic to the very root of the component tree as a parent ofApp
should solve the issue.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.
Cool. If all else fails we might have to just resort to a simple confirm dialog on the SSR like lemmynsfw does it.
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.
setState
incomponentWillMount
will affect the first render of the component. It gets called on the server too.To avoid ever showing the wrongly un/blurred version after a page refresh, you'd probably need a
create-ssr-html
-hack similar to the auto detected light/dark themes. It's the same problem, the server doesn't know the real style to use, and whatever the server decides to show will otherwise be visible at least untilstartClient
is called.lemmy-ui/src/server/utils/create-ssr-html.tsx
Lines 82 to 87 in accf1b2
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 tried my idea and it didn't work. I can attempt @matc-pub's suggestion, although I foresee this will cause me to run into the opposite issue: the page flashing as blurred for a second when it shouldn't be. This is because if
content_warning
is set, the browser's local storage also has to be checked to see if it needs to ask for consent.Edit: @matc-pub's suggestion would most likely work if I used a cookie instead of local storage. I'll give that an attempt.
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've tried the cookie approach with and without a data attribute. The HTML and CSS that gets returned from the server before client side JS runs still isn't blurred. I think the problem is that bootstrap modals depend on being run in the browser to render. We'll either have to live with a slight delay for when the blur starts or go back to using the regular confirm dialog.