Commit Graph

24524 Commits

Author SHA1 Message Date
Dan Ungureanu bfa301bd7b
FIX: Show invite validation errors to users (#12717)
The server used to respond with a generic 'error, contact admin' message
which did not offer any hint what the error was. This happened even when
the error could be easily corrected by the user (for example, if they
chose a very common password).
2021-04-15 15:23:49 +03:00
Dan Ungureanu 4d87360f84
UX: Minor styling improvements to invites (#12715)
Reduce the width of the modal to make it consistent with other modals
and use the full width for inputs with a button on the right side.
2021-04-15 14:46:49 +03:00
Dan Ungureanu 85d4b60a45
FIX: Improve error messages for invites (#12714)
The error messages used to include an unnecessary 'Validation failed:
Email' prefix which was removed.
2021-04-15 14:46:32 +03:00
David Taylor c60668a052
FIX: Ensure the top 6 categories are shown in the user summary (#12691)
Previously it would pluck 6 categories which the user had posted in, **then** order them. To select the **top 6** categories, we need to perform the ordering in the SQL query before the LIMIT
2021-04-15 11:05:03 +01:00
Andrei Prigorshnev 3326d1ff73
FEATURE: Tweak slow mode messages and intervals (#12704) 2021-04-15 13:56:10 +04:00
Joffrey JAFFEUX 81498bd131
DEV: updates to onebox 2.2.14 (#12713)
This commit also updates github’s body onebox styles in Discourse core:
- full width
- prevents show-more btn to trigger vertical scrolling
- makes text standout less and slightly bigger
2021-04-15 10:58:39 +02:00
Joffrey JAFFEUX ae27717b61
UX: moves from summary/details to a button to expand github body (#12698) 2021-04-15 08:52:04 +02:00
Rafael dos Santos Silva b5fba751a0
DEV: Do not install service workers in development (#12708) 2021-04-14 18:21:28 -03:00
Robin Ward 32689573fa
FIX: Already sent headers error in Ember CLI (#12706)
If we are sending a custom template, we shouldn't do a `next()`,
we should halt middleware.
2021-04-14 15:25:49 -04:00
Robin Ward e459937ffa
FIX: `this.loading` is undefined, it should be `state.loading` (#12707)
This might prevent issues with double requests on the user notifications panel.
2021-04-14 15:21:54 -04:00
Régis Hanol c1fc2a1e9b
FIX: handle permalinks with query parameters (#12700) 2021-04-14 20:03:25 +02:00
Robin Ward 6a7a8f32f1
FIX: `ember build` was not adding digests to additional bundles (#12703)
* FIX: `ember build` was not adding digests to additional bundles

* Update app/assets/javascripts/discourse/ember-cli-build.js

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-04-14 13:37:22 -04:00
Michael Brown dda1cd6a38 FEATURE: allow setting postgres connection variables via environment 2021-04-14 13:31:32 -04:00
Dan Ungureanu 99dadb2129
PERF: Async notify users after inviting group (#12697)
Inviting a group generates a notification for each member. If this
happens synchronously it may take a while, leading to a poor user
experience.
2021-04-14 19:30:51 +03:00
Dan Ungureanu 8c24a848e0
FEATURE: Reduce invite key length (#12692)
We used to generate invite keys that were 32-characters long which were
not very friendly and lead to very long links. This commit changes the
generation method to use almost all alphanumeric characters to produce
a 10-character long invite key.

This commit also introduces a rate limit for redeeming invites because
the probability of guessing an invite key has increased.
2021-04-14 19:22:16 +03:00
Robin Ward 0afcf9e12e
DEV: Support Node 15 with Ember CLI (#12679)
* DEV: Support Node 15 with Ember CLI

* FIX: Broken tests that needed to be updated in newer Ember CLI
2021-04-14 10:16:39 -04:00
Dan Ungureanu 528cfea079
FEATURE: Auto-activate users invited by email (#12675)
When invited by email, users will receive an invite URL which contains
a token. If that token is present when the invite is redeemed, their
account will be automatically activated.
2021-04-14 12:15:56 +03:00
Bianca Nenciu e4e2c7c66f
FIX: Improve anchor links (#12683)
* FIX: Use theme color for anchor icon

* FIX: Do not count anchor links

* FIX: Do not count hashtags links either

* DEV: Add tests for link_count

* FIX: Disable anchors in quotes and preview

* FIX: Try building some anchor slugs for unicode

* DEV: Fix tests
2021-04-14 10:27:07 +03:00
Martin Brennan eeaecd4fd2
FEATURE: Category setting to allow unlimited first post edits by the owner of the topic (#12690)
This PR adds a new category setting which is a column in the `categories` table, `allow_unlimited_owner_edits_on_first_post`.

What this does is:

* Inside the `can_edit_post?` method of `PostGuardian`, if the current user editing a post is the owner of the post, it is the first post, and the topic's category has `allow_unlimited_owner_edits_on_first_post`, then we bypass the check for `LimitedEdit#edit_time_limit_expired?` on that post.
* Also, similar to wiki topics, in `PostActionNotifier#after_create_post_revision` we send a notification to all users watching a topic when the OP is edited in a topic with the category setting `allow_unlimited_owner_edits_on_first_post` enabled.

This is useful for forums where there is a Marketplace or similar category, where topics are created and then updated indefinitely by the OP rather than the OP making new topics or additional replies. In a way this acts similar to a wiki that only one person can edit.
2021-04-14 15:54:09 +10:00
Martin Brennan c07a6eeb6d
FIX: Software update prompt fixes and improvements (#12648)
* Fixes the z-index of the prompt so it is behind the quick access panels
* Adds a dismiss `X` button (made sure the click target of this was quite big)
* Change structure of HTML to address template lint issues
* Fix aria-hidden not returning true/false
* Reload current page instead of navigating to / when clicking on the prompt message
2021-04-14 10:26:23 +10:00
Martin Brennan 66d17fdd6b
FIX: Topic user bookmarked column is out of sync after post moves (#12612)
When posts are moved from one topic to another, the `topic_user.bookmarked` column for all users in the new and the old topic needs to be resynced, for example because a user bookmarks post 12 in topic 1, then it is moved to topic 2, the topic_user record for topic 1 should no longer be bookmarked. A background job has been added to sync the column for a specified topic, or for no topic at all, which does it for all topics like the migration.

Also includes a migration that we have run in the past to fix bad data.

----

This has been addressed in other places in the past:

https://github.com/discourse/discourse/pull/10211
https://github.com/discourse/discourse/pull/10188
2021-04-14 09:10:53 +10:00
David Taylor da6edc117c
FIX: Allow raw-view classes to be resolved from themes/plugins (#12685)
Since cd24eff5d9, theme modules are now prefixed with the theme id. Therefore themes which defined raw-view classes will be broken

This commit updates the `raw` helper to use the resolver for looking up the view class. This automatically takes care of trying theme/plugin paths in addition to core paths.
2021-04-13 15:05:46 +01:00
Faizaan Gagan c45dbe4159
enable eol-last for eslint and ember-template-lint (#12678)
enable eol-last for eslint and ember-template-lint

Fixed a handlful of .hbs files where newlines weren't present
2021-04-12 17:22:00 -07:00
Robin Ward abe588c2c8
Update `caniuse-lite` to the latest version (#12677) 2021-04-12 14:06:17 -04:00
Ryan Mulligan d837ad8386
DEV: user suspension use .present? (#12676)
As suggested by eviltrout in

https://github.com/discourse/discourse/pull/12666
2021-04-12 12:53:40 -04:00
Jarek Radosz 7d1cef71ff
DEV: Remove ScrollTop mixin (#12673)
It was deprecated (incorrectly! see the import 😅) 5 years ago. No references found anymore in core and all-the-plugins.
2021-04-12 17:52:53 +02:00
Roman Rizzi 958fbfb719
FEATURE: Send an email notification when a post is approved. (#12665)
We now send an email when a queued post is approved, and we create a notification.
2021-04-12 12:08:23 -03:00
Ryan Mulligan 045adb76f2
FIX: only send user suspension emails if email message provided (#12666)
This makes behavior consistent with documentation:

API:

> Will send an email with this message when present

Web UI:

> Optionally, provide more information about the suspension and it will be emailed to the user
2021-04-12 11:03:10 -04:00
Osama Sayegh cd24eff5d9
FEATURE: Introduce theme/component QUnit tests (take 2) (#12661)
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 how Discourse processes JavaScript that comes with themes/components, and these refactors may break your JS customizations; see https://meta.discourse.org/t/upcoming-core-changes-that-may-break-some-themes-components-april-12/186252?u=osama for details on how you can check if your themes/components are affected and what you need to do to fix them.

This commit also improves theme error handling in Discourse. We will now be able to catch errors that occur when theme initializers are run and prevent them from breaking the site and other themes/components.
2021-04-12 15:02:58 +03:00
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