Commit Graph

57070 Commits

Author SHA1 Message Date
David Taylor
32665cf9dd
DEV: Consolidate i18n import paths ()
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00
Jarek Radosz
187b7d74fb
DEV: Fix linting () 2024-11-19 21:43:44 +01:00
Kris
acc7caa816
A11Y: make the uppy image uploader keyboard navigable () 2024-11-19 15:38:13 -05:00
Kris
84fecd370c
A11Y: convert sortable topic list headers to proper buttons () 2024-11-19 15:38:03 -05:00
Angus McLeod
ec7de0fd68
Require permitted scopes when registering a client () 2024-11-19 15:28:04 -05:00
Bianca Nenciu
4f11d16deb
DEV: Remove migrate_column_to_bigint spec helper ()
This spec helper was introduced as a temporary solution to the problem
of mismatched types between primary key and foreign key columns. All
plugins have been migrated and the only remaining use of this helper is
in core Discourse.
2024-11-19 21:22:02 +02:00
David Taylor
79b3cb8289
DEV: Bump @discourse/lint-configs and apply fixes () 2024-11-19 19:10:02 +00:00
David Taylor
a10dcffb73
DEV: Update core lint commands to only affect bundled plugins ()
Non-bundled plugins have their own linting configs/commands, and should not be linted by these package.json commands
2024-11-19 18:56:14 +00:00
Penar Musaraj
7776773a11
FIX: Simplify max-height calculation for chat composer ()
In some rare cases, this was causing the input to be invisible. The
change here means the input will have a smaller max height, but since
here we are limiting this to 25% of the viewport height, it should be
more than fine.

It's also not necessary to include the `chat-header-offset`, it ends up
being only a few pixels' difference (since, again, it is divided by 4).
2024-11-19 12:18:05 -05:00
Ruben Oussoren
f81bf31993
Fix the import votes for posts table to the new table () 2024-11-19 10:53:33 -05:00
David Taylor
d606ac3d8e
DEV: add i18n named export to "discourse-i18n" ()
Soon, we intend to consolidate all js/gjs translation calls to this new function. See https://github.com/discourse/lint-configs/pull/67 and https://github.com/discourse/discourse/pull/29804
2024-11-19 11:25:22 +00:00
Loïc Guitaut
719457e430 DEV: Add a try step to services
This patch adds a new step to services named `try`.

It’s useful to rescue exceptions that some steps could raise. That way,
if an exception is caught, the service will stop its execution and can
be inspected like with any other steps.

Just wrap the steps that can raise with a `try` block:
```ruby
try do
  step :step_that_can_raise
  step :another_step_that_can_raise
end
```
By default, `try` will catch any exception inheriting from
`StandardError`, but we can specify what exceptions to catch:
```ruby
try(ArgumentError, RuntimeError) do
  step :will_raise
end
```

An outcome matcher has been added: `on_exceptions`. By default it will
be executed for any exception caught by the `try` step.
Here also, we can specify what exceptions to catch:
```ruby
on_exceptions(ArgumentError, RuntimeError) do |exception|
  …
end
```

Finally, an RSpec matcher has been added:
```ruby
  it { is_expected.to fail_with_exception }
  # or
  it { is_expected.to fail_with_exception(ArgumentError) }
```
2024-11-19 12:01:07 +01:00
Ted Johansson
682e8df007
FIX: Amend broken settings link in emoji admin breadcrumbs ()
Because of an oversight in a previous PR, the breadcrumb link when visiting Admin > Emoji > Settings was broken. The correct path is customize, not config.
2024-11-19 17:24:49 +08:00
Ted Johansson
c3367c329c
DEV: Make breadcrumb separators unclickable icons ()
The current breadcrumb separators are ">" characters that are added as pseudo-elements. These become part of the clickable area for the links, which causes mis-clicks.

This PR does two things:

