Commit Graph

35296 Commits

Author SHA1 Message Date
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
Martin Brennan c54be3ff25
Add tests for oneboxer.js.es6 (#8418) 2019-11-28 08:20:32 +10:00
Martin Brennan 901054fd75
FIX: Cache failed onebox URL request server-side (#8421)
We already cache failed onebox URL requests client-side, we now want to cache this on the server-side for extra protection. failed onebox previews will be cached for 1 hour, and any more requests for that URL will fail with a 404 status. Forcing a rebake via the Rebake HTML action will delete the failed URL cache (like how the oneboxer preview cache is deleted).
2019-11-28 07:48:29 +10:00
Martin Brennan e7c7a05097
FIX: Mark secure media upload insecure automatically if used for theme component (#8413)
When uploading a file to a theme component, and that file is existing and has already been marked as secure, we now automatically mark the file as secure: false, change the ACL, and log the action as the user (also rebake the posts for the upload)
2019-11-28 07:32:17 +10:00
Gerhard Schlager d12f2580de FIX: Serve crawler view to Google PageSpeed 2019-11-27 22:15:34 +01:00
Roman Rizzi 1c9d18f094
FIX: Correctly ignore/approve replies when acting on a flagged post (#8425) 2019-11-27 17:19:44 -03:00
David Taylor b6e08c06c5 DEV: Remove unused user_auth_token_log_serializer
Usage was removed in f2331ef07f
2019-11-27 16:50:31 +00:00
Joffrey JAFFEUX 119c4d0c1b
DEV: adds a `stringToHTML` helper to be used in tests (#8424)
This will replace the need for jquery: `$(string)`
2019-11-27 17:36:45 +01:00
David Taylor a227083c1c
FEATURE: Limit the number of active sessions for a user (#8411)
If a user has more than 60 active sessions, the oldest sessions will be terminated automatically. This protects performance when logging in and when loading the list of recently used devices.
2019-11-27 12:39:31 +00:00
David Taylor 1a6bbfd10b
FIX: Do not start the login flow when logging out from SSO/Authenticator (#8423)
This affects login_required sites which use SSO or have only one authenticator enabled. Previously, logging out would redirect to the homepage, which would then redirect to the identity provider. Now, users will be redirected to the Discourse login page. This avoids the confusing situation where a user appears to remain logged in after clicking logout.

Sites which have explicitly defined a logout_redirect url are not affected by this change.

For context, see https://meta.discourse.org/t/134138/2
2019-11-27 11:41:07 +00:00
David Taylor 13a0da8c39 DEV: Use shared logout function when revoking all sessions 2019-11-27 11:09:44 +00:00
Arpit Jalan cab9c7c77e Bump onebox version.
- FIX: use dedicated Vimeo onebox for all video types
2019-11-27 16:22:25 +05:30
Dan Ungureanu 2d3113e4da
FIX: Correctly resize lazy loaded images in Oneboxes 2019-11-27 11:49:32 +02:00
Arpit Jalan 520a83aa62 FIX: correct hostname in vimeo.com 2019-11-27 14:52:28 +05:30
Arpit Jalan 52c8cab7f2 FIX: bypass finaldestination check for Vimeo links. 2019-11-27 14:00:46 +05:30
Sam Saffron 88ecb650a9 DEV: Implement a faster Discourse.cache
This is a bottom up rewrite of Discourse cache to support faster performance
and a limited surface area.

ActiveSupport::Cache::Store accepts many options we do not use, this partial
implementation only picks the bits out that we do use and want to support.

Additionally params are named which avoids typos such as "expires_at" vs "expires_in"

This also moves a few spots in Discourse to use Discourse.cache over setex
Performance of setex and Discourse.cache.write is similar.
2019-11-27 16:11:49 +11:00
Sam Saffron 0fb497eb23 DEV: use Discourse.cache over Rails.cache
Discourse.cache is a more consistent method to use and offers clean fallback
if you are skipping redis

This is part of a larger change that both optimizes Discoruse.cache and omits
use of setex on $redis in favor of consistently using discourse cache

Bench does reveal that use of Rails.cache and Discourse.cache is 1.25x slower
than redis.setex / get so a re-implementation will follow prior to porting
2019-11-27 12:36:19 +11:00
Joffrey JAFFEUX 0807751390
REFACTOR: poll-pie-chart widget (#8415)
This commit mostly get rid of the later() call and encapsulate all pie chart display logic inside discourse-poll-pie-canvas widget instead of sharing it between discourse-poll-pie-chart and discourse-poll-pie-canvas
2019-11-27 00:10:43 +01:00
Blake Erickson 2673cad142 DEV: Remove buffered rendering from user directory
This is another refactoring in the multi-step process to remove all uses
of our custom Render Buffer.

Previous commit: e0199e8094 in this
series.

This commit affects the table header sorting on the user directory page.
It is just a refactor and should not change any functionality.
2019-11-26 15:48:43 -07:00
Kris 5f7948ace6 follow up adjustment to ff34ab6 2019-11-26 16:04:40 -05:00