Commit Graph

43206 Commits

Author SHA1 Message Date
Roman Rizzi e5c257e5b5
FIX: Reenable global setting HTML support. (#14521) 2021-10-05 16:25:41 -03:00
Blake Erickson fe676f334a
FEATURE: Return subcategories on categories endpoint (#14492)
* FEATURE: Return subcategories on categories endpoint

When using the API subcategories will now be returned nested inside of
each category response under the `subcategory_list` param. We already
return all the subcategory ids under the `subcategory_ids` param, but
you then would have to make multiple separate API calls to fetch each of
those subcategories. This way you can get **ALL** of the categories
along with their subcategories in a single API response.

The UI will not be affected by this change because you need to pass in
the `include_subcategories=true` param in order for subcategories to be
returned.

In a follow up PR I'll add the API scoping for fetching categories so
that a readonly API key can be used for the `/categories.json` endpoint. This
endpoint should be used instead of the `/site.json` endpoint for
fetching a sites categories and subcategories.

* Update PR based on feedback

- Have spec check for specific subcategory
- Move comparison check out of loop
- Only populate subcategory list if option present
- Remove empty array initialization
- Update api spec to allow null response

* More PR updates based on feedback

- Use a category serializer for the subcategory_list
- Don't include the subcategory_list param if empty
- For the spec check for the subcategory by id
- Fix spec to account for param not present when empty
2021-10-05 12:12:31 -06:00
Roman Rizzi 766d337d42
FIX: Display embeddable host's post to category. (#14517)
The host's category was successfully updated on the database, but the category property was not properly set when rendering the component for the first time.
2021-10-05 13:59:27 -03:00
Yasuo Honda dbbfad7ed0 FIX: Support Ruby 3 keyword arguments 2021-10-05 11:25:00 -04:00
Dan Ungureanu 5569723321
DEV: Add plugin outlet to the bottom of flag modal (#14413)
This will be used by discourse-akismet to show the current status of the
Akismet scan (post marked as spam, not spam, etc).
2021-10-05 17:37:16 +03:00
Discourse Translator Bot 0f5d737a61
Update translations (#14513) 2021-10-05 15:59:26 +02:00
Roman Rizzi 437410e269
UX: Global notice no longer accepts HTML. (#14515) 2021-10-05 10:34:26 -03:00
Jarek Radosz d3a59e3f69
DEV: Use Set instead of array-as-an-object (#14511)
I don't know if JS engines were able to optimize-away those gigantic arrays but in any case that's a definite anti-pattern.
2021-10-05 14:35:32 +02:00
Robin Ward cd8a608d17 FIX: Ember CLI was always loading the admin payload in dev mode
The admin payload should only be loaded if the user is staff.
2021-10-05 08:34:10 -04:00
Meghna 1552d06008
UX: capitalize unsubscribed email locale (#14512)
https://meta.discourse.org/t/unsubscribed-description-text-needs-a-capital-letter/205239
2021-10-05 17:13:22 +05:30
Arpit Jalan fbeb854ffc
DEV: replace mailcatcher references with mailhog (#14500) 2021-10-05 15:48:06 +05:30
Arpit Jalan fbe9cd49b6
FIX: Vimeo private video oneboxes were broken (#14510) 2021-10-05 15:46:58 +05:30
Joffrey JAFFEUX 71cf05fbc6
DEV: observe all elements to prevent any missed mutation (#14507) 2021-10-05 12:00:05 +02:00
Dan Ungureanu 74a9c0509b
FIX: Use addresses to compare email header (#14509)
Usually, when an email is received a user lookup is performed using the
email address found in the `From` header. When an email has an
`X-Original-From` header, if it is equal to `Reply-To` then it uses that
one instead. The comparison was sensitive to whitespaces and other
insignificant characters such as quotes because it reconstructed the
`From` header.

For the fixture added in this commit, it compared the reconstructed
`From` header `John Doe <johndoe@example.com>` with the `Reply-To`
header `"John Doe"    <johndoe@example.com>`.
2021-10-05 12:42:19 +03:00
Bianca Nenciu 6a143030f8
FEATURE: Allow users to remove their vote (#14459)
They can use the remove vote button or select the same option again for
single choice polls.

This commit refactor the plugin to properly organize code and make it
easier to follow.
2021-10-05 11:38:49 +03:00
Alan Guo Xiang Tan 12856ab8c2
FIX: Stop tracking incoming message after navigating away take 2. (#14508)
* FIX: Stop tracking incoming message after navigating away take 2.

Previous fix in d82e5cd37c resulted in
counts being flappy as we cleared the active inbox between routes.

Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
2021-10-05 15:00:44 +08:00
Alan Guo Xiang Tan 085eb56ea4
DEV: Allow `onStateChange` callbacks for PM topic tracking state. (#14479)
The changes here are in anticipation of a private plugin that will soon
be merged into Discourse core.
2021-10-05 14:12:01 +08:00
Alan Guo Xiang Tan d82e5cd37c
FIX: Stop incoming message tracking after navigating away. (#14498) 2021-10-05 11:17:20 +08:00
dependabot[bot] bbf9650736
Build(deps): Bump jwt from 2.2.3 to 2.3.0 (#14505)
Bumps [jwt](https://github.com/jwt/ruby-jwt) from 2.2.3 to 2.3.0.
- [Release notes](https://github.com/jwt/ruby-jwt/releases)
- [Changelog](https://github.com/jwt/ruby-jwt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jwt/ruby-jwt/compare/v2.2.3...v2.3.0)

---
updated-dependencies:
- dependency-name: jwt
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 11:03:12 +08:00
dependabot[bot] 710e38c182
Build(deps): Bump rubocop from 1.22.0 to 1.22.1 (#14506)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.22.0 to 1.22.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.22.0...v1.22.1)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 11:02:44 +08:00
Penar Musaraj 724c836ffa
UX: Use consistent category badge font size in dropdowns (#14502) 2021-10-04 17:05:31 -04:00
Penar Musaraj 23df78acb3
UX: Fix label in search when tagging is disabled (#14503) 2021-10-04 17:04:34 -04:00
Roman Rizzi a9d20610d4
FIX: Make score's reason link building more explicit (#14475)
We relied on backticks to identify and replace site setting names with links. Unfortunately, some translations don't follow this convention, breaking this feature.

Additionally, this lets us linkify `category settings` and `watched words` without using HTML in the translations.

You may notice that I split the texts we want to linkify into two groups. I did this on purpose to emphasize those that should be translated (regular_links) from those who don't (site_settings_link). If you can think of a better solution, I'm open to suggestions.
2021-10-04 16:55:09 -03:00
Roman Rizzi 90a3fbc07b
DEV: Remove HTML setting type and sanitization logic. (#14440)
* DEV: Remove HTML setting type and sanitization logic.

We concluded that we don't want settings to contain HTML, so I'm removing the setting type and sanitization logic. Additionally, we no longer allow the global-notice text to contain HTML.

I searched for usages of this setting type in the `all-the-plugins` repo and found none, so I haven't added a migration for existing settings.

* Mark Global notices containing links as HTML Safe.
2021-10-04 15:40:35 -03:00
Andrei Prigorshnev 9f626f2735
FIX: empty state message on the user bookmarks page (#14257)
After adding an empty state banner to the user bookmarks page, we have found the bug. Steps to reproduce:

- Go to the user bookmarks page
- Search for something that doesn’t exist in bookmarks
- Click again Bookmarked on the sidebar or View All Bookmarks on the user menu again
2021-10-04 16:48:45 +04:00
Andrei Prigorshnev 149e869c22
FEATURE: make username suggester suggest `user1`, `user2` etc. for input that contains invalid characters only (#14179)
We were suggesting 111, 1111, 1112 before.

See the discussion on Meta – https://meta.discourse.org/t/curious-account-creation-behaviour/199970/14.
2021-10-04 16:47:55 +04:00
Alan Guo Xiang Tan 34cebfd867
FIX: Exclude PMs that user sent to themselves. (#14496)
Regression from 016efeadf6

Follow-up to 016efeadf6
2021-10-04 11:55:35 +08:00
dependabot[bot] d39315239e
Build(deps): Bump image_optim from 0.30.0 to 0.31.0 (#14494)
Bumps [image_optim](https://github.com/toy/image_optim) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/toy/image_optim/releases)
- [Changelog](https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown)
- [Commits](https://github.com/toy/image_optim/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: image_optim
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-04 11:40:59 +08:00
dependabot[bot] 36c171dc7b
Build(deps): Bump excon from 0.85.0 to 0.86.0 (#14495)
Bumps [excon](https://github.com/excon/excon) from 0.85.0 to 0.86.0.
- [Release notes](https://github.com/excon/excon/releases)
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v0.85.0...v0.86.0)

---
updated-dependencies:
- dependency-name: excon
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-04 11:40:43 +08:00
Alan Guo Xiang Tan 4cade9d7f6
FIX: `Topic.similar_to` results in invalid query for certain locales. (#14497)
For `zh_CN`, we use the `cppjieba_rb` gem to remove stop words so
calling `Search.prepare_data` may result in an empty string.
2021-10-04 11:40:22 +08:00
Kris aba08d1929
DEV: add plugin outlet to categories page (#14491) 2021-10-01 15:50:50 -04:00
David Taylor b6937e936b
FIX: Do not show 'new or updated topics' for mobile categories page (#14490)
This banner should only show on the 'categories + latest topics' view, which is desktop-only

https://meta.discourse.org/t/204979
2021-10-01 16:52:35 +01:00
Roman Rizzi 4c2d5158c5
FIX: Follow the canonical URL when importing a remote topic. (#14489)
FinalDestination now supports the `follow_canonical` option, which will perform an initial GET request, parse the canonical link if present, and perform a HEAD request to it.

We use this mode during embeds to avoid treating URLs with different query parameters as different topics.
2021-10-01 12:48:21 -03:00
Alan Guo Xiang Tan 0359adc0b8
PERF: Avoid running ignored users DB query for anon users. (#14487) 2021-10-01 15:01:27 +08:00
Vinoth Kannan c8d5c049eb
DEV: skip S3 CDN urls with different path in prefix. (#14488)
Previously, while retrieving each upload urls in a post S3 CDN urls with different path in prefix (external urls technically) are considered as uploaded url. It created issue while checking missing uploads.
2021-10-01 12:25:17 +05:30
Alan Guo Xiang Tan f38fd1a5a7
FIX: Error loading suggested topics for anon users. (#14485)
Follow-up to fc1fd1b416
2021-10-01 10:53:05 +08:00
Alan Guo Xiang Tan dad4781806
UX: PM inboxes being expanded incorrectly when viewing tags. (#14478)
Follow-up to 9d5da2b383
2021-10-01 10:48:30 +08:00
Jarek Radosz 62b27ea9f3
DEV: Fix moment warnings (#14482)
When start/end was missing the time component the string passed to `moment()` would have a space at the end. This was causing these warnings:

```
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
```
2021-09-30 22:07:48 +02:00
dependabot[bot] 2d3428f86e
Build(deps): Bump rubocop from 1.21.0 to 1.22.0 (#14476)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.21.0 to 1.22.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.21.0...v1.22.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-30 10:25:19 +08:00
Mark VanLandingham 0cc151c296
DEV: Export resetIdle function in desktop-notifications.js (#14474) 2021-09-29 12:41:31 -05:00
Dan Ungureanu 76a7b75d8a
DEV: Reuse can_invite_to_forum? in can_invite_to? (#14392)
This commit resolves refactors can_invite_to? to use
can_invite_to_forum? for checking the site-wide permissions and then
perform topic specific checkups.

Similarly, can_invite_to? is always used with a topic object and this is
now enforced.

There was another problem before when `must_approve_users` site setting
was not checked when inviting users to forum, but was checked when
inviting to a topic.

Another minor security issue was that group owners could invite to
group topics even if they did not have the minimum trust level to do
it.
2021-09-29 17:40:16 +03:00
Jean 7737d56dd0
FIX: Notify incoming to categories and latest topics view specifically. (#14473) 2021-09-29 10:05:38 -04:00
David Taylor 928f102516
DEV: Clear pretender request log between test runs (#14456)
Previously we would store every FakeRequest object for all tests, resulting in many hundreds/thousands of objects in the `handledRequests` array.

This commit ensures all pretender state is reset between tests.
2021-09-29 14:43:55 +01:00
Andrei Prigorshnev b609f6c11c
FIX: restrict other user's notification routes (#14442)
It was possible to see notifications of other users using routes:
- notifications/responses
- notifications/likes-received
- notifications/mentions
- notifications/edits

We weren't showing anything private (like notifications about private messages), only things that're publicly available in other places. But anyway, it feels strange that it's possible to look at notifications of someone else. Additionally, there is a risk that we can unintentionally leak something on these pages in the future.

This commit restricts these routes.
2021-09-29 16:24:28 +04:00
Joffrey JAFFEUX 2d4b9595e8
DEV: uses standard browser_start_timeout (#14472) 2021-09-29 13:25:34 +02:00
Andrei Prigorshnev 31970bd6fc
DEV: little cleanup in the notifications-index component (#14464)
- There's no need to pass `filter` to `user-notifications-large`. The component doesn't use it.
- Rename css class to avoid confusion (this div has nothing to-do with the Select Kit)
- Remove duplicated declarations in test fixtures
2021-09-29 15:24:55 +04:00
Joffrey JAFFEUX fc432a9cab
FIX: incorrect interpolation was limiting to 1 dispatch / component (#14470) 2021-09-29 11:14:53 +02:00
Alan Guo Xiang Tan a1745e05ae
FIX: Do not publish post for PM topic tracking if not new for user. (#14469) 2021-09-29 13:54:24 +08:00
Alan Guo Xiang Tan 9998090e5b
UX: Don't display group messages link for group with no messages. (#14453) 2021-09-29 10:18:56 +08:00
dependabot[bot] 7bc0700930
Build(deps): Bump rubocop-ast from 1.11.0 to 1.12.0 (#14467)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: rubocop-ast
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 09:47:43 +08:00