- Replace the pseudo-element with a DIcon.
- Make sure the separator is not clickable.
2024-11-19 16:42:43 +08:00
Ted Johansson
d96b8d1001
DEV: Modernize admin emoji JavaScript ()
app/assets/javascripts/admin/addon/templates/emojis.hbs
2024-11-19 15:44:34 +08:00
Martin Brennan
01a160d8af
UX: Add AdminConfigAreaEmptyList component ()
This component can be used as a placeholder on
admin pages where the table has no data as per
the admin UI guidelines.
2024-11-19 16:49:57 +10:00
Joffrey JAFFEUX
582de0ffe3
DEV: adds blocks support to chat messages ()
Blocks allow BOTS to augment the capacities of a chat message. At the moment only one block is available: `actions`, accepting only one type of element: `button`.

<img width="708" alt="Screenshot 2024-11-15 at 19 14 02" src="https://github.com/user-attachments/assets/63f32a29-05b1-4f32-9edd-8d8e1007d705">

# Usage

```ruby
Chat::CreateMessage.call(
  params: {
    message: "Welcome!",
    chat_channel_id: 2,
    blocks: [
      {
         type: "actions",
         elements: [
           { value: "foo", type: "button", text: { text: "How can I install themes?", type: "plain_text" } }
         ]
      }
    ]
  },
  guardian: Discourse.system_user.guardian
)
```

# Documentation

## Blocks

### Actions

Holds interactive elements: button.

#### Fields

| Field | Type | Description | Required? |
|--------|--------|--------|--------|
| type | string | For an actions block, type is always `actions` | Yes |
| elements | array | An array of interactive elements, maximum 10 elements | Yes |
| block_id | string | An unique identifier for the block, will be generated if not specified. It has to be unique per message | No |

#### Example

```json
{
  "type": "actions",
  "block_id": "actions_1",
  "elements": [...]
}
```

## Elements

### Button

#### Fields

| Field | Type | Description | Required? |
|--------|--------|--------|--------|
| type | string | For a button, type is always `button` | Yes |
| text | object | A text object holding the type and text. Max 75 characters | Yes |
| value | string | The value returned after the interaction has been validated. Maximum length is 2000 characters | No |
| style | string | Can be `primary` ,  `success` or `danger` | No |
| action_id | string | An unique identifier for the action, will be generated if not specified. It has to be unique per message | No |

#### Example

```json
{
  "type": "actions",
  "block_id": "actions_1",
  "elements": [
    {
      "type": "button",
      "text": {
          "type": "plain_text",
          "text": "Ok"
      },
      "value": "ok",
      "action_id": "button_1"
    }
  ]
}
```

## Interactions

When a user interactions with a button the following flow will happen:

- We send an interaction request to the server
- Server checks if the user can make this interaction
- If the user can make this interaction, the server will:

  * `DiscourseEvent.trigger(:chat_message_interaction, interaction)`
  * return a JSON document
  
  ```json
  {
    "interaction": {
        "user": {
            "id": 1,
            "username": "j.jaffeux"
        },
        "channel": {
            "id": 1,
            "title": "Staff"
        },
        "message": {
            "id": 1,
            "text": "test",
            "user_id": -1
        },
        "action": {
            "text": {
                "text": "How to install themes?",
                "type": "plain_text"
            },
            "type": "button",
            "value": "click_me_123",
            "action_id": "bf4f30b9-de99-4959-b3f5-632a6a1add04"
        }
    }
  }
  ```
  * Fire a `appEvents.trigger("chat:message_interaction", interaction)`
2024-11-19 07:07:58 +01:00
Krzysztof Kotlarek
04bac33ed9
UX: consistent flags page ()
Add/Edit form should not have an admin header
2024-11-19 14:46:08 +11:00
Joffrey JAFFEUX
55a074e4c3
FIX: ensures category row is not focusable () 2024-11-19 03:50:32 +01:00
Ella E.
79ffbe7cd5
UX: Make cells middle aligned; apply overview class directly to td elements () 2024-11-18 18:42:29 -07:00
Jordan Vidrine
2a59df79d3
UX: Add title & adjust dnd image () 2024-11-18 19:25:41 -06:00
Kris
809ce5f5da
DEV: remove !important from btn-transparent background () 2024-11-19 09:38:10 +11:00
Penar Musaraj
f1849199e9
A11Y: Allow dismissing the discard drafts modal via keyboard () 2024-11-18 15:43:36 -05:00
Rafael dos Santos Silva
d85bc1eff6
DEV: Increase max reports dashboard limit () 2024-11-18 15:54:35 -03:00
Ted Johansson
235c6434c1
FIX: Don't include secret membership groups when serializing other users ()
As part of a previous fix we changed which groups are serialized for a user, in order to fix a bug in the default group selector under user preferences.

