If there's already a `LockOn` instance, clear its lock before creating creating a new one. Fixes a shaky viewport effect after certain transitions.
Includes:
* Slight refactor (elementId wasn't an id, but a selector - it included the "#" prefix)
* Add support for a[name=X] anchors in `jumpToPost`
* Scope down anchors to the #main element (Embeded fontawesome sprites are causing conflicts, e.g. when given `bed` anchor, `<a name="bed">` was at odds with `<symbol id="bed" viewBox="0 0 640 512">(…)</symbol>`)
* REFACTOR: `refreshSort` doesn't cause it to sort again, it's misleading
* FIX: Move queryParams to each discovery controller rather than shared
This fixes issues where params previously would not reset between
routes. For example if you added `max_posts=1` to /latest and then went
to a category.
* Add backward compatibility for (action "changeSort") for themes
* FIX: refreshing was not working
* Update app/assets/javascripts/discourse/app/controllers/discovery/topics.js
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
When visiting a permalink with an anchor (e.g. /important-link#notes) the anchor part was being dropped during redirection.
The change doesn't have a test. Functions like scrollToPost or scrollToElement don't have any effect in the test environment.
Mostly de-jQuery-ification. This refactor tries to closely preserve the original behavior.
Changes:
* Store the interval inside the class (allows using `clearLock()` on `LockOn` objects)
* Extract the interval function to a separate method
* Math.max result is never undefined (per MDN: "[Return value] The largest of the given numbers. If at least one of the arguments cannot be converted to a number, NaN is returned.")
* Replace jQuery's `offset()`
* Private methods be private
* Native `scrollTop` (jQuery's just a wrapper for this)
* `addEventListener`/`removeEventListener`
The controller method `_changeFilters` is now changed to `changeFilters` in the commit 1fc58b5a4e. But it was not modified in the `admin-tools` service script.
We trigger `/topics/timings` requests without ever caring about the
promise afterwards, so they can bleed from one test to another.
If you're very unlucky, this might happen and then the next test
is testing a subfolder, which means you end up with a path like
`/forum/topics/timings` which is not caught by pretender and causes the
suite to fail.
It's easier (and faster) to never send these requests in test mode
than to track the ajax requests and abort them between runs.
Legacy Firefox Android has some quirks around vibration where it:
- asks for permission
- doesn't persist the permission
This makes the default like vibration popup a permission on Firefox
Android <= 68.
This isn't the case (yet?) on their new Firefox which is rolling out
worldwide right now.
I'd say we merge this now and revert in 3 months or so when
https://arewefenixyet.com/ shows a full rollout.
When a tab is open but left unattended for a while, the red, green, and blue
pills tend to go out of sync.
So whevener we open the notifications menu, we sync up the notification count
(eg. blue and green pills) with the server.
However, the reviewable count (eg. the red pill) is not a notification and
is located in the hamburger menu. This commit adds a new route on the server
side to retrieve the reviewable count for the current user and a ping
(refreshReviewableCount) from the client side to sync the reviewable count
whenever they open the hamburger menu.
REFACTOR: I also refactored the hamburger-menu widget code to prevent repetitive uses
of "this.".
PERF: I improved the performance of the 'notify_reviewable' job by doing only 1 query
to the database to retrieve all the pending reviewables and then tallying based on the
various rights.
This hack is only attempting to hide something which should have been working in core and for which we should provide a fix soon. Also it's not working as it should.
When inviting users to a PM a small post is created showing that you
invited the user, but the actual list of participants never updated
until you refreshed the page or interacted with the private-message-map
widget triggering it to refresh. This change will trigger a refresh on
the private-message-map widget ensuring that the UI is updated with the
current list of participants.
* FEATURE: set notification levels when added to a group
This feature allows admins and group owners to define default
category and tag tracking levels that will be applied to user
preferences automatically at the time when users are added to the
group. Users are free to change those preferences afterwards.
When removed from a group, the user's notification preferences aren't
changed.
The poll breakdown modal replaces the grouped pie charts feature.
Includes:
* MODAL: Untangle `onSelectPanel`
Previously modal-tab component would call on click the onSelectPanel callback with itself (modal-tab) as `this` which severely limited its usefulness. Now showModal binds the callback to its controller.
"The PR includes a fix/change to d-modal (b7f6ec6) that hasn't been extracted to a separate PR because it's not currently possible to test a change like this in abstract, i.e. with dynamically created controllers/components in tests. The percentage/count toggle test for the poll breakdown feature is essentially a test for that d-modal modification."
This stops sync of tracking state when list is filtered, in the past this
would cause the tracking state to go off wack.
Additionally this introduces an alias for "filter=tracking", called "f=tracking"
This was done cause the term "filter" is used internally in 2 different ways
the main way is for /unread /new filtering.
Trying to also call a query param "filter" causes enormous amounts of
internal pain, this circumvents the issue.
Searching for a specific setting only showed results from the current selected category. Before fixing fd02856, it automatically redirected the user to all_results. This was a problem because the redirect always happened and there was no way to share a link to a specific category.
The fix to this bug is to simply redirect the user to all_results if there are no results to be displayed.
We had a handful of methods attached to the root `Discourse` object
related to focus and notification counts.
This patch pulls them out into a service called `document-title` for
updating the title, and a component called `d-document` to attach
and listen for browser events related to focus.
It also removes some computed properties and observers in favor of plain
old Javascript objects.
`topicTrackingState.forEachTracked(topic,isNew,isUnread)` can be used to
iterate through tracking state efficiently.
This is handy for extension looking at subsets of tags and categories.
Uses a thin border as indicator that element is in focus for all editable items in the composer (inputs, select kit, textarea).
Disables a default iOS style that has a blinking background color on inputs/textareas
After visiting a topic list (by tag / category / top level) we track the list
Once a list is tracked the combo `g` `j` can be used to go to the next topic
in the list and `g` `k` to go to previous topic.
This allows you to quickly work through subsets of topics without having
to navigate back to the top level lists
The shortcut does not work in PM lists yet, or search results, both are
under consideration.
This `description` field on a theme is returned from the server side and
needn't be calculated in the front end. I tested in the UX and seems to
work well.
(This change could be considered a little risky so we should keep an eye
on it.)
The core issue here is that sometimes as far as the router was concerned
we had transitioned to a route even if a Topic model was still in the
process of loading. In this case the callback could not retrieve the
correct title yet because it had not loaded.
This fix returns a promise from `setupController` when visiting a topic,
which will have the router block until the topic is loaded. This means
that the transition never triggers until the topic title is present.
Note: adding a test for this is basically impossible - it was super hard
to reproduce even in a browser.
This code was intended to bypass iterating through tags in absence of a new
or unread topic.
Instead it always fired cause it was checking for function existence which
was clearly always true.
This involves a little refactoring of how our `defaultHomepage()` works.
It previously would check the meta tag / site settings each time it was
called but now it only checks once on application boot.
Since `Discourse.SiteSettings` is removed, helpers can now include and
call `helperContext().siteSettings` to get access to the settings
without using a global variable.