Commit Graph

35315 Commits

Author SHA1 Message Date
Dan Ungureanu
e4f05a0d15
FIX: Call the right method 2019-12-03 14:16:06 +02:00
Joffrey JAFFEUX
0d3d2c43a0
DEV: s/\$redis/Discourse\.redis (#8431)
This commit also adds a rubocop rule to prevent global variables.
2019-12-03 10:05:53 +01:00
Roman Rizzi
9eccfb7b52 FIX: Guarantee order to correctly defer replies in review queue (#8426)
Our code used to  approve the first flagged post and ignore the rest in some specific conditions.
2019-12-03 18:39:10 +11:00
Blake Erickson
69213d2ea4 FIX: 500 error for missing badge grouping (#8446)
If a badge grouping happens to have been deleted a 500 error will be
thrown when looking a user's badges.

This fix allows the badge page to still be shown without any errors. The
badge with the missing badge grouping is still displayed.

I'll follow up with a separate pr/commit that will ensure if a badge
grouping is deleted, all badges with that badge_grouping_id will also be
updated.
2019-12-03 18:37:01 +11:00
Martin Brennan
f3109a1f25 Add timezone to current_user_serializer (#8448)
* the code to get current user already got their
  user_option record as well, so adding the timezone
  column to the attributes returned should not create
  any additional overhead. this timezone will be very
  useful for getting momentjs dates relative to the
  user's timezone
2019-12-03 18:31:15 +11:00
Sam Saffron
f65c453555 Revert "FIX: Do not autocomplete categories or emojis in code blocks (#8433)"
This reverts commit b643526d9a.

Sadly this introduces a regex runaway CPU condition, we will re-work
this so it is safe.
2019-12-03 09:27:26 +11:00
Mark VanLandingham
118fef2353
FIX: Hide pie legend when results are grouped (#8445) 2019-12-02 13:59:52 -06:00
Mark VanLandingham
87a298a59b
FIX: Poll pie container was too large (#8444) 2019-12-02 11:51:06 -06:00
Dan Ungureanu
b643526d9a
FIX: Do not autocomplete categories or emojis in code blocks (#8433)
Emojis and category autocomplete show up often when writing code
snippets, which makes it easy to insert unwanted text by mistake.
2019-12-02 18:48:40 +02:00
Robin Ward
5df719a3c2 FEATURE: Support pasting a list of usernames into a PM
This allows you to paste multiple usernames into a PM's recipient list
at once. It supports usernames separated by spaces, commas, and new lines.
2019-12-02 11:28:09 -05:00
Daniel Waterworth
712e171b34 DEV: Don't pass multiple categories to tag-drop
The tag-drop component uses the passed in categories to calculate paths,
but only the last category is relevant, since, from a category we can
calculate its ancestors.
2019-12-02 12:27:19 +00:00
Arpit Jalan
016732cced FEATURE: improve suspect user discovery 2019-12-02 16:39:28 +05:30
Daniel Waterworth
374534f00e DEV: Use category ids in URLs preferentially 2019-12-02 09:28:15 +00:00
Daniel Waterworth
9251065768 FIX: Generate redirect URL correctly when using a subdirectory
The url property of a category contains the base_uri and so it shouldn't
be concatated into a larger URL unless it is the prefix.
2019-12-02 09:28:15 +00:00
Daniel Waterworth
c414db107c FIX: Handle none path correctly with three levels
With a path like "/c/foo/1/none", "none" was being interpreted as an id.
2019-12-02 09:28:15 +00:00
Joffrey JAFFEUX
3cf4ba5069
FIX: ensures censor has always at least an empty string to handle (#8442) 2019-12-02 10:24:07 +01:00
Vinoth Kannan
580b289861 UX: skip leading spaces in selection when adding a link. 2019-11-30 20:14:22 +05:30
Bianca Nenciu
57f108899a
FEATURE: Make site texts controller handle pages and locales (#8408)
Some endpoints are returning i18n keys instead of translated messages
and with these changes, the site_texts endpoint can help translating
those.

Pagination part is needed for better wildcard support. For example,
looking for 'js.notifications' would set 'has_more' to true, but return
only the first 50 messages with no way of fetching the remaining.
2019-11-30 15:16:36 +02:00
Régis Hanol
455147cabe DEV: use DB.after_commit instead of delaying the job 2019-11-29 22:48:39 +01:00
Régis Hanol
5ae570a088 remove unnecessary symlink 2019-11-29 22:23:43 +01:00
Régis Hanol
3807484757 FIX: delay the 'send_advanced_tutorial_message' job to prevent race conditions
When a user accepts an invite with an email address that matches a group
which automatically awards its members Trust Level 2, a race condition might happen
when the 'send_advanced_tutorial_message' job runs.

That job is enqueued inside the 'user_promoted' event which is triggered inside a
transaction on the user record. If the job runs before the transaction is done,
the user record is invisible and this generates an exception.
2019-11-29 22:14:41 +01:00
David Taylor
06c2e28bbb DEV: Remove two more references to instagram_user_infos
Follow-up to ad6f33e5b1
2019-11-29 17:12:06 +00:00
David Taylor
cdec5f154b DEV: Remove remaining reference to instagram_user_infos
Follow-up to ad6f33e5b1
2019-11-29 16:53:53 +00:00
David Taylor
ad6f33e5b1 DEV: Remove unused instagram_user_info model
This has been unused since 703c724cf3
2019-11-29 16:43:38 +00:00
David Taylor
88dce41be1 DEV: Drop unused google and instagram auth_info tables
Information was migrated to user_associated_accounts in fc7938f7e0 and 703c724cf3
2019-11-29 16:28:39 +00:00
David Taylor
dd8fe1a9e7 DEV: Update annotations 2019-11-29 15:49:08 +00:00
David Taylor
a6aada16bd DEV: Refactor API key specs to avoid hard-coding keys
By hard-coding keys, we are not testing the API key system end to end. This change also makes the specs more resilient to upcoming API key changes
2019-11-29 15:16:22 +00:00
Robin Ward
7fee3c61de
Support for custom messages and redirects when creating posts (#8434)
* Support for custom messages and redirects when creating posts

When a post/topic is created Discourse serializes a `NewPostResult`
object. Normally this contains a status like `created_post` or
errors describing why the post could not be created.

There are times when a plugin might want to take the inputted post
and do something in the background. In this case, the plugin
can return a custom `message` and `route_to` attribute in the
`NewPostResult`.

If present, the message will be displayed in an alert, and when "Ok" is
clicked the user will be routed to the new URL.

* Destroy the draft in parallel
2019-11-29 09:30:54 -05:00
Dan Ungureanu
1e0c2235a3
FIX: Optimize quoted images (#8427)
Only images that were part of a lightbox used to be optimized. This
patch ensures that quoted images are also optimized.
2019-11-29 15:18:42 +02:00
Arpit Jalan
8237e0e001
UX: show group full name even when title is same. (#8437) 2019-11-29 13:07:24 +05:30
Krzysztof Kotlarek
6005fadaca FIX: add a unique index to developers table (#8436) 2019-11-29 12:41:42 +11:00
Daniel Waterworth
11a73b3f15 DEV: Client side routing for routes with tag and category context
This moves also moves some of the logic to Category.
2019-11-28 17:58:04 +00:00
Daniel Waterworth
4eb8d1e717 FIX: fix typo 2019-11-28 17:53:13 +00:00
Daniel Waterworth
6431daaa2e DEV: Rename dynamic segment to snake case to fit with Ember convention 2019-11-28 17:53:11 +00:00
Jarek Radosz
0911a9202e
FIX: Make sure the suspended status is up to date (#8432)
Continuation of #8206

The returned suspend attribute was overwriting a computed property, which made the user admin page go out of sync.

Fixes a computed-property.override deprecation (https://emberjs.com/deprecations/v3.x#toc_computed-property-override)
2019-11-28 16:46:14 +01:00
Joffrey JAFFEUX
e92e06c3a7
FIX: adds data-topic-id to quick-access-item (#8430)
This fix will allow discourse-encrypt to decrypt messages titles of the quick-access-pannel for PMs
2019-11-28 11:27:36 +01:00
Joffrey JAFFEUX
7fc99f5e7b
UX: do not show shadow on hover images on touch devices (#8429) 2019-11-28 10:51:08 +01:00
Sam Saffron
d10f55c3e9 Revert "FIX: adds data-topic-id to quick-access-item (#8422)"
This reverts commit 700bd280e4.

Oops looks like this breaks tests:

```
Module Failed: widget:quick-access-item
  Test Failed: escapedContent attribute is not escaped
    Assertion Failed: TypeError: Cannot read property 'match' of undefined
      Expected: true, Actual: false
  Test Failed: anonymous
    Assertion Failed: failed, expected argument to be truthy, was: 0
      Expected: true, Actual: 0
    Assertion Failed: Element .enable-anonymous not found.
  Test Failed: anonymous - switch back
    Assertion Failed: failed, expected argument to be truthy, was: 0
      Expected: true, Actual: 0
    Assertion Failed: Element .disable-anonymous not found.
  Test Failed: log out
    Assertion Failed: failed, expected argument to be truthy, was: 0
      Expected: true, Actual: 0
    Assertion Failed: Element .logout not found.
  Test Failed: content attribute is escaped
    Assertion Failed: TypeError: Cannot read property 'match' of undefined
      Expected: true, Actual: false
```
2019-11-28 16:38:26 +11:00
Joffrey JAFFEUX
700bd280e4 FIX: adds data-topic-id to quick-access-item (#8422)
This fix will allow discourse-encrypt to decrypt messages titles of the quick-access-pannel for PMs
2019-11-28 16:29:17 +11:00
Krzysztof Kotlarek
b120728999
FEATURE: Ability to add components to all themes (#8404)
* FEATURE: Ability to add components to all themes

This is the first and functional step from that topic https://dev.discourse.org/t/adding-a-theme-component-is-too-much-work/15398/16

The idea here is that when a new component is added, the user can easily assign it to all themes (parents).

To achieve that, I needed to change a site-setting component to accept `setDefaultValues` action and `setDefaultValuesLabel` translated label.
Also, I needed to add `allowAny` option to disable that for theme selector.

I also refactored backend to accept both parent and child ids with one method to avoid duplication (Renamed `add_child_theme!` to more general `add_relative_theme!`)

* FIX: Improvement after code review

* FIX: Improvement after code review2

* FIX: use mapBy and filterBy directly
2019-11-28 16:19:01 +11:00
Sam Saffron
7371b427cd DEV: correct a few Ruby 2.7 deprecations
Note:

```
def foo(bar: 1)
end

foo({bar: 2})
# raises a deprecation, instead use:

foo(**{bar: 2})
```

Additionally when matching regexes always use strings. It does not make
sense to match a non string to a regex.
2019-11-28 13:13:29 +11:00
Gerhard Schlager
c218036107 FIX: Make Google Groups scraper work for G Suite users 2019-11-28 02:09:51 +01:00
Blake Erickson
fac91a9e71 DEV: Remove unnecessary watched word test
This test is longer needed now that we are using handlebars which
provides escaping by default.

Follow up to 2bb36d72a3

and bb31e7f5b6
2019-11-27 17:42:22 -07:00
Blake Erickson
2bb36d72a3 DEV: Fix failing test on CI due to whitespace differences
I could not replicate the failure locally, but it was consistently
failing on CI with:

```
  Assertion Failed: it should escape watched words

      Expected:  <img src="x">, Actual:  <img src="x">
```

This commit removes an extra space that was added originally, but I
don't think it is really needed after double checking how it displays in
the UI. The `x` icon and the word have sufficient spacing between them.
If we need to we can tweak it in css instead.
2019-11-27 17:23:49 -07:00
Vinoth Kannan
dcada66aa0 Merge branch 'master' of github.com:discourse/discourse 2019-11-28 05:19:56 +05:30
Vinoth Kannan
fd8ce7256c DEV: don't send staff welcome message to first admin. 2019-11-28 05:19:46 +05:30
Blake Erickson
83a521e8c6 DEV: Fix failing test with watched words
Follow up to: bb31e7f5b6

This commit fixes this failing test:

`Assertion Failed: it should escape watched words`

Now that we have a handlebars template we can us it for escaping because
it does that for us.
2019-11-27 16:48:01 -07:00
Vinoth Kannan
0fed417439 DEV: always trigger 'notification_created' event.
And make prettier happy.
2019-11-28 04:31:55 +05:30
Blake Erickson
bb31e7f5b6 DEV: Remove buffered rendering from watched words
This is another refactoring in the multi-step process to remove all uses
of our custom Render Buffer.

Previous commit: 2673cad142 in this
series.

This commit affects the display of watched words on the admin watched
word page. It is just a refactor and does not change any functionality.
2019-11-27 15:47:13 -07:00
Vinoth Kannan
481c8314f0 FEATURE: consolidate group membership request notifications. 2019-11-28 04:02:35 +05:30