However, we should only change this when serializing the current user. This change combines the old code-path and the new based on who is serializing.
2024-11-18 19:25:42 +08:00
Joffrey JAFFEUX
388b9dd38d
FIX: removes aria-hidden on category-status ()
Descendants can gain focus (category badge) and that makes aria-hidden incorrect as a result.
2024-11-18 08:23:50 +01:00
Ella E.
9dab8ed29b
DEV: Moved styles for to be nested under to prevent layout issues affecting other admin tables () 2024-11-17 22:48:47 -07:00
Gary Pendergast
69d9868c7f
FEATURE: Add keyboard shortcuts for jumping to unread channels () 2024-11-18 11:18:58 +11:00
dependabot[bot]
f700a72c8f
Build(deps-dev): Bump ember-cli from 6.0.0 to 6.0.1 ()
Bumps [ember-cli](https://github.com/ember-cli/ember-cli) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/ember-cli/ember-cli/releases)
- [Changelog](https://github.com/ember-cli/ember-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: ember-cli
  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>
2024-11-17 22:40:04 +01:00
Jarek Radosz
6e68de79d2
DEV: Use test-provided assert object () 2024-11-17 22:39:01 +01:00
Ella E.
93983286b5
UX: Increase admin section header contrast () 2024-11-15 19:43:29 -07:00
Jan Cernik
876591fdab
FIX: Signup fields tab order and descriptions () 2024-11-15 18:17:55 -03:00
David Taylor
276bc8a565
DEV: Include plugin directories in search tooling & IDEs ()
Non-bundled plugins are gitignore'd, but we want them to show up in search tools / IDEs. Adding a `.ignore` file with a negative glob lets us achieve this.

Previously, it was up to individuals to work out how to configure their editor to do this when working on plugins.

Also adds negative matchers for the vscode config files, so they show up in the file picker & search.
2024-11-15 16:57:08 +00:00
OsamaSayegh
a28ab171ec DEV: Add index to users.ip_address 2024-11-15 11:17:07 -05:00
Ella E.
4efcc88039
UX: Move flag CTA button from subheader to header ()
* UX: Move flag CTA button from subheader to header

* DEV: Remove unused subpageheader import
2024-11-15 09:12:45 -07:00
David Taylor
8325465dea
DEV: Update vscode config to use ruby-lsp for syntax_tree formatting () 2024-11-15 13:28:15 +00:00
Selase Krakani
9b0cfa99c5
DEV: Gracefully handle remaps which violate DB column constraints ()
* DEV: Gracefully handle remaps which violate DB column constraints

This change implements length constraint enforcement to skip remaps
which exceed column max lengths

* DEV: Only perform skipped column stats lookup when verbose is true

* DEV: Tidy up specs

* DEV: Make skipping violating remap behaviour opt-in

This change introduces a new `skip_max_length_violations` param for
`remap`, set to `false` by default to ensure we still continue to fail
hard when max lenth constraints are violated.

To aid in quick resolution when remaps fail, this change also
adds more context to the exception message to include the offending table
and column information

* Apply suggestions from code review

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>

* FIX: Various fixes

- Linter errors
- Remap status "logger" early return condition

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-11-15 10:42:25 +00:00
Ella E.
a9d6aba427
UX: Update CTA button label to 'Add Emoji' for clarity () 2024-11-14 20:56:40 -07:00
Alan Guo Xiang Tan
6bf0ac730f
FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field ()
Firstly, we need to understand that ActiveRecord can be
connected to a role which prevent writes and this happens in Discourse when a
replica database has been setup for failover purposes. When a role
prevent writes from happening, ActiveRecord will raise the
`ActiveRecord::ReadOnlyError` if a write query is attempted.

Secondly, theme fields are baked at runtime within GET requests. The
baking process involves writing the baked value to the
`ThemeField#baked_value` column in the database.

If we combine the two points above, we can see how the writing of the
baked value to the database will trigger a `ActiveRecord::ReadOnlyError`
in a GET requests when the database is connected to a role preventing
writes. However, failing to bake a theme is not the end of the world and
should not cause GET requests to fail. Therefore, this commit adds a rescue
for `ActiveRecord::ReadOnlyError` in the `ThemeField#ensure_baked!`
method.
2024-11-15 10:19:10 +08:00
Martin Brennan
4e5de17e7c
FIX: Admin backups erroring because of S3 dualstack ()
Followup 0568d36133
Followup 97cf069a06

Due to the S3 dualstack endpoint change, sites with
S3 backups configured but _not_ S3 uploads were erroring,
with admins unable to access the backups page. This
commit fixes the error by not enabling S3 dualstack
endpoints if S3 uploads have not been enabled, backups
don't need to use them.

c.f. https://meta.discourse.org/t/unable-to-backup-or-navigate-to-backups/335899
2024-11-15 12:05:59 +10:00
Jarek Radosz
01a1dc43cb
DEV: Skip flaky styleguide system specs () 2024-11-15 00:13:22 +01:00
David Taylor
d3caa875be
DEV: Fix duplicate port on livereload ()
Followup to fd5ef6896d
2024-11-14 23:05:47 +00:00
dependabot[bot]
e9e6774a4f
Build(deps): Bump excon from 1.2.0 to 1.2.1 ()
Bumps [excon](https://github.com/excon/excon) from 1.2.0 to 1.2.1.
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: excon
  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>
2024-11-14 23:50:30 +01:00
dependabot[bot]
b5c3baabcc
Build(deps): Bump json from 2.8.1 to 2.8.2 ()
Bumps [json](https://github.com/ruby/json) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](https://github.com/ruby/json/compare/v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: json
  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>
2024-11-14 23:50:06 +01:00
dependabot[bot]
2c81ee7d81
Build(deps-dev): Bump rubocop-discourse from 3.8.4 to 3.8.6 ()
Bumps [rubocop-discourse](https://github.com/discourse/rubocop-discourse) from 3.8.4 to 3.8.6.
- [Commits](https://github.com/discourse/rubocop-discourse/compare/v3.8.4...v3.8.6)

---
updated-dependencies:
- dependency-name: rubocop-discourse
  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>
2024-11-14 23:43:36 +01:00
dependabot[bot]
4d89abbc14
Build(deps): Bump ace-builds from 1.36.4 to 1.36.5 ()
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.36.4 to 1.36.5.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.36.4...v1.36.5)

---
updated-dependencies:
- dependency-name: ace-builds
  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>
2024-11-14 23:31:44 +01:00
dependabot[bot]
dd96067df7
Build(deps): Bump faraday-net_http from 3.3.0 to 3.4.0 ()
Bumps [faraday-net_http](https://github.com/lostisland/faraday-net_http) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/lostisland/faraday-net_http/releases)
- [Commits](https://github.com/lostisland/faraday-net_http/compare/v3.3.0...v3.4.0)

---
updated-dependencies:
- dependency-name: faraday-net_http
  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>
2024-11-14 22:55:07 +01:00
dependabot[bot]
84b220d187
Build(deps): Bump uri from 1.0.1 to 1.0.2 ()
Bumps [uri](https://github.com/ruby/uri) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: uri
  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>
2024-11-14 22:54:50 +01:00
Kris
5f130b2971
A11Y: update clickable search dropdown tips to be buttons () 2024-11-14 16:23:43 -05:00
Jan Cernik
2ac1894292
FIX: Error with social logins and fullpage signup () 2024-11-14 16:02:17 -03:00