Commit Graph

26339 Commits

Author SHA1 Message Date
Arpit Jalan c593727497
FIX: navigate to topic/PM regardless of Shift key press (#15551)
Currently when pressing Shift key and hitting Reply button the user
stays on the post they are on and does not get navigated to newly
created topic/PM/reply. This is fine for replies but creates confusion
when composing a new topic/PM.

This commits makes it such that pressing Shift key and Reply button
(or ctrl-shift-enter / cmd-shift-enter) works only for replies and not
for new topic/PM. The user will always be navigated to new topic/PM.
2022-01-13 08:13:33 +11:00
Robin Ward 2c7906999a DEV: Support for running theme test with Ember CLI (second attempt)
This PR includes support for running theme tests in legacy ember
production envrionments.
2022-01-12 15:43:29 -05:00
Dan Ungureanu 584c6a2e8b
SECURITY: Do not sign in unapproved users (#15552) 2022-01-12 22:24:54 +02:00
David Taylor 6750c682ac DEV: Add integration test for refreshing discovery-topics views
This test would have detected the regression which was fixed in f94c01b233
2022-01-12 12:18:37 +00:00
David Taylor 78c6fc6e43 DEV: Use Ember router to determine currentURL
This means that our DiscourseURL logic will work consistently in tests, where `window.location` doesn't get updated.

To make it work properly, our `replaceState` implementation needed to be updated so that it writes the new URL to Ember's router, rather than bypassing the router and going straight to the `location` API.

A couple of tests needed updating following this fix:
- the composer-test was asserting that the new reply should be missing from the DOM... when really it **should** be in the DOM, and this fix to the test environment makes it so
- the topic-test was making a fake topic fixture based on the data from a topic with a different id. This was causing the topic route to get confused, and 'fix' the currentURL. This commit updates it to use a fixture with consistent data.

This commit also removes the feature detection of `window.history`. It's feature-detected within `discourse-location`. Plus, we don't support any browsers without it.
2022-01-12 12:18:37 +00:00
Natalie Tay dd3ed27930
DEV: Allow utility class domFromString to take in strings with multiple top level elements (#15548)
Previously only `<div>one top element</div>` was allowed because we use `firstChild` instead of `children`.
We also want `<div>one</div><div>two</div>` to work with this method.
2022-01-12 19:49:24 +08:00
David Taylor 252bb87ab3
Revert "DEV: Support for running theme test with Ember CLI" (#15547)
This reverts commit ea84a82f77.

This is causing problems with `/theme-qunit` on legacy, non-ember-cli production sites. Reverting while we work on a fix
2022-01-11 23:38:59 +00:00
Kris 1d0e5ae4c8
DEV: add invite-page class (#15546) 2022-01-11 17:05:13 -05:00
Robin Ward ea84a82f77 DEV: Support for running theme test with Ember CLI
This is quite complex as it means that in production we have to build
Ember CLI test files and allow them to be used by our Rails application.

There is a fair bit of glue we can remove in the future once we move to
Ember CLI completely.
2022-01-11 15:42:13 -05:00
David Taylor 8eb61de1cd
FIX: Handling of `/p/###` URLs within Ember (#15536) 2022-01-11 13:10:46 +00:00
David Taylor b3e52f99e6
FIX: LOAD_PLUGINS=0 in dev/prod, warn in plugin:pull_compatible_all (#15537)
The `plugin:pull_compatible_all` task is intended to take incompatible plugins and downgrade them to an earlier version. Problem is, when running the rake task in development/production environments, the plugins have already been activated. If an incompatible plugin raises an error in `plugin.rb` then the rake task will be unable to start.

This commit centralises our LOAD_PLUGINS detection, adds support for LOAD_PLUGINS=0 in dev/prod, and adds a warning to `plugin:pull_compatible_all` if it's run with plugins enabled.
2022-01-11 12:30:22 +00:00
Bianca Nenciu dd3e766efd
DEV: Do not manually require ip_addr (#15535) 2022-01-11 12:43:00 +02:00
David Taylor b537d591b3
FIX: allow slug-less topic URLs to work within the same topic (#15508)
- Update the TOPIC_URL_REGEXP in `lib/url` so that `navigatedToPost` doesn't attempt to handle slug-less URLs. Slugs must contain at least one non-numeric character, so we can use that fact to make the regex more specific. We want slug-less URLs to be routed as a normal Ember transition, so that `topic-by-slug-or-id` can catch them and re-write the URL to include the slug.

- Update the `topic-by-slug-or-id` afterModel to ensure that the Ember router is used to handle the redirect, rather than DiscourseURL. This guarantees that it will function as a redirect (DiscourseURL.routeTo sometimes bypasses the router). This solves the history problem which was worked-around in 27211ee7bb.

- Update routes/topic to recover from aborted transitions gracefully. This means that following an aborted transition, the browser URL continues to be updated with post numbers as the user scrolls down the page.
2022-01-11 10:37:37 +00:00
Bianca Nenciu 5d35c38db2
FEATURE: Search screened IP address in blocks (#15461)
An admin could search for all screened ip addresses in a block by
using wildcards. 192.168.* returned all IPs in range 192.168.0.0/16.
This feature allows admins to search for a single IP address in all
screened IP blocks. 192.168.0.1 returns all IP blocks that match it,
for example 192.168.0.0/16.

* FEATURE: Remove roll up button for screened IPs

* FIX: Match more specific screened IP address first
2022-01-11 09:16:51 +02:00
Bianca Nenciu 5a8b8f6f1e
FEATURE: Show warning if user won't be mentioned (#15339)
The new warnings cover more cases and more accurate. Most of the
warnings will be visible only to staff members because otherwise they
would leak information about user's preferences.
2022-01-11 09:16:20 +02:00
Vinoth Kannan 6626089034
UX: change text of public_topic action code in login required sites. (#14764)
The wording "made this topic public" made confusion in login required forums.
2022-01-11 11:35:16 +05:30
Alan Guo Xiang Tan 2ee9a09c8c DEV: Fix failing test. 2022-01-11 11:45:22 +08:00
Alan Guo Xiang Tan 6fb89c153a Revert "DEV: Remove stale ignored_columns from models."
This reverts commit 9f5c8644d0.

Have to revert because the ignored columns have not been dropped.
2022-01-11 11:00:58 +08:00
Alan Guo Xiang Tan c2afc3915b FEATURE: Customizable rules and plugins for `PrettyText.markdown`.
This commit extends the options which can be passed to
`PrettyText.markdown` so that which Markdown-it rules and Discourse
Markdown plugins to be used when rendering a text can be customizable.
Currently, this extension is mainly used by plugins.
2022-01-11 10:39:40 +08:00
Alan Guo Xiang Tan 9f5c8644d0 DEV: Remove stale ignored_columns from models. 2022-01-11 10:38:10 +08:00
Jarek Radosz 2dcad9772f FIX: Don't display duplicated emoji in picker 2022-01-11 10:37:02 +08:00
Krzysztof Kotlarek 22249806a8 FEATURE: decorate username in email-group-user-chooser-row
We are allowing plugins to decorate username selector:

1f1aa6a0d8/app/assets/javascripts/discourse/app/lib/plugin-api.js (L1154)

1472e47aae/app/assets/javascripts/discourse/app/templates/user-selector-autocomplete.hbr (L9)

The same decoration can be beneficial for email-group-user-chooser-row. An example use case is to show the icon that a user is on holiday when assigning a user to post/topic.
2022-01-11 09:49:27 +08:00
Alan Guo Xiang Tan ab2c17236a DEV: Follow Discourse's convention when monkey patching.
Having to load `ip_addr` is confusing especially when that file exists
to monkey patch Ruby's `IpAddr` class. Moving it to our freedom patches
folder which is automatically loaded on initialization.
2022-01-11 09:48:27 +08:00
Jarek Radosz 933f6780ee
FIX: Update recent emoji list when selecting from it (#15514)
…after you re-open the modal or select another emoji.

Reason:
Even the most used emoji would be knocked off the list after a while, if you use any emoji outside the recent. Consider the sequence:

, 😃,  (from recent), 😀,  (from recent), 😛,  (from recent), 😎,  (from recent), and so on

With the previous logic, the check mark emoji would leave the list, even though it used constantly and (and the time of removal) would the the second most recent used emoji.

---

It doesn't update the list when you use the recent list so that you can click an emoji repeatedly and it doesn't shift from under your mouse cursor.
2022-01-11 00:00:47 +01:00
Rafael dos Santos Silva 06bba76719
DEV: Update emojis constants (#15506)
Follow up to d1cfabd so the new emojis are usable by the app
2022-01-10 14:53:52 -03:00
David Taylor ef37186be3
DEV: Allow click-interceptor in tests and add navigation test (#15499)
The app's wrapper element ID is different in tests. `app.rootElement` allows us to consistently obtain the selector in the initializer, so it works correctly regardless of the app's configuration.
2022-01-10 15:45:44 +00:00
Andrei Prigorshnev c4646264c1
DEV: Restore facked timers in the after-each hook (#15522) 2022-01-10 19:30:50 +04:00
David Taylor b3aeedd653
DEV: Correct method name in theme-errors-handler pre-initializer (#15501) 2022-01-10 10:51:40 +00:00
David Taylor df7cda40b7
DEV: Skip timers when loading topic route in tests (#15500)
The test environment will wait for all timers to settle before continuing. These timers were causing all tests involving `/t/*` routes to spend 500ms doing nothing.

Fun fact: we load the topic route 214 times during the core test suite. That means that this commit saves a total of around 107s across the whole suite. On my machine, that's a 30% improvement in runtime.
2022-01-10 10:51:18 +00:00
David Taylor 3513835722
DEV: Improve and document `__container__` workaround in tests (#15498)
Modern Ember only sets up a container when the ApplicationInstance is booted. We have legacy code which relies on having access to a container before boot (e.g. during pre-initializers).

In production we run with the default `autoboot` flag, which triggers Ember's internal `_globalsMode` flag, which sets up an ApplicationInstance immediately when an Application is initialized (via the `_buildDeprecatedInstance` method).

In tests, we worked around the problem by creating a fresh container, and placing a reference to it under `Discourse.__container__`.

HOWEVER, Ember was still creating a Container instance for each ApplicationInstance to use internally, and make available to EmberObjects via injection. The `Discourse.__container__` instance we created was barely used at all.

Having two different Container instances in play could cause some weird issues. For example, I noticed the problem because the `appEvents` instance held by DiscourseURL was different to the `appEvents` instance held by all the Ember components in our app. This meant that events triggered by DiscourseURL were not picked up by components in test mode.

This commit makes the hack more robust by ensuring that Ember re-uses the Container instance which we created pre-boot. This means we only have one Container instance in play, and makes `appEvents` work reliably across all parts of the app. It also adds detailed comments describing the hack, to help future travelers.

Hopefully in future we can remove this hack entirely, but it will require significant refactoring to our initialization process in Core and Plugins.

The mapping-router and map-routes initializer are updated to avoid the need for `container.lookup` during teardown. This isn't allowed under modern Ember, but was previously working for us because the pre-initializer was using the 'fake' container which was not ember-managed.
2022-01-10 10:34:08 +00:00
Alan Guo Xiang Tan f99ade3ce5 DEV: Ignore dropped Bookmark columns.
This is a partial revert of 099b679fc5.
`Bookmark#topic_id` and `Bookmark#reminder_type` was dropped in
b22450c7a8 so we need to continue ignoring
the dropped columns so as to ensure a seamless deploy. Otherwise,
ActiveRecord's schema cache will still contain references to
`Bookmark#topic_id` when the column is dropped in a post migration.
2022-01-10 16:04:22 +08:00
Jarek Radosz 0f225c8e54 UX: Tweak emoji picker css
1. Hide the results element when empty (and set top-margin of section to 0, which fixes some custom themes)
2. Fixed the on-hover color of .trash-recent
2022-01-10 10:23:21 +08:00
Penar Musaraj c908fa2f5b
FIX: Regression in topic list kbd navigation (#15513) 2022-01-09 17:22:41 -05:00
Jarek Radosz 71cf6839ab
DEV: Add count to missing translation strings (#15509)
…for easier debugging of i18n issues.
2022-01-09 23:10:32 +01:00
Meghna 5c74f048a5
UX: updated "accept invite" error page (#15490) 2022-01-09 10:21:42 +05:30
Ayke Halder c0d702f01f
DEV: migrate audio cloak-prevention to decorateCookedElement (#15502)
Migrate deprecated decorateCooked to decorateCookedElement for audio cloak-prevention.

This might give a minimal performance boost: running audio cloak-prevention for 20 (non-audio) posts takes 1 ms and not 15 ms.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2022-01-09 01:57:49 +01:00
Jarek Radosz 5a50f18c0c
DEV: Avoid `$` globals (#15453)
Also:
* Remove an unused method (#fill_email)
* Replace a method that was used just once (#generate_username) with `SecureRandom.alphanumeric`
* Remove an obsolete dev puma `tmp/restart` file logic
2022-01-08 23:39:46 +01:00
Dan Ungureanu c0d72ec3d6
FIX: Append /all to URL if default list is 'none' (#15460)
It was impossible to select the 'all' filter for categories that have
the default list filter set to 'no subcategories'. This happens because
'/all' was not appended to the URL and in the absence of any list filter
('all' or 'none'), the default list filter ('none') was automatically
selected.
2022-01-08 13:58:42 +02:00
Penar Musaraj 1ed2520589
DEV: Fewer jQuery calls in offset calculation (#15465) 2022-01-07 16:02:03 -05:00
David Taylor f94c01b233
FIX: Refresh logic in discovery topic lists (#15489)
Before 6e0e6014, the flow looked something like:

1. `discovery/topics` controller (which extends `discovery` controller) `afterRefresh()` calls `.send("loadingComplete")`
2. Bubbles to [`discovery` route](554ff07786/app/assets/javascripts/discourse/app/routes/discovery.js (L58))
3. Discovery route calls `controllerFor('discovery').loadingComplete()`. `loading` is set false, and the spinner disappears

Now that `discovery/topics` defines `loadingComplete` as an action, the `discovery/topics` controller runs its own `loadingComplete` handler logic in step 1, and the action does not bubble any further.

This commit adds action overrides in `discovery/topics`, so that the new actions only apply to the main `discovery` controller. The need for this does suggest some more radical refactoring is required, but these are very critical routes, and we are very close to a major release.
2022-01-07 17:22:49 +00:00
Arpit Jalan 554ff07786
FIX: when composing a message do not suggest deleted posts users (#15488) 2022-01-07 17:06:11 +05:30
Martin Brennan 04c7776650
DEV: Rolling back bookmarkable column changes (#15482)
It is too close to release of 2.8 for incomplete
feature shenanigans. Ignores and drops the columns and drops
the trigger/function introduced in
e21c640a3c.
Will pick this feature back up post-release.
2022-01-07 12:16:43 +10:00
Kris 9e73bae4a4
UX: prevent crawler view topic-list overflow (#15483) 2022-01-06 20:32:06 -05:00
Alan Guo Xiang Tan bdc868246f DEV: Removing unused lines of code.
The code had no effect on how the markdown-it is being configured.
2022-01-07 09:06:16 +08:00
David Taylor c1f74cd92a
DEV: Update default tagName and connectorTagName for plugin outlets (#13685)
This commit should be a no-op for all existing core outlets. Outlets which are introduced by themes/plugins may see a change in behavior, and should follow the steps below if they want to maintain their previous behavior.

`tagName="" connectorTagName=""` is almost always the correct choice for plugin outlets. 40eba8cd introduced a `noTags=true` shortcut which achieved this, and left a comment saying it should be the future default. This commit does exactly that. To avoid any breaking changes for plugins, all existing plugin outlets have been reviewed and adjusted by following this logic:

1) If `noTags=true`, remove the `noTags` parameter, and do not complete any further steps
2) If `tagName` is not specified, set `tagName="span"` (the previous default)
3) If `connectorTagName` is not specified, set `selectorTagName="div"` (the previous default)
4) If `tagName=""`, remove it
5) If `connectorTagName=""`, remove it

The updates were accomplished with the help of a ruby script:

```ruby
def removeAttr(tag, attribute)
  tag = tag.sub /\s#{attribute}="?\w*"? /, " "
  tag = tag.sub /\s#{attribute}="?\w*"?}}/, "}}"
  tag = tag.sub /^\s*#{attribute}="?\w*"?\n/, ""
  tag
end

files = Dir.glob("app/assets/javascripts/**/*.hbs")

puts "Checking #{files.count} files..."
files.each do |f|
  content = File.read(f)

  count = 0
  edits = 0
  content.gsub!(/{{\s*plugin-outlet.*?}}/m) do |match|
    count += 1

    result = match

    noTags = result.include?("noTags=true")
    tagName = result[/tagName="(\w*)"/, 1]
    connectorTagName = result[/connectorTagName="(\w*)"/, 1]

    if noTags
      result = removeAttr(result, "noTags")
    else
      if connectorTagName == ""
        result = removeAttr(result, "connectorTagName")
      elsif connectorTagName.nil?
        result = result.sub(/name="[\w-]+"/) { |m| "#{m} connectorTagName=\"div\"" }
      end

      if tagName == ""
        result = removeAttr(result, "tagName")
      elsif tagName.nil?
        result = result.sub(/name="[\w-]+"/) { |m| "#{m} tagName=\"span\"" }
      end
    end

    edits += 1 if match != result

    result
  end

  puts "#{count} outlets, #{edits} edited -> #{f}"

  File.write(f, content)
end
```
2022-01-06 20:38:17 +00:00
David Taylor 2bcb5360b6
DEV: Modernise navigation-bar plugin-outlet (#15478)
This workaround was introduced before we had the ability to render components with no wrapper element. Now we can pass `tagName=""` to `plugin-outlet`.
2022-01-06 19:15:29 +00:00
David Taylor 78d0ec35a5
DEV: Deprecate OAuth2Authenticator and OAuth2UserInfo (#15427)
These have been superseded by ManagedAuthenticator and UserAssociatedAccount. For more information, see https://meta.discourse.org/t/106695
2022-01-06 16:50:18 +00:00
Andrei Prigorshnev 9006c07373
FEATURE: Make the draft error exclamation in composer red (#15475) 2022-01-06 19:28:18 +04:00
Arpit Jalan cfcdedb709
FIX: new-topic feature was broken when 'Default List Filter' was set to 'no subcategories' (#15476)
https://meta.discourse.org/t/directly-linking-to-new-topic-not-working-when-default-list-filter-no-sub-categories/197447
2022-01-06 20:48:08 +05:30
Andrei Prigorshnev 16d9b2755c
DEV: rename single_sign_on classes to discourse_connect (#15332) 2022-01-06 16:28:46 +04:00
Meghna cc4c7a05e6
UX: better invite accept form (#15472) 2022-01-06 16:31:32 +05:30
Jarek Radosz 5b6acea56e DEV: Remove obsolete topic-progress code 2022-01-06 09:04:30 +08:00
Alan Guo Xiang Tan 85e124bae1 DEV: Remove redundant lines of code.
Engines are enabled by default so there is no need to specify Discourse
specific engines in the object.
2022-01-06 09:02:52 +08:00
Martin Brennan e21c640a3c
DEV: Add polymorphic bookmarkable columns (#15454)
We are planning on attaching bookmarks to more and
more other models, so it makes sense to make a polymorphic
relationship to handle this. This commit adds the new
columns and backfills them in the bookmark table, and
makes sure that any new bookmark changes fill in the columns
via DB triggers.

This way we can gradually change the frontend and backend
to use these new columns, and eventually delete the
old post_id and for_topic columns in `bookmarks`.
2022-01-06 08:56:05 +10:00
David Taylor e6ab8f5b71
DEV: Re-use main app registry for raw HBS view lookups (#15456)
da6edc1 introduced the `lookupView` method, which initialized a fresh resolver, and used it to directly look up raw-views (with no caching). This worked well, but was not a clean solution. It required initializing an entirely new resolver, and did not have any caching.

This commit updates the `helperContext` to include access to the registry, and uses it to perform raw-view lookups. As well as re-using the registry, this also means we're making use of the resolver's built-in cache.

I haven't been able to measure any noticeable performance impact from this change, but there is certainly less work being done, so it may be beneficial on older devices.

Co-authored-by: Ayke Halder <rr-it@users.noreply.github.com>
2022-01-05 22:22:13 +00:00
Robin Ward 6e0e6014d1 FIX: When loading more topics, `showFooter` was not updated properly 2022-01-05 15:12:40 -05:00
Penar Musaraj e04069cf0d
FIX: Jittery topic progress on some window sizes (#15462) 2022-01-05 14:09:25 -05:00
Peter Zhu c5fd8c42db
DEV: Fix methods removed in Ruby 3.2 (#15459)
* File.exists? is deprecated and removed in Ruby 3.2 in favor of
File.exist?
* Dir.exists? is deprecated and removed in Ruby 3.2 in favor of
Dir.exist?
2022-01-05 18:45:08 +01:00
Andrei Prigorshnev 692ba188bf
DEV: migrate routes to the new @action pattern (#15435)
After this fix we have only two routes that use the old "actions:" pattern:
- route:application
- route:discourse

I'll migrate them soon.
2022-01-05 16:08:06 +04:00
Krzysztof Kotlarek 4134c9b478 FIX: use font-down 2022-01-05 10:25:39 +08:00
Krzysztof Kotlarek 719d052ead FIX: smaller pencil icon for edit tags
Pencil icon should be same size as in edit topic title
2022-01-05 10:25:39 +08:00
Martin Brennan 099b679fc5
DEV: Clean up old bookmark code (#15455)
The rake task deleted here was added back in Feb 2020
when bookmarks were first converted from PostAction
records, it is no longer needed. The ignored columns
were removed in ed83d7573e.
2022-01-05 10:02:02 +10:00
Penar Musaraj a717c307ce
FIX: Small adjustments to topic progress position on desktop (#15447) 2022-01-04 18:28:26 -05:00
David Taylor 1f1aa6a0d8
FEATURE: Catch decorateCooked errors from themes/plugins (#15450)
If a theme/plugin raises an error while decorating post content, the decorator will be skipped, and the error reported on the console. Additionally, administrators will be shown a red warning at the top of the screen.

This commit refactors and re-uses some of the logic from the theme-initializer-error-reporting logic. In future, new error reports can be added by doing something like:

```
document.dispatchEvent(
  new CustomEvent("discourse-error", {
    detail: { messageKey: "some.translation.key", error },
  })
);
```
2022-01-04 21:59:52 +00:00
David Taylor 6c5522db77
DEV: Remove JQuery from app.js (#15449) 2022-01-04 19:56:27 +00:00
Kris c4e8ba3965
UX: post action spacing refactor & consistency (#15403) 2022-01-04 09:44:54 -05:00
Penar Musaraj be599513e3
FEATURE: use raster image and autofill in 2FA input (#15429)
- switches to a raster image QR code so it can be long-pressed (or right
clicked) and added to iCloud keychain
- adds `autocomplete="one-time-code"` to the 2FA input for better
discoverability
2022-01-04 15:31:46 +11:00
Martin Brennan ed83d7573e
FIX: Tone down admin dashboard critical problem messaging (#15442)
Keep the title the same as it used to be and only
show the exclamation icon on the critical problems in
the list.
2022-01-04 13:00:58 +10:00
Martin Brennan b22450c7a8
DEV: Drop old bookmark columns (#15405)
As per 22208836c5
these are no longer needed, a follow up commit will remove the ignored
columns.
2022-01-04 11:19:27 +10:00
Martin Brennan 20fe5eceb8
FEATURE: Scheduled group email credential problem check (#15396)
This commit adds a check that runs regularly as per
2d68e5d942 which tests the
credentials of groups with SMTP or IMAP enabled. If any issues
are found with those credentials a high priority problem is added to the
admin dashboard.

This commit also formats the admin dashboard differently if
there are high priority problems, bringing them to the top of
the list and highlighting them.

The problem will be cleared if the issue is fixed before the next
problem check, or if the group's settings are updated with a valid
credential.
2022-01-04 10:14:33 +10:00
Osama Sayegh 61bb0df3f6
FEATURE: Allow topic pin toggle when header is docked (#15438)
Meta topic: https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444?u=osama.

I know there is an inconsistency between the category of the linked topic (#bug) and the title prefix of this PR, but I really couldn't find anything in the code base that suggested this ever worked before, so I'm categorizing this PR as a feature.
2022-01-03 15:21:06 +03:00
Arpit Jalan 702685b6a0
SECURITY: only show user suggestions with regular post (#15436) 2022-01-03 13:37:40 +05:30
David Taylor 7fdb2944b9
DEV: Allow `ember server --environment production` to be used (#15431)
Running in production mode is useful when doing performance-sensitive work.

- Set the `exportApplicationGlobal` flag, so we get the `Discourse` global in production mode. It defaults to only adding the global in development mode. Note that, when generating ember-cli assets via rails, we set this in `ApplicationHelper#discourse_config_environment`.

- Disable SRI - Ember CLI adds this to index.html when in production mode. We don't use SRI in production, so disable here to match.

- Refactor the `AssetRev` logic in `ember-cli-build.js`, so that our custom bundle hashes are find/replaced into index.html. Without this change, our custom bundles (e.g. `start-discourse.js`) remain without their hash in `index.html`, and do not function.

  I have confirmed that the only diff in the `/dist` out following this change is to the `index.html` file. All other filenames and contents remain identical.
2021-12-31 12:26:23 +00:00
Roman Rizzi 23b75d8a2b
FEATURE: Before consolidation callbacks. (#15428)
You can add callbacks that get called before updating an already consolidated notification or creating a consolidated one.

Instances of this rule can add callbacks to access the old notifications about to be destroyed or the consolidated one and add additional data inside the data hash versus having to execute extra queries when adding this logic inside the `set_mutations` block.
2021-12-30 15:40:16 -03:00
Joe 20de49c872 check for code-blocks before loading highlight-js 2021-12-30 12:44:22 -05:00
Joe c5c216563e remove deprecated jQuery workaround 2021-12-30 12:44:22 -05:00
Penar Musaraj 05eaedc810
DEV: revert linting workaround for emoji picker `keydown` action (#15424) 2021-12-30 12:39:21 -05:00
Jordan Vidrine bbca25e875
fix flair misalignment (#15425) 2021-12-29 14:58:10 -06:00
Penar Musaraj 879e35195a
DEV: Small refactor to header offset (#15421)
Centralizes calculations in a helper under the site header component.

This also reverts a small CSS change to the composer: since ac79c5ef,
the composer height was not including the grippie, which means that the
composer height was off by 11 pixels, and the topic progress widget was
sometimes being displayed cut off by 11 pixels.
2021-12-29 11:03:21 -05:00
Penar Musaraj 108c8302fb
FEATURE: Automatic admin editor dark mode (#15419) 2021-12-29 11:02:37 -05:00
Meghna f6db99b56a
UX: improved invite accept page layout (#15418) 2021-12-29 09:12:18 +05:30
Osama Sayegh 8e6988163f
FIX: Don't allow NULL values for `notification_level` in `category_users` (#15407) 2021-12-29 09:19:39 +11:00
Jordan Vidrine 91a816e788
DEV: Add `composer-open` class to body element when compsoer is open (#15420) 2021-12-28 15:25:53 -06:00
Penar Musaraj 312c417366
DEV: Minor topic timeline refactor (#15357) 2021-12-28 12:01:20 -05:00
Joe e09742aa69
FIX: improve the way magnific popup is loaded (#15348) 2021-12-28 11:48:03 -05:00
Arpit Jalan b75cbec4b6
FEATURE: allow sending message via a link to multiple users (#15412)
https://meta.discourse.org/t/possible-to-compose-pre-filled-multi-user-private-message-via-url/78020
2021-12-28 06:35:22 +05:30
Roman Rizzi e005e3f153
DEV: Create post actions without creating a notification and store custom data. (#15397)
I plan to use this in an upcoming discourse-reactions PR, where I want to like a post without notifying the user, so I can instead create a reaction notification.

Additionally, we decouple the a11y attributes from the icon itself, which will let us extend the widget's icon without losing them.
2021-12-27 11:25:37 -03:00
Jarek Radosz 0b34d5ac6c
UX: Maximize the preview space in composer (#15188)
A follow-up to #15117 and #15141. Applies the previous changes to PM-specific fields, makes the preview area take the all the available height of the composer, and unifies more spacing between composer elements.
2021-12-24 12:38:33 +01:00
Roman Rizzi 1ad47030fe
REFACTOR: Use a consolidation rule for collapsing likes. (#15393)
This PR moves the behavior from the PostAlerter. We delete an existing liked notification and set the `username2` attribute to the previous `display_username`. We repeat this process unless the last one is old enough or it's not in the most recent ones.
2021-12-23 09:44:03 -03:00
Rafael dos Santos Silva 435562cc70
FIX: Uploads were broken in old Safari (#15391)
Blob.prototype.arrayBuffer is Safari 14 onwards, so we can check to see if this exists and just skip the checksumming if not.
2021-12-23 08:16:51 +10:00
Bianca Nenciu abb57c350d
FIX: Save draftSequence when it is 0 (#15394)
The first draftSequence value is 0 and that was not recognized as a
valid value by the client.
2021-12-22 22:01:28 +02:00
Bianca Nenciu 28400f1cbe
FIX: Predict draftSequence on draft save (#15390)
The new draft sequence is returned after the draft is saved and usually
it is the old draft sequence plus one and this way the new draft
sequence can be predicted.

Sometimes drafts are saved at odd times or the request is slower than
usual which can create a race condition. This prediction can fix this
problem.
2021-12-22 17:17:32 +02:00
Joffrey JAFFEUX b0dd1b1200
DEV: correctly notify property changes of emoji store (#15389) 2021-12-22 10:59:41 +01:00
Martin Brennan 667a8a63b3
DEV: Drop jQuery file uploader and old upload components (#15376)
This commit removes jQuery file uploader from Discourse,
completing the transition to Uppy. The image-uploader
and UploadMixin components are also removed in this commit
as they have already been replaced and are the only things
using jQuery file upload.

            .-'~~~`-.
          .'         `.
          |  R  I  P  |
          |   jquery  |
          |    file   |
          |   upload  |
          |           |
        \\| 2013-2021 |//
        -----------------
2021-12-22 08:59:44 +10:00
Jarek Radosz 72ad5bf8bd
FIX: SiteSetting.title was being polluted in StaticController (#15385)
Regressed in #15324
2021-12-21 20:51:18 +01:00
Joffrey JAFFEUX 96982ca2bc
FIX: gives composer options to post:highlight trigger (#15384)
This change allows to prevent page jump, when jump is prevented, due to highlightPost causing a `focus()`.
2021-12-21 19:53:07 +01:00
Osama Sayegh 0192efb37b
FIX: Remove length constraint of `fancy_title` in `topics` (#15381)
The `fancy_title` column in the `topics` table currently has a constraint that limits the column to 400 characters. We need to remove that constraint because it causes some automatic topics/PMs from the system to fail when using Discourse in locales that need more than 400 characters to the translate the content of those automatic messages.

Internal ticket: t58030.
2021-12-21 21:24:23 +03:00
Mark VanLandingham 5a0e878a8a
DEV: Add callback when search is empties in choose-topic (#15380) 2021-12-21 11:58:39 -06:00
Andrei Prigorshnev f97c8ff0a6
DEV: add a container to the empty-state layout to simplify styling in themes (#15264) 2021-12-21 21:37:29 +04:00
Andrei Prigorshnev c202252190
FEATURE: when suggesting usernames skip input that consist entirely of disallowed characters (#15368) 2021-12-21 21:13:05 +04:00
Andrei Prigorshnev 952bebc5a1
FIX: fallback to `anonymous` not `user` when suggesting usernames for anonymous users (#15354) 2021-12-21 21:09:55 +04:00
Mark VanLandingham 852dc85504
DEV: Add div around choose-topic results (#15379) 2021-12-21 08:54:40 -06:00
Martin Brennan 3ca1b17589
DEV: Change images-uploader to use Uppy (#15375)
Missed this one, it is only used for the selectable_avatars
site setting.
2021-12-21 15:53:44 +10:00
Martin Brennan d330a5447d
DEV: Remove old backup uploader and resumable.js (#15365)
Now that d5e380e5c1 has been
committed there is nothing in the codebase that uses either
resumable.js or the old backup-uploader component.

R.I.P resumable.js
2021-12-21 15:02:10 +10:00
Martin Brennan 995c514336
DEV: Handle CORS and other fetch failures for media-optimization-worker (#15364)
Occasionally there will be a misconfigured CORS rule or a different
network failure when loading one of the media optimization WASM scripts.
This commit handles load failures and sends a new installFailed message
from the service worker, so that we don't error and hold up the rest
of the uploads if this occurs; the worker will just not process anything
and will keep trying to install itself with subsequent uploads until it succeeds.

This commit also removes the redundant useUppy variable in the worker
this should have been removed a while ago in f70e6c302f
2021-12-21 09:00:19 +10:00
Kris 07436e9d8c
UX: update navigation-container scaling & wrapping (#15372) 2021-12-20 17:08:03 -05:00
Penar Musaraj 973c9bdcd3
FIX: Menu panel position adjustment (#15358) 2021-12-20 10:25:37 -05:00
Joffrey JAFFEUX 40d1bbab5d
DEV: implements actionDecriptionWidget (#15367)
This will allow to have more complex behaviors in post-small-actions, while keeping most of the behavior consistent.
2021-12-20 14:53:43 +01:00
Martin Brennan d5e380e5c1
DEV: Promote uppy backup uploader to primary uploader (#15363)
This commit removes the enable_experimental_backup_uploader site
setting and the flags in backups-index.hbs to make the uppy
backup uploader the main one from now on.

A follow-up commit will delete the old backup uploader code and
also remove resumable.js from the project.
2021-12-20 13:39:35 +10:00
Sam b6c3e9aa03
FEATURE: hide_email_address_taken forces use of email in forgot password form (#15362)
* FEATURE: hide_email_address_taken forces use of email in forgot password form

This strengthens this site setting which is meant to be used to harden sites
that are experiencing abuse on forgot password routes.

Previously we would only deny letting people know if forgot password worked on not
New change also bans usage of username for forgot password when enabled
2021-12-20 12:54:10 +11:00
Martin Brennan 1cdb5b7e4a
DEV: Add uppyReady hook to uppy mixins (#15361)
This should be overridden in a child component if you need to
hook into uppy events and be sure that everything is already
set up for _uppyInstance.
2021-12-20 11:00:20 +10:00
Martin Brennan 2d68e5d942
FEATURE: Scheduled problem checks for admin dashboard (#15327)
This commit introduces scheduled problem checks for the admin dashboard, which are long running or otherwise cumbersome problem checks that will be run every 10 minutes rather than every time the dashboard is loaded. If these scheduled checks add a problem, the problem will remain until it is cleared or until the scheduled job runs again.

An example of a check that should be scheduled is validating credentials against an external provider.

This commit also introduces the concept of a `priority` to the problems generated by `AdminDashboardData` and the scheduled checks. This is `low` by default, and can be set to `high`, but this commit does not change any part of the UI with this information, only adds a CSS class.

I will be making a follow up PR to check group SMTP credentials.
2021-12-20 09:59:11 +10:00
Penar Musaraj cebf55f590
DEV: Remove `jquery-tags-input` dependency (#15344) 2021-12-17 14:53:52 -05:00
Penar Musaraj 178acd4d46
DEV: Remove jQuery color dependency (#15340) 2021-12-17 14:26:16 -05:00
Penar Musaraj 62d1114bad
DEV: Fix linting issue with emoji `keydown` event (#15352) 2021-12-17 12:29:52 -05:00
Penar Musaraj 4ee5d52ac9
DEV: Remove jQuery autoellipsis dependency (#15336) 2021-12-17 11:45:12 -05:00
Joffrey JAFFEUX e71cd73965
UX: correctly handles escape on emoji picker (#15351) 2021-12-17 16:18:33 +01:00
Joffrey JAFFEUX bec76f937c
DEV: drops jquery from scrolling-post-stream (#15313)
Note that this commit also introduces a `domUtils` helper to handle most complex operations in vanilla JS compared to using jQuery.
2021-12-17 14:52:42 +01:00
Gerhard Schlager 769388b8ba FIX: Translation overrides from fallback locale didn't work on client
Discourse sent only translation overrides for the current language to the client instead of sending overrides from fallback locales as well. This especially impacted en_GB -> en since most overrides would be done in English instead of English (UK).

This also adds lots of tests for previously untested code.

There's a small caveat: The client currently doesn't handle fallback locales for MessageFormat strings. That is why overrides for those strings always have a higher priority than regular translations. So, as an example, the lookup order for MessageFormat strings in German is:
1. override for de
2. override for en
3. value from de
4. value from en
2021-12-17 14:03:35 +01:00
Gerhard Schlager 4cd5158974 FIX: "Customize Text" showed compiled MessageFormat string for overridden `_MF` translations 2021-12-17 14:03:35 +01:00
Joffrey JAFFEUX 8e9799da72
Revert "DEV: supports actionClick for small actions (#15331)" (#15350)
This reverts commit 022dba4727.
2021-12-17 14:02:12 +01:00
Joffrey JAFFEUX afdc01a8d8
DEV: allows to import decorateGithubOneboxBody (#15349) 2021-12-17 10:05:04 +01:00
Joffrey JAFFEUX 022dba4727
DEV: supports actionClick for small actions (#15331) 2021-12-17 09:55:54 +01:00
Joffrey JAFFEUX cb976ac562
DEV: creates domFromString utility function (#15310) 2021-12-17 09:25:34 +01:00
Jarek Radosz e6480bbb04
DEV: Remove iOS 9.3 polyfills (#15343)
We're on iOS 15.2 now. 🙂
2021-12-17 02:47:13 +01:00
Jarek Radosz 5eab90e0f8
FIX: Incorrect header offset calculation (#15341)
I somehow changed the sign before committing #15221 🤦
2021-12-17 09:46:31 +08:00
Jarek Radosz 2114dd53ef
DEV: Tweak smooth-scroll polyfill speed (#15342)
The polyfill was scrolling much slower than browser that actually support the feature. See: https://github.com/iamdustan/smoothscroll/issues/13

This commit is based on 1baba758a7
2021-12-17 02:38:04 +01:00
Penar Musaraj 60851037d8
DEV: Remove unused composer editor preview sync (#15322) 2021-12-16 17:18:54 -05:00
Penar Musaraj d9c511f734
DEV: Refactor animation for invalid inputs in wizard (#15334) 2021-12-16 17:17:36 -05:00
Penar Musaraj 92bff4df93
FIX: Add smooth scrolling polyfill (#15333) 2021-12-16 14:07:52 -05:00
Penar Musaraj 48b7696dbc
DEV: Remove jQuery animate calls (#15321)
Affects j/k navigation and PM interaction with @discobot.
2021-12-16 11:00:09 -05:00
Andrei Prigorshnev 9365c4b364
DEV: make sure we handle staged users correctly in DiscourseConnect (#15320)
Some time ago, we made this fix to external authentication –  https://github.com/discourse/discourse/pull/13706. We didn't address Discourse Connect (https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045) at that moment, so I wanted to fix it for Discourse Connect as well.

Turned out though that Discourse Connect doesn't contain this problem and already handles staged users correctly. This PR adds tests that confirm it. Also, I've extracted two functions in Discourse Connect implementation along the way and decided to merge this refactoring too (the refactoring is supported with tests).
2021-12-16 19:44:07 +04:00
Joffrey JAFFEUX 81b0ac1766
FIX: uses new format for search tag endpoint to prevent issues (#15328)
Due to our usage of fixtures, backend changes didn't get catch.
2021-12-16 11:57:47 +01:00
Jarek Radosz 2a4df93b8e
FEATURE: Allow to modify topic-backed static pages (#15324)
A plugin API that allows customizing existing topic-backed static pages, like:
faq, tos, privacy (see: StaticController) The block passed to this
method has to return a SiteSetting name that contains a topic id.

```
add_topic_static_page("faq") do |controller|
  current_user&.locale == "pl" ? "polish_faq_topic_id" : "faq_topic_id"
end
```

You can also add new pages in a plugin, but remember to add a route,
for example:

```
get "contact" => "static#show", id: "contact"
```
2021-12-16 04:24:11 +01:00
Kris ad4faf637c
UX: Always show avatar on mobile topic lists (#15323) 2021-12-15 20:31:03 -05:00
Kris 1c9a0fe18e
UX: let mobile post controls scroll on overflow (#15305) 2021-12-15 15:36:10 -05:00
jbrw a2fcc360dd
UX: Show group card with animated loading state (#15253)
* Remove _calculateTopOffset entirely

* Show group card with animated loading state

Showing the animated loading state before rending the actual content prevents an
awkward scroll position jump when displaying this card.

This mimics the behaviour of the user card (which uses the same `CardContentsBase` mixin).

* Fix two user card issues

1. A JS console error (with no consequences) when clicking a group mention
2. User cards weren't being loaded from the header (for example, for PMs)

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2021-12-15 13:47:31 -05:00
Penar Musaraj 9fd92f329e
DEV: remove `showHtml` jQuery plugin (#15316) 2021-12-15 13:13:06 -05:00
Penar Musaraj 6120dde65c
DEV: Cleanup `for` attributes in category edit screens (#15284) 2021-12-15 12:37:11 -05:00
Bianca Nenciu 0335c9d77f
FEATURE: Add topic-navigation plugin outlet and popup component (#15081)
Adds a plugin outlet that can be used to insert a popup over topic timeline.
2021-12-15 17:16:14 +02:00
Joe 3b3e572ce6
allow themes to change the lock icon easily (#15309) 2021-12-15 09:13:10 -05:00
Andrei Prigorshnev 6afab87d50
DEV: migrate more routes away from the old `actions:` pattern (#15275) 2021-12-15 18:06:10 +04:00
Bianca Nenciu a09b6fe114
FEATURE: Save scroll position on bookmarks page (#15296)
Clicking on a bookmark and then back will preserve the scrolling
position.
2021-12-15 15:27:09 +02:00
Roman Rizzi 0719531bd3
FIX: Notify group members when someone quotes or replies to their post. (#15295)
When a member set a group PM notification level to Normal, we didn't notify group members if someone quoted or replied to one of their posts.
2021-12-15 09:07:39 -03:00
Joffrey JAFFEUX 666d291b24
DEV: minor refactoring or jump-to-post (#15312)
- replaces alias by reads
- drops jquery usage
- autofocus should already be done; so remove custom code
- uses @action
2021-12-15 12:09:26 +01:00
David Taylor 88fa8b5848
DEV: Skip Ember OnError validation for plugin qunit tests (#15314)
If the Ember OnError validation test is added, it breaks the "no tests were run" detection (since at least 1 test is always run). This is particularly important when running tests scoped to a single plugin, because there is no indication that you have typo'd the `qunit_single_plugin` query parameter.
2021-12-15 10:59:38 +00:00
Natalie Tay 77781f9a11
FEATURE: Extend plugin API to add multiple poster icons (#15311) 2021-12-15 18:09:26 +08:00
Martin Brennan e37f0eb240
DEV: Add DropTarget options function for Uppy mixins (#15307)
This is so the target element for file drag + drop is
not always just this.element for the component, and
provides a way to hook into onDragOver and onDragLeave.
By default also adds a .uppy-is-drag-over class to the target
element.
2021-12-15 15:43:07 +10:00
Martin Brennan 4519f3f137
FIX: Add more actions to the uploads API key scope (#15306)
The uploads API key create scope did not cover the
external upload API endpoints, or the direct S3
multipart endpoints, and this commit adds them.

cf. https://meta.discourse.org/t/upload-create-api-key-insufficient/211896
2021-12-15 14:08:11 +10:00
Sam 15752da957
Revert "A11Y: Focus last viewed topic in topic lists (#15300)" (#15304)
This reverts commit 76aeee6735.

Sadly this breaks on non-screen readers on Chrome and Safari
2021-12-15 12:33:33 +11:00