-
Notifications
You must be signed in to change notification settings - Fork 22
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
Allow selecting forums in addition to Index and Everywhere #149
Conversation
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
eada9dc
to
35a2ed9
Compare
Signed-off-by: Matt Friedman <[email protected]> Fix Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
{% if ba.LOCATIONS is empty %} | ||
{{ lang('BOARD_ANNOUNCEMENTS_EVERYWHERE') }} | ||
{% else %} | ||
{% set has_index = constant('\\phpbb\\boardannouncements\\ext::INDEX_ONLY') in ba.LOCATIONS %} |
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.
How does {% set ... in ... %}
construction work? Couldn't find it in docs.
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.
set
defines a new variable. https://twig.symfony.com/doc/2.x/tags/set.html
in
is like in array https://twig.symfony.com/doc/2.x/templates.html#containment-operator
This is creating a boolean variable: true if index is in the array of locations, false if not
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.
Yeah, I see what do they mean individually but just curious how would it work together. So it adds has_index
element into ba.LOCATIONS
array?
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 it creates a new twig template variable called has_index
that is true when ba.LOCATIONS
contains -1
which is then used in the next few lines
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.
it's same as doing:
$has_index = in_array(ext::INDEX_ONLY, $locations);
There's an issue with announcements dismission (probably intended but not sure, also don't know if it was the case before). |
Same applies to registered users: if user1 has dismissed the announcement, it's gonna be dismissed for any registered user on the same device and browser. |
That's how it always worked. It uses a cookie and a database entry if you were logged in. User1 dismisses, it's gone for them forever. Even if they log out it's still gone because of cookies. If a guest dismisses it's gone for that user on that device as long as the cookie doesn't expire. |
May be add user_id to cookie to distinct users dismission? |
The cookie is to handle ANONYMOUS users |
Then it shouldn't affect registered users, should it? But it does. Or does registered users dismission uses both cookie and DB part? Or am I missing the whole point? |
if a user closes an announcement, it never even gets queried again for them. so the cookie only affects them after they log out. if they switch to another account the cookie will keep it closed, but in what use case do different people use the same forum on the same device? |
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
Signed-off-by: Matt Friedman <[email protected]>
No description provided.