Commit Graph

38724 Commits

Author SHA1 Message Date
jbrw
3593e582a3
FIX - limit number of embedded media items in a post (#10391)
* FIX - limit number of embedded media items in a post

* Add renamed settings to DeprecatedSettings
2020-08-07 12:08:59 -04:00
Daniel Waterworth
abebc4e05e DEV: Use verbose mode when running tests in CI 2020-08-07 17:04:55 +01:00
Daniel Waterworth
e55578681e DEV: Add seed explicitly in turbo_rspec so that runs can be reproduced 2020-08-07 16:51:53 +01:00
Penar Musaraj
86cb5803ba
Convert HEIC uploads to JPG by default (#10395) 2020-08-07 11:17:50 -04:00
Régis Hanol
c5c5bb4fad DEV: prevent already initialized constant warning 2020-08-07 16:28:43 +02:00
Penar Musaraj
78d443ad40
DEV: Add linebreaks around qunit "Tests timed out" message 2020-08-07 09:32:57 -04:00
Penar Musaraj
9c9aa21726
Add site setting to pick dark mode color scheme (#10390)
Co-authored-by: Robin Ward <robin.ward@gmail.com>
2020-08-07 08:52:47 -04:00
Joffrey JAFFEUX
b86198198f
FIX: removes persistedQueryParams as it should work out of the box (#10394)
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.
2020-08-07 09:51:37 +02:00
Guo Xiang Tan
053cbe3112
PERF: Limit characters used to generate headline for search blurb.
We determined using the following benchmark script that limiting to 2500 chars would mean a maximum of
25ms spent generating headlines.

```
require 'benchmark/ips'

string = <<~STRING
Far far away, behind the word mountains...
STRING

def sql_excerpt(string, l = 1000000)
  DB.query_single(<<~SQL)
  SELECT TS_HEADLINE('english', left('#{string}', #{l}), PLAINTO_TSQUERY('mountains'))
  SQL
end

def ruby_excerpt(string)
  output = DB.query_single("SELECT '#{string}'")[0]
  Search::GroupedSearchResults::TextHelper.excerpt(output, 'mountains', radius: 100)
end

puts "Ruby Excerpt: #{ruby_excerpt(string)}"
puts "SQL Excerpt: #{sql_excerpt(string)}"
puts

Benchmark.ips do |x|
  x.time = 10

  [1000, 2500, 5000, 10000, 20000, 50000].each do |l|
    short_string = string[0..l]

    x.report("ts_headline excerpt #{l}") do
      sql_excerpt(short_string, l)
    end

    x.report("actionview excerpt #{l}") do
      ruby_excerpt(short_string)
    end
  end

  x.compare!
end
```

```
actionview excerpt 1000:    20570.7 i/s
actionview excerpt 2500:    17863.1 i/s - 1.15x  (± 0.00) slower
actionview excerpt 5000:    14228.9 i/s - 1.45x  (± 0.00) slower
actionview excerpt 10000:    10906.2 i/s - 1.89x  (± 0.00) slower
actionview excerpt 20000:     6255.0 i/s - 3.29x  (± 0.00) slower
ts_headline excerpt 1000:     4337.5 i/s - 4.74x  (± 0.00) slower
actionview excerpt 50000:     3222.7 i/s - 6.38x  (± 0.00) slower
ts_headline excerpt 2500:     2240.4 i/s - 9.18x  (± 0.00) slower
ts_headline excerpt 5000:     1258.7 i/s - 16.34x  (± 0.00) slower
ts_headline excerpt 10000:      667.2 i/s - 30.83x  (± 0.00) slower
ts_headline excerpt 20000:      348.7 i/s - 58.98x  (± 0.00) slower
ts_headline excerpt 50000:      131.9 i/s - 155.91x  (± 0.00) slower
```
2020-08-07 14:36:52 +08:00
Guo Xiang Tan
cf2797bf58
DEV: Fix lint take 2. 2020-08-07 13:17:51 +08:00
Guo Xiang Tan
e2fc05705f
DEV: Fix lint. 2020-08-07 13:16:17 +08:00
Guo Xiang Tan
e60c74d3c1
FEATURE: Use PG ts_headline for highlighting topic title in search. 2020-08-07 12:43:09 +08:00
Guo Xiang Tan
1d2ba8fd52
DEV: No need to highlight search if PG headline generation is used. 2020-08-07 10:50:30 +08:00
Krzysztof Kotlarek
12a00d6dc5
FEATURE: add advanced order to search (#10385)
Similar to `advanced_filter` I introduced `advanced_order`.

I needed a new option because default orders are evaluated after advanced_filter so I couldn't use it.

Also, that part is a little bit more generic
```
elsif word =~ /order:\w+/
  @order = word.gsub('order:', '').to_sym
nil
```

After those changes, I can use them in plugins in this way:
```
Search.advanced_order(:votes) do |posts|
  posts.reorder("COALESCE((SELECT dvvc.counter FROM discourse_voting_vote_counters dvvc WHERE dvvc.topic_id = subquery.topic_id), 0) DESC")
end
```
2020-08-07 12:47:00 +10:00
Guo Xiang Tan
ab2b6f8dea
FIX: Specify config when generating tsquery using ts_headline. 2020-08-07 10:21:14 +08:00
Krzysztof Kotlarek
fb9c2e5f89
FEATURE: notification for vote plugin (#10384)
This must exist in core as we want to see a correct notification after disable of the voting plugin.
2020-08-07 09:51:16 +10:00
Blake Erickson
149801f99a FIX: PM participants list refreshing after inviting
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.
2020-08-06 14:57:55 -06:00
Kris
7a1816ce23
DEV: Set application template plugin outlets to tagName="" (#10382) 2020-08-06 16:01:24 -04:00
Robin Ward
f03f58e52c REFACTOR: Remove Discourse constants from cleanDOM 2020-08-06 15:34:20 -04:00
Robin Ward
db443d2289 REFACTOR: Use the session for the ServiceWorkerURL 2020-08-06 15:24:43 -04:00
Robin Ward
036a79d273 REFACTOR: Use isTesting() instead of Discourse.testing 2020-08-06 15:18:25 -04:00
Robin Ward
a80d749b9d REFACTOR: Remove an unnecessary Discourse.__container__ 2020-08-06 15:14:20 -04:00
Robin Ward
7cd11bad0c REFACTOR: Use the session to track assetVersion/requiresRefresh
This saves us having to put the data on `Discourse`
2020-08-06 15:09:13 -04:00
Penar Musaraj
af63871d4d
FIX: Missing bottom border in select-kit color list settings 2020-08-06 14:52:17 -04:00
Robin Ward
7df57b35da REFACTOR: Remove Discourse.__widget_helpers
It's now a variable in the context where the templates are created.
2020-08-06 14:35:46 -04:00
Robin Ward
792bd3faff Remove getURL and getURLWithCDN deprecations, they have been removed 2020-08-06 14:01:31 -04:00
Neil Lalonde
1ca81fbb95
FEATURE: set notification levels when added to a group (#10378)
* 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.
2020-08-06 12:27:27 -04:00
Jarek Radosz
cd4f251891
FEATURE: Poll breakdown 2.0 (#10345)
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."
2020-08-06 17:57:06 +02:00
David Taylor
76c02cac65
DEV: Ensure the correct plugin stylesheets are reloaded in development
If a plugin name contained the name of another plugin, the wrong stylesheets would be reloaded. For example, working on discourse-prometheus-alert-receiver would cause discourse-prometheus stylesheets to be reloaded.
2020-08-06 16:10:57 +01:00
Penar Musaraj
87e2c9de24
DEV: Plugins can extend color definitions (#10383) 2020-08-06 09:46:17 -04:00
Penar Musaraj
6fdc711b4a
FEATURE: Allow users to opt out of automatic dark mode (#10377) 2020-08-06 09:45:37 -04:00
David Taylor
8c03868808
DEV: Correctly render data- attributes in widget hbs templates (#10376)
In virtualdom, element 'properties' are not completely synonymous with element 'attributes'. In particular, `data-` properties will not be rendered as attributes. To ensure all attributes are passed through, we need to include them under an `attributes` key. For more info, see https://github.com/Matt-Esch/virtual-dom/blob/master/docs/vnode.md#custom-attributes-data-
2020-08-06 14:33:09 +01:00
Robin Ward
e6c508f690 FIX: User preferences tests didn't always have pretender called 2020-08-06 08:53:13 -04:00
Gerhard Schlager
81247c1f6a DEV: Remove mention of Transifex from locale files 2020-08-06 13:34:00 +02:00
Joe
c047e16285 UX: ensure CSS vars are loaded in the Wizard stylesheet
The in-app select-kit stylesheet references some of the CSS vars we recently added. This commit ensures that those vars are available when that sheet is complied since the wizard lives outside of the app.
2020-08-06 19:19:15 +08:00
David Taylor
df39e372d7
DEV: Add spec for removing and re-adding hotlinked images
Before the recent refactor, this would fail. https://meta.discourse.org/t/154184
2020-08-06 10:01:53 +01:00
Guo Xiang Tan
2193d02433
PERF: Use PG headlines for blurb generation and highlighting for search. 2020-08-06 14:56:29 +08:00
Sam Saffron
ba482c251c
FIX: stop sync of tracking state when list is filtered
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.
2020-08-06 16:34:02 +10:00
Guo Xiang Tan
255b0e9f14
PERF: Replace video and audio links in search blurb while indexing.
In the near future, we will be swtiching to PG headlines to generate the
search blurb. As such, we need to replace audio and video links in the
raw data used for headline generation. This also means that we avoid
replacing links each time we need to generate the blurb.
2020-08-06 12:25:03 +08:00
Guo Xiang Tan
06ef87da51
DEV: Make rubocop happy. 2020-08-06 10:11:07 +08:00
Guo Xiang Tan
ee5d8fba0c
PERF: Optimize ActionView::Helpers::TextHelper#excerpt. 2020-08-06 09:59:20 +08:00
dependabot-preview[bot]
801a078105 Build(deps): Bump rubocop from 0.88.0 to 0.89.0
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.88.0 to 0.89.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.88.0...v0.89.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-06 09:36:41 +08:00
David Taylor
ceb858c70a
PERF: Release post_upload records when downloaded image is removed (#10379)
Previously we would unconditionally keep all images downloaded via pull_hotlinked_images, even if they are later removed from the post. This commit removes that logic, and relies on the existing link_post_uploads process to pick up the downloaded images in `cooked`. Specs are added to ensure this is working correctly for regular hotlinked images, and for oneboxes.
2020-08-06 10:06:34 +10:00
Robin Ward
09254410ea FIX: Only raise proper "error" messages
Also support "1" for `QUNIT_FAIL_FAST` to make it consistent with other
arguments.
2020-08-05 16:27:06 -04:00
Robin Ward
f1b6b1bd0e FIX: Pretender errors were being swallowed
Lots of test were broken and needed fixes.
2020-08-05 15:48:57 -04:00
Robin Ward
b0564205d9 FIX: Raise errors for broken pretender responses in test mode 2020-08-05 15:48:56 -04:00
Vinoth Kannan
aa017f276f FIX: replace fullPath while rewriting the /my/ URLs.
And added the tests. Follow-up to cdca5a2ee4
2020-08-05 23:22:15 +05:30
Robin Ward
0c8365a1a2 Improve output for QUnit tests in CI:
* Uses fewer lines of output
* Always outputs error at the end even if timeout
* Support for QUNIT_FAIL_FAST ENV var to quit at first failure
2020-08-05 13:43:14 -04:00
Robin Ward
18e3339580 Quit tests early, output seed to easily reproduce failure 2020-08-05 12:21:16 -04:00
jbrw
67e8bc5342
FEATURE - allow category group moderators to split/merge topics (#10351) 2020-08-05 10:33:25 -04:00