Commit Graph

43141 Commits

Author SHA1 Message Date
Osama Sayegh 7f3468e7d5
FIX: Decorate posts that are loaded after the initial render in post stream (#14600)
To clarify, this problem is not about the topic posts stream, it's about posts streams like the user Activity one in the profile page (or in technical terms anything using the `{{user-stream}}` component).

Post decorations are currently applied inside a `didInsertElement` hook of the `{{user-stream}}` component. However, when the user scrolls the component will load more posts but these will be missing decorations because the `didInsertElement` is only fired once at the beginning of the component lifecycle.

This PR makes the component keep track of the last decorated post/DOM node, and when new posts are loaded the component fire an event for each new post and pass the post's DOM node with the event. Our plugin API 

(I noticed this problem when I was working on https://github.com/discourse/discourse-follow/pull/37)

Co-authored-by: Robin Ward <robin.ward@gmail.com>
2021-10-14 08:10:13 +03:00
dependabot[bot] 82945a3d21
Build(deps): Bump puma from 5.5.1 to 5.5.2 (#14601)
Bumps [puma](https://github.com/puma/puma) from 5.5.1 to 5.5.2.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v5.5.1...v5.5.2)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  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-14 09:43:20 +08:00
Krzysztof Kotlarek 9062fd9b7a
FIX: improvements for download local dates (#14588)
* FIX: do not display add to calendar for past dates

There is no value in saving past dates into calendar

* FIX: remove postId and move ICS to frontend

PostId is not necessary and will make the solution more generic for dates which doesn't belong to a specific post.

Also, ICS file can be generated in JavaScript to avoid calling backend.
2021-10-14 09:22:44 +11:00
David Taylor ae0ca39bd1
FIX: Ensure embedded replies/reply-to links open in _blank (#14597)
In most cases, these links are handled in JavaScript, so the `href` and `target` are not used. However, when the `link-to-post` refers to a post which is not currently loaded in the DOM (e.g. it is the OP), then the href is used, and we need to add a `target` to prevent page navigation within the embed iframe.
2021-10-13 21:34:30 +01:00
Penar Musaraj 0616a5ac7c
UX: Better visibility for context search (#14599) 2021-10-13 15:52:17 -04:00
Mark VanLandingham 8b25aaed14
DEV: Export register service worker logic (#14598) 2021-10-13 13:19:20 -05:00
Gerhard Schlager 9ab9eda40e
PERF: Reduce work when external sources are allowed in `InlineUploads` (#14594)
It also fixes a bug in `match_bbcode_img()` which didn't check `block_given?` for all conditions.
2021-10-13 18:59:05 +02:00
Mark VanLandingham e1d3175668
DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595) 2021-10-13 11:47:30 -05:00
David Taylor bc68da24cd
DEV: Fix presence testing in legacy ember environment (#14596)
The legacy testing environment will remove the User.current() value before disposing of controllers/components. Presence often involves making HTTP calls during disposal of components, so this can cause issues.

Production, and the modern Ember-CLI environment, do not require this hack, so it is behind an `isTesting() && isLegacyEmber()` check.
2021-10-13 17:24:19 +01:00
Penar Musaraj 74706bab10
UX: Add `Enter` hint to search dropdown (#14587) 2021-10-13 12:09:28 -04:00
Penar Musaraj a3fde50b62
A11Y: Don't output aria label identical to title (#14586) 2021-10-13 11:19:38 -04:00
Joffrey JAFFEUX 11bd3438c4
FIX: groups using users icon were lacking margin in search (#14591) 2021-10-13 12:38:35 +02:00
Bianca Nenciu c4843fc1c1
FEATURE: Allow admins to permanently delete posts and topics (#14406)
Sometimes administrators want to permanently delete posts and topics
from the database. To make sure that this is done for a good reasons,
administrators can do this only after one minute has passed since the
post was deleted or immediately if another administrator does it.
2021-10-13 12:53:23 +03:00
Gerhard Schlager 76c9de2d04
UX: Add missing translation (#14592) 2021-10-13 11:23:53 +02:00
Joffrey JAFFEUX b59c419253
FIX: attempts to observe preview mutation asap (#14590) 2021-10-13 09:28:55 +02:00
Joffrey JAFFEUX 00e8baffa2
FIX: attempts to enforce caret position in filter (#14589) 2021-10-13 08:19:34 +02:00
Penar Musaraj 308823a253
FIX: Use absolute URLs in search shortcut (#14585) 2021-10-13 10:14:45 +05:30
Alan Guo Xiang Tan e3c724f79f
PERF: Use a subquery when excluding a tag from topic query. (#14577)
When a tag with alot of topics is used, we end up allocating a Ruby
array of all the topic ids. Instead, we can just use a subquery here and
handle all of the exclusion logic in PG.

Follow-up to ae13839f98
2021-10-13 09:20:56 +11:00
dependabot[bot] 5ffb810c68 Build(deps): Bump puma from 5.5.0 to 5.5.1
Bumps [puma](https://github.com/puma/puma) from 5.5.0 to 5.5.1.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v5.5.0...v5.5.1)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-12 17:29:12 -04:00
Yasuo Honda 9a083a550c FIX: `BackupRestore::DatabaseRestorer` failures with Ruby 3
Implemented workaround suggested at
https://github.com/freerange/mocha/issues/445#issuecomment-644944003
2021-10-12 17:25:51 -04:00
Vinoth Kannan 1b99f99ff7
UX: remove `aria-label` for buttons when `title` attribute exists. (#14529)
Both `aria-label` and `title` have the same value and NVDA reading both the texts while navigating between buttons. NVDA already has an open issue https://github.com/nvaccess/nvda/issues/7841. We're removing `aria-label` until they fix it.
2021-10-12 23:55:59 +05:30
David Taylor 100095af50
UX: Improve route hierarchy in for user-invites (#14583)
Previously the sidebar was being rendered in the `-show` routes, which meant that it disappeared and re-appeared when each tab was loading. This commit creates a parent `user-invited` route with the sidebar, and then renders the `-show` view in an outlet.

To avoid an extra HTTP request, the invite counts for the sidebar are fetched by the `-show` routes, and then applied to the parent controller. This means that there can be a very slight delay before the counts are displayed, but it is almost unnoticeable in normal use.
2021-10-12 17:39:47 +01:00
Joffrey JAFFEUX be7dcf694e
DEV: correct argument names for addGlobalNotice (#14582) 2021-10-12 17:01:54 +02:00
Osama Sayegh 228264d17c
Revert "DEV: add routes_lazy_route to boost boot-up time (#14545)" (#14581)
This reverts commit f5cf647e57.

The gem breaks usage of Rails URL helpers when used outside views and
controllers, for example in
88ecb83382/app/models/upload.rb (L239-L242)
the `upload_short_path` method call fails with an undefined method
exception when this gem is enabled.
2021-10-12 17:30:38 +03:00
Arpit Jalan d2f9108470
FIX: show group filter only when user is logged in and groups are present (#14578) 2021-10-12 19:46:39 +05:30
Discourse Translator Bot b44119cdb2
Update translations (#14579) 2021-10-12 16:00:22 +02:00
Penar Musaraj 915c93625a
DEV: Add pluginApi support for quick search tips (#14556) 2021-10-12 09:54:00 -04:00
Andrei Prigorshnev 88ecb83382
FEATURE: stop using email as source for username and name suggestions for Single Sign On (#14541)
We don't want to be using emails as source for username and name suggestions in cases when it's possible that a user have no chance to intervene and correct a suggested username. It risks exposing email addresses.
2021-10-12 17:25:54 +04:00
Krzysztof Kotlarek 300ed6ea75
FIX: extract filter pm and categories from UserAction (#14569)
Those two methods are useful for different places like discourse-reactions:

213d90b82f (diff-00e1224615af30993a63193531b5073c11d5c20e91c46e2a59c1cd25e8952da6R203)
2021-10-12 17:37:09 +11:00
Vinoth Kannan eeecb2460d
FIX: nil the baked version after moving the posts. (#14483)
Previosuly, quotes from original topics are rendered incorrectly since the moved posts are not rebaked.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2021-10-12 17:31:18 +11:00
Vinoth Kannan fd9a5bc023
FIX: use category's default sort order in latest & unseen filters only. (#14571)
Previously, even the top topics filter rendered all the topics in default sort order.
2021-10-12 10:25:03 +05:30
Alan Guo Xiang Tan baaee1ca26
UX: Restore new messages button on mobile on PM route. (#14576)
Follow-up to 9d5da2b383
2021-10-12 10:38:31 +08:00
dependabot[bot] c087d1b7db
Build(deps): Bump mini_mime from 1.1.1 to 1.1.2 (#14574)
Bumps [mini_mime](https://github.com/discourse/mini_mime) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/discourse/mini_mime/releases)
- [Changelog](https://github.com/discourse/mini_mime/blob/master/CHANGELOG)
- [Commits](https://github.com/discourse/mini_mime/compare/v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: mini_mime
  dependency-type: direct:production
  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-12 09:21:20 +08:00
dependabot[bot] 85396b8fa8
Build(deps-dev): Bump routes_lazy_routes from 0.4.1 to 0.4.2 (#14575)
Bumps [routes_lazy_routes](https://github.com/amatsuda/routes_lazy_routes) from 0.4.1 to 0.4.2.
- [Release notes](https://github.com/amatsuda/routes_lazy_routes/releases)
- [Commits](https://github.com/amatsuda/routes_lazy_routes/compare/v0.4.1...v0.4.2)

---
updated-dependencies:
- dependency-name: routes_lazy_routes
  dependency-type: direct:development
  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-12 09:21:04 +08:00
Alan Guo Xiang Tan d0595127cc
FIX: Missing excerpt for post small actions in topic timeline. (#14547) 2021-10-12 09:20:35 +08:00
Bianca Nenciu 79e55ec3f0
FIX: Remove List-Post email header (#14554)
* FIX: Remove List-Post email header

This header is used for mailing lists and can confuse some email clients
such as Thunderbird to display wrong replying options.

* FIX: Replace reply_key in email custom headers

Admins can add custom email headers from site settings. Email sender
will try to replace the reply key if %{reply_key} exists or remove the
header if a reply key does not exist.
2021-10-11 20:57:42 +03:00
Bianca Nenciu 8b99a7f73d
FIX: Move check if user is suspended later (#14566)
Calling create_notification_alert could still send a notification to a
suspended user. This just moves the check if user is suspended right
before sending the notification.
2021-10-11 20:55:18 +03:00
Roman Rizzi 7bc7e1aceb
FIX: update translation key to match flag reason. (#14573)
The refactor introduced in https://github.com/discourse/discourse/pull/14475 made this visible. Adds a safeguard to make sure translation is present before trying to linkify backticks.
2021-10-11 10:24:41 -03:00
Theodore Diamantidis 97178cd777
FIX: phpbb import - attachments not embedded in posts (#14570) 2021-10-11 14:27:54 +02:00
dependabot[bot] 9d28de0112
Build(deps): Bump excon from 0.86.0 to 0.87.0 (#14568)
Bumps [excon](https://github.com/excon/excon) from 0.86.0 to 0.87.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.86.0...v0.87.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-11 10:47:40 +01:00
David Taylor 821f14d8e0 DEV: Add basic acceptance tests for quote shortcut and fast-edit 2021-10-11 10:46:38 +01:00
David Taylor 9a3a5b19e9 DEV: Move duplicate `selectText` helper into qunit-helpers 2021-10-11 10:46:38 +01:00
David Taylor 9efc57f0c6 FEATURE: shortcuts for quote (q) and fast edit (e)
Reimplemented following the revert in ce0daae636

This approach uses the global `e`/`q` shortcuts, rather than shifting focus to the `quote-button` component. The current `quoteState` is used to determine whether the quote-button is currently visible. If yes, an appEvent transmits the intention to the quote-button component. If no, the old behavior is maintained.

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2021-10-11 10:46:38 +01:00
Dan Ungureanu d0bd96e19c
FIX: Handle separately invite to topic and forum (#14562)
Invite is used in two contexts, when inviting a new user to the forum
and when inviting an existent user to a topic. The first case is more
complex and it involves permission checks to ensure that new users can
be created. In the second case, it is enough to ensure that the topic
is visible for both users and that all preconditions are met.

One edge case is the invite to topic via email functionality which
checks for both conditions because first the user must be invited to
create an account first and then to the topic.

A side effect of these changes is that all site settings related to
invites refer to inviting new users only now.
2021-10-11 12:19:31 +03:00
Sam f5cf647e57
DEV: add routes_lazy_route to boost boot-up time (#14545)
The lazy route initialization cuts down boot time of rails.

On my local system it cuts out 200ms of boot time taking me from 3.2 to 3 seconds.

This is not a radically enormous amount of time, but paper cuts add up, and a faster boot in dev will make everyone happy.

TBD if we want to also include this in production.

Gem is heavily maintained by @amatsuda, last commit 3 days ago.
2021-10-11 13:22:13 +11:00
Krzysztof Kotlarek 0301b775a8
FIX: topic_tracking_state not erroring when missing user_stat (#14559)
publish_unread should not error when UserStat is missing
2021-10-11 13:20:55 +11:00
Yasuo Honda 2944d2cdd6
FIX: Ruby 3 does not freeze interpolated string (#14567)
Ruby 2.7 or earlier `+contents` returns self.dup
when `frozen_string_literal: true`. However, Ruby 3.0 returns self
because this string is interpolated one, which is not frozen anymore.

This commit uses self.dup to return duplicated string regardless Ruby
versions.
https://bugs.ruby-lang.org/issues/17104
2021-10-11 13:20:18 +11:00
David Taylor 837bd5a6e5
FIX: Fix local-dates in non-post contexts, and in long topics (#14565)
- Stop looking up the topic title from the DOM. On long topics, the topic title may not be present. Instead, we can store the topic title in a data-title attribute during decorateCookedElement, and then access it later. This approach would also allow us to add customize titles per-local-date in future. If there is no topic title available (e.g. when local dates are used elsewhere in the UI), we use the site name to build a sensible default

- Don't require a postId for creating calendar events. We don't have postIds in non-post contexts. At the moment, the 'download ICS' function will fail without a valid postId, so that will need to be fixed in a future commit.
2021-10-08 20:22:52 +01:00
Robin Ward bef5223672 DEV: Plugin API for customizing text in the composer conditionally
Co-authored-by: Isaac Janzen <issac.janzen@discourse.org>
2021-10-08 13:58:18 -04:00
Rafael dos Santos Silva 3eb737c014
FIX: Correct password change path for password managers (#14561) 2021-10-08 14:53:14 -03:00