Commit Graph

43944 Commits

Author SHA1 Message Date
Krzysztof Kotlarek 17ec3bc5b9
FEATURE: date-range tag for local dates (#15474)
New range tag for local dates with syntax like:
```
[date-range from=2022-01-06T13:00 to=2022-01-08 timezone=Australia/Sydney]
```

Previously, 2 dates in one line were considered as range. It was hard to decide if 2 dates are range when they were in separate lines or have some content between them.

New explicit tag should clearly distinguish between single date and range.

Common code from `addLocalDate` is extracted to `addSingleLocalDate`.

Both `addLocalDate` and new `addLocalRange` are using `addSingleLocalDate`.

Also, `defaultDateConfig` was extracted to have one place for all possible parameters.
2022-01-10 08:02:36 +01:00
Alan Guo Xiang Tan fff8b98485 SECURITY: Advanced group search did not respect visiblity of groups. 2022-01-10 13:49:26 +08:00
Jarek Radosz 0f225c8e54 UX: Tweak emoji picker css
1. Hide the results element when empty (and set top-margin of section to 0, which fixes some custom themes)
2. Fixed the on-hover color of .trash-recent
2022-01-10 10:23:21 +08:00
Alan Guo Xiang Tan cd13524e26 FIX: Disable cast votes button for multiple polls with no min.
Multiple polls can be created without the min attribute but that means
the attribute defaults to 1. A default of 0 does not make any sense
because it is equivalent to saying that a user is not casting any votes.
2022-01-10 10:03:17 +08:00
Penar Musaraj c908fa2f5b
FIX: Regression in topic list kbd navigation (#15513) 2022-01-09 17:22:41 -05:00
Jarek Radosz 71cf6839ab
DEV: Add count to missing translation strings (#15509)
…for easier debugging of i18n issues.
2022-01-09 23:10:32 +01:00
dependabot[bot] 25a0fae9a4
Build(deps): Bump faraday from 1.9.2 to 1.9.3 (#15512)
Bumps [faraday](https://github.com/lostisland/faraday) from 1.9.2 to 1.9.3.
- [Release notes](https://github.com/lostisland/faraday/releases)
- [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lostisland/faraday/compare/v1.9.2...v1.9.3)

---
updated-dependencies:
- dependency-name: faraday
  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>
2022-01-09 22:43:38 +01:00
Penar Musaraj fbb8fb0d80
DEV: Remove duplicate emoji files (#15496) 2022-01-09 15:42:36 -05:00
Jarek Radosz 19fcb0b5ea
DEV: Prevent extraneous log message in specs (#15504)
Yo dawg, I put `silence_stdout` in your `silence_stdout` so you can still write to stdout? 🤔
2022-01-09 20:26:52 +01:00
Jarek Radosz 910796c4b4
DEV: Fix git deprecation warnings in specs (#15503)
The warnings on git 2.28+ are:

```
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
```
2022-01-09 20:26:19 +01:00
Jarek Radosz 40147ca2ee
DEV: Don't warn on missing git tags (#15507)
Fixes the following output in specs:

```
fatal: No names found, cannot describe anything.
```
2022-01-09 20:25:58 +01:00
Meghna 5c74f048a5
UX: updated "accept invite" error page (#15490) 2022-01-09 10:21:42 +05:30
Ayke Halder c0d702f01f
DEV: migrate audio cloak-prevention to decorateCookedElement (#15502)
Migrate deprecated decorateCooked to decorateCookedElement for audio cloak-prevention.

This might give a minimal performance boost: running audio cloak-prevention for 20 (non-audio) posts takes 1 ms and not 15 ms.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2022-01-09 01:57:49 +01:00
Jarek Radosz 5a50f18c0c
DEV: Avoid `$` globals (#15453)
Also:
* Remove an unused method (#fill_email)
* Replace a method that was used just once (#generate_username) with `SecureRandom.alphanumeric`
* Remove an obsolete dev puma `tmp/restart` file logic
2022-01-08 23:39:46 +01:00
Dan Ungureanu c0d72ec3d6
FIX: Append /all to URL if default list is 'none' (#15460)
It was impossible to select the 'all' filter for categories that have
the default list filter set to 'no subcategories'. This happens because
'/all' was not appended to the URL and in the absence of any list filter
('all' or 'none'), the default list filter ('none') was automatically
selected.
2022-01-08 13:58:42 +02:00
Jarek Radosz 793c3ae7d4
FIX: Actually save fields on themes:update (#15497)
`RemoteTheme#update_from_remote` does not save theme fields on its own.

Fixes theme/theme component autoupdates working only partially.
2022-01-08 05:41:20 +01:00
Blake Erickson a850568a52
DEV: Document delete post API endpoint (#15495)
Adding a spec for documenting the delete post API endpoint for our api
docs. As part of this added detailed info for the `force_destroy`
parameter for permanently deleting a post.
2022-01-07 16:09:32 -07:00
Penar Musaraj 1ed2520589
DEV: Fewer jQuery calls in offset calculation (#15465) 2022-01-07 16:02:03 -05:00
Rafael dos Santos Silva 0a0e06fcf8
FEATURE: Update emojis (#15468)
* FEATURE: Update emojis

* Add extra aliases for backwards compatibility
2022-01-07 15:49:56 -03:00
janzenisaac 30388512ec
DEV: Retroactively add test for ignoring flagged responses (#15491) 2022-01-07 11:53:31 -06:00
David Taylor f94c01b233
FIX: Refresh logic in discovery topic lists (#15489)
Before 6e0e6014, the flow looked something like:

1. `discovery/topics` controller (which extends `discovery` controller) `afterRefresh()` calls `.send("loadingComplete")`
2. Bubbles to [`discovery` route](554ff07786/app/assets/javascripts/discourse/app/routes/discovery.js (L58))
3. Discovery route calls `controllerFor('discovery').loadingComplete()`. `loading` is set false, and the spinner disappears

Now that `discovery/topics` defines `loadingComplete` as an action, the `discovery/topics` controller runs its own `loadingComplete` handler logic in step 1, and the action does not bubble any further.

This commit adds action overrides in `discovery/topics`, so that the new actions only apply to the main `discovery` controller. The need for this does suggest some more radical refactoring is required, but these are very critical routes, and we are very close to a major release.
2022-01-07 17:22:49 +00:00
Arpit Jalan 554ff07786
FIX: when composing a message do not suggest deleted posts users (#15488) 2022-01-07 17:06:11 +05:30
Osama Sayegh 748e08830f
DEV: Log response headers when getting rate limit errors during smoke tests (#15487)
We've recently added diagnostic headers that Discourse includes in the response when it rate limits a request. This PR makes our smoke tests runner log the response headers it encounters a rate limit error so we can get a better visibility into what caused the rate limit.
2022-01-07 11:50:59 +03:00
Martin Brennan 6b6c0fef4c
DEV: Drop bookmark trigger correctly (#15486)
Apparently `DROP FUNCTION X CASCADE` is the better way to
do this, we were running into cross-schema errors on try.
2022-01-07 15:20:07 +10:00
Martin Brennan 04c7776650
DEV: Rolling back bookmarkable column changes (#15482)
It is too close to release of 2.8 for incomplete
feature shenanigans. Ignores and drops the columns and drops
the trigger/function introduced in
e21c640a3c.
Will pick this feature back up post-release.
2022-01-07 12:16:43 +10:00
Kris 9e73bae4a4
UX: prevent crawler view topic-list overflow (#15483) 2022-01-06 20:32:06 -05:00
Alan Guo Xiang Tan bdc868246f DEV: Removing unused lines of code.
The code had no effect on how the markdown-it is being configured.
2022-01-07 09:06:16 +08:00
dependabot[bot] 7138ebed05
Build(deps): Bump faraday from 1.8.0 to 1.9.2 (#15479)
Bumps [faraday](https://github.com/lostisland/faraday) from 1.8.0 to 1.9.2.
- [Release notes](https://github.com/lostisland/faraday/releases)
- [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lostisland/faraday/compare/v1.8.0...v1.9.2)

---
updated-dependencies:
- dependency-name: faraday
  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>
2022-01-06 22:16:40 +01:00
David Taylor c1f74cd92a
DEV: Update default tagName and connectorTagName for plugin outlets (#13685)
This commit should be a no-op for all existing core outlets. Outlets which are introduced by themes/plugins may see a change in behavior, and should follow the steps below if they want to maintain their previous behavior.

`tagName="" connectorTagName=""` is almost always the correct choice for plugin outlets. 40eba8cd introduced a `noTags=true` shortcut which achieved this, and left a comment saying it should be the future default. This commit does exactly that. To avoid any breaking changes for plugins, all existing plugin outlets have been reviewed and adjusted by following this logic:

1) If `noTags=true`, remove the `noTags` parameter, and do not complete any further steps
2) If `tagName` is not specified, set `tagName="span"` (the previous default)
3) If `connectorTagName` is not specified, set `selectorTagName="div"` (the previous default)
4) If `tagName=""`, remove it
5) If `connectorTagName=""`, remove it

The updates were accomplished with the help of a ruby script:

```ruby
def removeAttr(tag, attribute)
  tag = tag.sub /\s#{attribute}="?\w*"? /, " "
  tag = tag.sub /\s#{attribute}="?\w*"?}}/, "}}"
  tag = tag.sub /^\s*#{attribute}="?\w*"?\n/, ""
  tag
end

files = Dir.glob("app/assets/javascripts/**/*.hbs")

puts "Checking #{files.count} files..."
files.each do |f|
  content = File.read(f)

  count = 0
  edits = 0
  content.gsub!(/{{\s*plugin-outlet.*?}}/m) do |match|
    count += 1

    result = match

    noTags = result.include?("noTags=true")
    tagName = result[/tagName="(\w*)"/, 1]
    connectorTagName = result[/connectorTagName="(\w*)"/, 1]

    if noTags
      result = removeAttr(result, "noTags")
    else
      if connectorTagName == ""
        result = removeAttr(result, "connectorTagName")
      elsif connectorTagName.nil?
        result = result.sub(/name="[\w-]+"/) { |m| "#{m} connectorTagName=\"div\"" }
      end

      if tagName == ""
        result = removeAttr(result, "tagName")
      elsif tagName.nil?
        result = result.sub(/name="[\w-]+"/) { |m| "#{m} tagName=\"span\"" }
      end
    end

    edits += 1 if match != result

    result
  end

  puts "#{count} outlets, #{edits} edited -> #{f}"

  File.write(f, content)
end
```
2022-01-06 20:38:17 +00:00
David Taylor 2bcb5360b6
DEV: Modernise navigation-bar plugin-outlet (#15478)
This workaround was introduced before we had the ability to render components with no wrapper element. Now we can pass `tagName=""` to `plugin-outlet`.
2022-01-06 19:15:29 +00:00
David Taylor cd1d0322f7
DEV: Add email bounce DiscourseEvent for plugins (#15398) 2022-01-06 16:50:37 +00:00
David Taylor 78d0ec35a5
DEV: Deprecate OAuth2Authenticator and OAuth2UserInfo (#15427)
These have been superseded by ManagedAuthenticator and UserAssociatedAccount. For more information, see https://meta.discourse.org/t/106695
2022-01-06 16:50:18 +00:00
Bianca Nenciu c0bb775f3f
SECURITY: Hide user's bio if profile is restricted (#15477)
The bio was sometimes visible in the meta tags even though it it should
not have been.
2022-01-06 18:27:59 +02:00
Andrei Prigorshnev 9006c07373
FEATURE: Make the draft error exclamation in composer red (#15475) 2022-01-06 19:28:18 +04:00
Arpit Jalan cfcdedb709
FIX: new-topic feature was broken when 'Default List Filter' was set to 'no subcategories' (#15476)
https://meta.discourse.org/t/directly-linking-to-new-topic-not-working-when-default-list-filter-no-sub-categories/197447
2022-01-06 20:48:08 +05:30
Andrei Prigorshnev 16d9b2755c
DEV: rename single_sign_on classes to discourse_connect (#15332) 2022-01-06 16:28:46 +04:00
Meghna cc4c7a05e6
UX: better invite accept form (#15472) 2022-01-06 16:31:32 +05:30
Jarek Radosz 5b6acea56e DEV: Remove obsolete topic-progress code 2022-01-06 09:04:30 +08:00
Alan Guo Xiang Tan 85e124bae1 DEV: Remove redundant lines of code.
Engines are enabled by default so there is no need to specify Discourse
specific engines in the object.
2022-01-06 09:02:52 +08:00
Martin Brennan e21c640a3c
DEV: Add polymorphic bookmarkable columns (#15454)
We are planning on attaching bookmarks to more and
more other models, so it makes sense to make a polymorphic
relationship to handle this. This commit adds the new
columns and backfills them in the bookmark table, and
makes sure that any new bookmark changes fill in the columns
via DB triggers.

This way we can gradually change the frontend and backend
to use these new columns, and eventually delete the
old post_id and for_topic columns in `bookmarks`.
2022-01-06 08:56:05 +10:00
David Taylor e6ab8f5b71
DEV: Re-use main app registry for raw HBS view lookups (#15456)
da6edc1 introduced the `lookupView` method, which initialized a fresh resolver, and used it to directly look up raw-views (with no caching). This worked well, but was not a clean solution. It required initializing an entirely new resolver, and did not have any caching.

This commit updates the `helperContext` to include access to the registry, and uses it to perform raw-view lookups. As well as re-using the registry, this also means we're making use of the resolver's built-in cache.

I haven't been able to measure any noticeable performance impact from this change, but there is certainly less work being done, so it may be beneficial on older devices.

Co-authored-by: Ayke Halder <rr-it@users.noreply.github.com>
2022-01-05 22:22:13 +00:00
dependabot[bot] 920236fc78
Build(deps): Bump thor from 1.2.0 to 1.2.1 (#15469)
Bumps [thor](https://github.com/rails/thor) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/rails/thor/releases)
- [Commits](https://github.com/rails/thor/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: thor
  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>
2022-01-05 22:37:37 +01:00
Robin Ward 6e0e6014d1 FIX: When loading more topics, `showFooter` was not updated properly 2022-01-05 15:12:40 -05:00
Penar Musaraj e04069cf0d
FIX: Jittery topic progress on some window sizes (#15462) 2022-01-05 14:09:25 -05:00
Peter Zhu ab33d44bf6 DEV: Fix tests broken in 3.0 due to separation of keyword arguments
Tests fail in Ruby 3.0 and later due to separation of positional and
keyword arguments. RSpec treats the hash at the end of include_examples
as keyword arguments when it should be passed as a positional argument.
2022-01-05 13:37:52 -05:00
janzenisaac 22e8f8af6d
FIX: Clean flagged queue when response to flagged post deleted (#15463) 2022-01-05 12:37:15 -06:00
Peter Zhu c5fd8c42db
DEV: Fix methods removed in Ruby 3.2 (#15459)
* File.exists? is deprecated and removed in Ruby 3.2 in favor of
File.exist?
* Dir.exists? is deprecated and removed in Ruby 3.2 in favor of
Dir.exist?
2022-01-05 18:45:08 +01:00
Andrei Prigorshnev 692ba188bf
DEV: migrate routes to the new @action pattern (#15435)
After this fix we have only two routes that use the old "actions:" pattern:
- route:application
- route:discourse

I'll migrate them soon.
2022-01-05 16:08:06 +04:00
Alan Guo Xiang Tan 21822cf0b7 FIX: Error when voting on a multiple poll without the min/max attrs. 2022-01-05 11:31:18 +08:00
Krzysztof Kotlarek 4134c9b478 FIX: use font-down 2022-01-05 10:25:39 +08:00