Commit Graph

24495 Commits

Author SHA1 Message Date
Joffrey JAFFEUX 18777d9108
DEV: implements some of ember-truth-helpers (#12667)
The implemented helpers, are helper which might be in Ember core in the future:

- and
- or
- not
- eq
- not-eq
- lt
- lte
- gt
- gte

They follow the implementation of ember-truth-helpers: https://github.com/jmurphyau/ember-truth-helpers

Note 1: Ember rfcs are still debating going with {{not-eq}} or {{neq}}, should be easy to support in the future whatever is finally chosen.

Note 2: this commit also moves it to its own addon, and removes the {{not}} test, to simplify further updates.
2021-04-12 11:40:00 +02:00
Joffrey JAFFEUX 2dc8bfd1ba
UI: adds styling for new github PR body details/summary (#12669)
https://github.com/discourse/onebox/pull/466
2021-04-12 10:45:16 +02:00
Penar Musaraj abb0a4bae2
DEV: Add SCSS helper to replace `asset-uri` and `image-uri` (#12664) 2021-04-12 13:57:39 +10:00
Sam 5deda5ef3e
FIX: automatically timeout long running image magick commands (#12670)
Previously certain images may lead to convert / identify to run for unreasonable
amounts of time

This adds a maximum amount of time these commands can run prior to forcing
them to stop
2021-04-12 13:55:54 +10:00
Joffrey JAFFEUX b6337b72f1
FEATURE: adds last day to about page stats (#12663)
* FEATURE: adds last day to about page stats

* make it clear it's last 24 hours

* applies same copy fix to days
2021-04-12 12:50:33 +10:00
wilson29thid d5b30b9b7b
FEATURE: Add user_confirmed_email to user event webhook (#12539) 2021-04-12 12:48:42 +10:00
Martin Brennan 1ba5ccd8af
FIX: When user has already hit bookmark limit, do not error for clear_reminder! or other updates (#12658)
We introduced a cap on the number of bookmarks the user can add in be145ccf2f. However this has caused unintended side effects; when the `jobs/scheduled/bookmark_reminder_notifications.rb` runs we get this error for users who already had more bookmarks than the limit:

> Job exception: Validation failed: Sorry, you have too many bookmarks, visit #{url}/my/activity/bookmarks to remove some.

This is because the `clear_reminder!` call was triggering a bookmark validation, which raised an error because the user already had to many, holding up other reminders.

This PR also adds `max_bookmarks_per_user` hidden site setting (default 2000). This replaces the BOOKMARK_LIMIT const so we can raise it for certain sites.
2021-04-09 13:06:35 +10:00
Roman Rizzi 8339b8f412
FEATURE: Make the tag_groups#search endpoint public. (#12643)
The method uses the "TagGroup#visible" method to respect the tag group visibility settings.
2021-04-08 14:23:13 -03:00
Vinoth Kannan 26d7eedf4c
FEATURE: trigger webhook when a user added/removed in a group. (#12653)
Whenever a group is added or removed from a group a webhook event will get triggered if it's active.
2021-04-08 21:16:34 +05:30
David Taylor 38e7fe2770
FIX: Ensure group flair upload is present when deciding type (#12650)
Previously, if the upload_id was present, but the upload was missing, the entire site would give a server error.

We have no foreign keys on this relation, so we have to be able to cope with the situation where the upload_id is present, but the actual upload has been deleted.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-04-08 15:54:09 +01:00
Penar Musaraj eb7ff576e5
FEATURE: Use SVG icons for some oneboxes (#12654) 2021-04-08 09:58:12 -04:00
Joffrey JAFFEUX 081ada090c
UX: shows a hint when there are more tags than displayed (#12649) 2021-04-08 15:51:31 +02:00
Robin Ward 7e2b7bdd78
DEV: Adds new plugin API support to always show the topic map (#12642)
You can enable this by using the `includePostAttributes` API call with
the value of `topicMap`. This will always show the topic map at the top
of a topic regardless of how many posts there are.
2021-04-08 08:19:25 -04:00
Joffrey JAFFEUX 6081f8e5e9
UX: always display remove emoji btn from emoji-value-list (#12652)
Although if emoji is not editable it should be disabled.
2021-04-08 13:34:26 +02:00
Joffrey JAFFEUX e463f5ce08
DEV: introduces {{not}} helper (#12651)
Code is coming from https://github.com/jmurphyau/ember-truth-helpers, for now I only ported {{not}} which would have tons of use cases in our code base.

We might want to use more helpers in the future, also Ember should have this kind of helpers natively in the future:

- https://github.com/cibernox/rfcs/blob/add-logical-operators-to-templates/text/0000-add-logical-operators.md
- https://github.com/cibernox/rfcs/blob/add-equality-operators-to-templates/text/0000-add-equality-operators.md
- https://github.com/cibernox/rfcs/blob/add-numeric-comparison-operators-to-templates/text/0561-add-numeric-comparison-operators.md
2021-04-08 13:25:16 +02:00
Krzysztof Kotlarek 8b735e6f9e
FIX: dismiss new button for tags on top (#12628)
Currently, new topics for specific tags can be dismissed with the button at the bottom of the page.

When there is more than 15 new topics, we should display the same button at the top as well. It already works in the same manner for categories.
2021-04-08 10:46:08 +10:00
Kris d12707c18e
FIX: mobile topic list number alignment (#12641) 2021-04-07 18:14:12 -04:00
Kris ea2105f3e8
REFACTOR: Consistency, A11Y, and less text for composer toggles (#12627) 2021-04-07 16:15:07 -04:00
David Taylor 9c78bb26d7
FIX: Ensure software-update banner is only shown after 24 hours (#12634)
`isTesting` is a function, so `if(isTesting)` was only checking for the presence of the function. We need to actually evaluate it. Followup to 68a032a734
2021-04-07 17:00:23 +01:00
Roman Rizzi 5e4c0e2caa
FEATURE: Treat site settings as plain text and add a new HTML type. (#12618)
To add an extra layer of security, we sanitize settings before shipping them to the client. We don't sanitize those that have the "html" type.

The CookedPostProcessor already uses Loofah for sanitization, so I chose to also use it for this. I added it to our gemfile since we installed it as a transitive dependency.
2021-04-07 12:51:19 -03:00
Osama Sayegh 2b9ab3a0d9
Revert "FEATURE: Introduce theme/component QUnit tests (#12517)" (#12632)
This reverts commit a53d8d3e61 and 105634435f.

Reverted because the change broke some components. Will be added back in a few days.
2021-04-07 17:45:49 +03:00
Joffrey JAFFEUX 68a032a734
DEV: prevents test timeout (#12631)
Clock manipulation seems not reliable in component tests. This blog post does a great job of explaining it: https://dockyard.com/blog/2018/04/18/bending-time-in-ember-tests

Sadly, we don't have all the "recent" ember test helpers and can't use things like `getSettledState()`.

For now this pattern seems the most reliable and easy to apply, albeit not great.

Note if you wish to reproduce the current timeout, the following command should do it: `QUNIT_SEED=215263717493121190480103670124734840282 rake qunit:test`
2021-04-07 15:50:06 +02:00
Ahmed Gagan 2308a58113
DEV: Added support for custom site setting 'emoji_list' (#12414)
Example usage:

```
best_emojis:
    type: emoji_list
    default: laughing|open_mouth|cry|angry|hugs
    client: true
```
2021-04-07 15:32:05 +02:00
Osama Sayegh 105634435f
FIX: Prevent double slashes in Ember templates paths (#12630)
Follow-up to https://github.com/discourse/discourse/pull/12517
2021-04-07 14:08:29 +03:00
Osama Sayegh a53d8d3e61
FEATURE: Introduce theme/component QUnit tests (#12517)
This commit allows themes and theme components to have QUnit tests. To add tests to your theme/component, create a top-level directory in your theme and name it `test`, and Discourse will save all the files in that directory (and its sub-directories) as "tests files" in the database. While tests files/directories are not required to be organized in a specific way, we recommend that you follow Discourse core's tests [structure](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/tests).

Writing theme tests should be identical to writing plugins or core tests; all the `import` statements and APIs that you see in core (or plugins) to define/setup tests should just work in themes.

You do need a working Discourse install to run theme tests, and you have 2 ways to run theme tests:

* In the browser at the `/qunit` route. `/qunit` will run tests of all active themes/components as well as core and plugins. The `/qunit` now accepts a `theme_name` or `theme_url` params that you can use to run tests of a specific theme/component like so: `/qunit?theme_name=<your_theme_name>`.

* In the command line using the `themes:qunit` rake task. This take is meant to run tests of a single theme/component so you need to provide it with a theme name or URL like so: `bundle exec rake themes:qunit[name=<theme_name>]` or `bundle exec rake themes:qunit[url=<theme_url>]`.

There are some refactors to internal code that's responsible for processing themes/components in Discourse, most notably:

* `<script type="text/discourse-plugin">` tags are automatically converted to modules.

* The `theme-settings` service is removed in favor of a simple `lib` file responsible for managing theme settings. This was done to allow us to register/lookup theme settings very early in our Ember app lifecycle and because there was no reason for it to be an Ember service.

These refactors should 100% backward compatible and invisible to theme developers.
2021-04-07 10:39:57 +03:00
Bianca Nenciu c10df4b58d
FIX: Make HTML scrubber work with deep HTML (#12619)
SearchIndexer and ReindexSearch used to explode for posts with very
deep or invalid HTML content.
2021-04-07 17:02:00 +10:00
Kris cdd5b60447
UX: icon instead of text for hiding mobile preview (#12625) 2021-04-06 22:22:40 -04:00
Arpit Jalan 21664d8a1c
DEV: add JS test for topic bulk action modal (#12621) 2021-04-07 06:34:36 +05:30
Tobias Eigen 2e17e6269c
FIX: Small tweaks to "no messages" education (#12588)
* Remove "Message" button in quick access menu no messages education
* Reword education prompt
* Remove background colour
2021-04-07 09:28:10 +10:00
Martin Brennan 432b839997
FEATURE: Move site updated modal into a less obtrusive prompt (#12577)
This moves the "This site was just updated" modal asking the user if they want to refresh into a subtle prompt that slides down from the header.

Also in this PR I've added a helper to publish message bus messages in JS tests. So instead of this:

```javascript
// Mimic a messagebus message
MessageBus.callbacks
  .filterBy("channel", "/global/asset-version")
  .map((c) => c.func("somenewversion"));
```

We can have:

```javascript
publishToMessageBus("/global/asset-version", "somenewversion");
```
2021-04-07 08:56:48 +10:00
Bianca Nenciu 1682827f67
FIX: Include watched topics from muted categories in digests (#12602)
Topic that are muted or from muted categories are not included in
digests, but non-muted topics from muted categories should be included.
2021-04-07 00:01:15 +03:00
Penar Musaraj 34596beb52
FIX: Keep current filter while navigating posts in a topic (#12620) 2021-04-06 15:00:25 -04:00
Robin Ward 75a0d9aa01
DEV: Add a new plugin outlet to composer bottom for mobile buttons (#12622) 2021-04-06 14:27:34 -04:00
Penar Musaraj cdb99f012b
FIX: Retain tags when loading a topic draft in composer (#12616) 2021-04-06 11:49:06 -04:00
Penar Musaraj 769b3ba8ae
DEV: Add colors/styling to Ember CLI and qunit tests (#12617) 2021-04-06 11:48:44 -04:00
Neil Lalonde e8a9917db1
FEATURE: Allow setting avatar flair for automatic groups (#12586) 2021-04-06 11:13:06 -04:00
Jessica Hamilton 0052fcf7c4
FEATURE: Retrieve an existing link only invite (#12575)
In Improve invite system, a newly created link only invite cannot
be retrieved via API with the invitee's email once created. A new
route, /invites/retrieve, is introduced to fetch an already
created invite by email address.
2021-04-06 11:01:07 -04:00
Kris 1ebb40a713
FIX: show sign up modal when local logins are disabled (#12611) 2021-04-06 10:31:51 -04:00
Penar Musaraj 98ae4e2829
FIX: Clear state after creating new topic (#12615) 2021-04-06 10:17:14 -04:00
Penar Musaraj f56a22bd2e
FIX: New Topic button regression in tag page (#12613) 2021-04-06 09:31:49 -04:00
Joffrey JAFFEUX f14e898f6f
A11Y: makes replies count a button and not a link (#12570) 2021-04-06 08:27:43 +02:00
Kris 80be6e6949
Overflow on user controls breaks select-kit (#12592) 2021-04-05 23:42:44 -04:00
Kris 6f79c452c2
FIX: bulk select on full-page search (#12593) 2021-04-05 23:11:57 -04:00
Kris f8e5df393d
UX: better position for search bulk select button (#12594) 2021-04-05 23:11:43 -04:00
Joffrey JAFFEUX 89f1bb7d2a
FIX: with vanilla js .href and getAttribute("href") are not equal (#12609)
With a link having an empty href: `<a href>foo</a>` doing
`element.href` will give you the URL of the document, to get the same behavior than `$(element).attr("href")` and get "" you need to do `element.getAttribute("href")`
2021-04-06 00:36:28 +02:00
Jeff Wong 1ceefc22d5
FIX: rake themes:install error if theme cannot be updated (#12605)
Count errors on updating themes in the error bucket. Otherwise,
there was a chance that this could hide errors eg, if a deploy key to a
private repo were to be deleted. Admins probably would like to know about this.
2021-04-05 14:52:50 -07:00
Kris 3a18dd5681
Revert "A11Y: Do not use positive tabindex in composer (#12563)" (#12603)
This reverts commit af879b7851.
2021-04-05 14:36:43 -04:00
Joffrey JAFFEUX 8a36b91c2c
DEV: removes jquery usage from intercept-click (#12600) 2021-04-05 11:59:58 +02:00
Arpit Jalan b230c30249
FIX: downloading watched words was broken (#12578) 2021-04-02 23:04:35 +05:30
Dan Ungureanu bfd0c00944
FEATURE: Copying invite link triggers a save (#12581)
Changing the invite type from link to email and then copying it was
confusing because it gave user the impression that the invite was
updated and the invite link will reflect the latest changes, but it
did not.
2021-04-02 11:19:30 +03:00