Commit Graph

55054 Commits

Author SHA1 Message Date
Krzysztof Kotlarek
7b6b7ca863
FIX: fallback to custom type for flags (#27961)
Before migration is run flags code is evaluated. It is causing error:
```
NoMethodError: undefined method `require_message' for an instance of Flag (NoMethodError)
Did you mean?  require_dependency
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activemodel-7.1.3.4/lib/active_model/attribute_methods.rb:489:in `method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/relation/delegation.rb💯in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/relation/delegation.rb💯in `each'
/var/www/discourse/app/models/post_action_type.rb:64:in `reject'
```

The solution is to temporarily fall back to old column name - custom_type
2024-07-18 13:34:01 +10:00
Krzysztof Kotlarek
c7b458931a
DEV: drop readonly from flags custom type (#27960)
Drop readonly as it is causing problems with seed fu
2024-07-18 11:45:08 +10:00
Martin Brennan
48d13cb231
UX: Use a dropdown for SSL mode for group SMTP (#27932)
Our old group SMTP SSL option was a checkbox,
but this was not ideal because there are actually
3 different ways SSL can be used when sending
SMTP:

* None
* SSL/TLS
* STARTTLS

We got around this before with specific overrides
for Gmail, but it's not flexible enough and now people
want to use other providers. It's best to be clear,
though it is a technical detail. We provide a way
to test the SMTP settings before saving them so there
should be little chance of messing this up.

This commit also converts GroupEmailSettings to a glimmer
component.
2024-07-18 10:33:14 +10:00
Martin Brennan
9a0e8fc100
DEV: Hide IMAP site settings (#27948)
We are removing support for IMAP, hiding these site
settings is the first step.

c.f. https://meta.discourse.org/t/imap-support-for-group-inboxes/160588/39
2024-07-18 10:22:09 +10:00
Krzysztof Kotlarek
c975c7fe1b
FEATURE: custom flag can require additional message (#27908)
Allow admin to create custom flag which requires an additional message.

I decided to rename the old `custom_flag` into `require_message` as it is more descriptive.
2024-07-18 10:10:22 +10:00
chapoi
58b7dde599
UX: remove formkit css bleeding into every dropdown (#27955) 2024-07-17 22:26:47 +02:00
Isaac Janzen
f4b87c744b
DEV: Add after-breadcrumbs plugin outlet (#27954) 2024-07-17 13:30:46 -05:00
Joffrey JAFFEUX
b6b0d68576
DEV: various form-kit tweaks (#27950)
- removes unused css code
- improves password control sizing
- adds more spacing between collection items
- correct a typo in collection class

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2024-07-17 20:18:19 +02:00
Isaac Janzen
b3e0e920ed
DEV: Support adding a custom filter on /filter (#27927)
# Context

Currently there is no way to add a custom filter to the experimental `/filter` endpoint. While you can implement a custom `status:` there is no way to include the user's input in a custom query. 

# PR

This PR adds the ability to implement a custom filter. eg. `CUSTOM_FILTER:foo`

- Add `add_filter_custom_filter` for extension
- Add specs
2024-07-17 11:36:38 -05:00
Discourse Translator Bot
6dd09b0868
Update translations (#27936)
* Update translations

* DEV: Spec failed after recent translation changes

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-07-17 15:49:33 +02:00
Kris
c17fab873d
UX: remove whitespace from rendered localdate (#27952) 2024-07-17 09:48:28 -04:00
Natalie Tay
7d02b45304
DEV: Update webhook site setting for topic voting (#27935) 2024-07-17 20:26:48 +08:00
dependabot[bot]
a714ca9759
Build(deps-dev): Bump mocha from 2.4.0 to 2.4.1 (#27946)
Bumps [mocha](https://github.com/freerange/mocha) from 2.4.0 to 2.4.1.
- [Changelog](https://github.com/freerange/mocha/blob/main/RELEASE.md)
- [Commits](https://github.com/freerange/mocha/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: mocha
  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-07-17 13:41:58 +02:00
dependabot[bot]
be741ec9eb
Build(deps): Bump highline from 3.0.1 to 3.1.0 (#27929)
Bumps [highline](https://github.com/JEG2/highline) from 3.0.1 to 3.1.0.
- [Changelog](https://github.com/JEG2/highline/blob/master/Changelog.md)
- [Commits](https://github.com/JEG2/highline/compare/v3.0.1...v3.1.0)

---
updated-dependencies:
- dependency-name: highline
  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>
2024-07-17 11:56:11 +01:00
dependabot[bot]
df6b41464f
Build(deps-dev): Bump @embroider/compat in the embroider group (#27942)
Bumps the embroider group with 1 update: [@embroider/compat](https://github.com/embroider-build/embroider/tree/HEAD/packages/compat).


Updates `@embroider/compat` from 3.5.6 to 3.5.7
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/compat)

---
updated-dependencies:
- dependency-name: "@embroider/compat"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: embroider
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 11:46:11 +01:00
dependabot[bot]
93ac1fbfeb
Build(deps-dev): Bump bullet from 7.1.6 to 7.2.0 (#27899)
Bumps [bullet](https://github.com/flyerhzm/bullet) from 7.1.6 to 7.2.0.
- [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/bullet/compare/7.1.6...7.2.0)

---
updated-dependencies:
- dependency-name: bullet
  dependency-type: direct:development
  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-07-17 11:45:34 +01:00
dependabot[bot]
d4cad31cfc
Build(deps-dev): Bump rubocop-rspec from 3.0.2 to 3.0.3 (#27898)
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v3.0.2...v3.0.3)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  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-07-17 11:45:20 +01:00
dependabot[bot]
cfa44eff3c
Build(deps-dev): Bump json-schema from 4.3.0 to 4.3.1 (#27897)
Bumps [json-schema](https://github.com/voxpupuli/json-schema) from 4.3.0 to 4.3.1.
- [Changelog](https://github.com/voxpupuli/json-schema/blob/master/CHANGELOG.md)
- [Commits](https://github.com/voxpupuli/json-schema/compare/v4.3.0...v4.3.1)

---
updated-dependencies:
- dependency-name: json-schema
  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-07-17 11:44:13 +01:00
dependabot[bot]
6c9510baad
Build(deps): Bump rexml from 3.3.1 to 3.3.2 (#27945)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: rexml
  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-07-17 11:42:45 +01:00
dependabot[bot]
2c1719a396
Build(deps): Bump terser from 5.31.2 to 5.31.3 (#27944)
Bumps [terser](https://github.com/terser/terser) from 5.31.2 to 5.31.3.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.31.2...v5.31.3)

---
updated-dependencies:
- dependency-name: terser
  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-07-17 11:42:10 +01:00
dependabot[bot]
edcd686597
Build(deps): Bump the babel group across 1 directory with 2 updates (#27943)
Bumps the babel group with 2 updates in the / directory: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.24.7 to 7.24.9
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.9/packages/babel-core)

Updates `@babel/standalone` from 7.24.7 to 7.24.10
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.10/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 11:41:52 +01:00
chapoi
2ca06ba236
DEV: form-kit
This PR introduces FormKit, a component-based form library designed to simplify form creation and management. This library provides a single `Form` component, various field components, controls, validation mechanisms, and customization options. Additionally, it includes helpers to facilitate testing and writing specifications for forms.

1. **Form Component**:
   - The main component that encapsulates form logic and structure.
   - Yields various utilities like `Field`, `Submit`, `Alert`, etc.

   **Example Usage**:
   ```gjs
   import Form from "discourse/form";

   <template>
     <Form as |form|>
       <form.Field
         @name="username"
         @title="Username"
         @validation="required"
         as |field|
       >
         <field.Input />
       </form.Field>

       <form.Field @name="age" @title="Age" as |field|>
         <field.Input @type="number" />
       </form.Field>

       <form.Submit />
     </Form>
   </template>
   ```

2. **Validation**:
   - Built-in validation rules such as `required`, `number`, `length`, and `url`.
   - Custom validation callbacks for more complex validation logic.

   **Example Usage**:
   ```javascript
   validateUsername(name, value, data, { addError }) {
     if (data.bar / 2 === value) {
       addError(name, "That's not how maths work.");
     }
   }
   ```

   ```hbs
   <form.Field @name="username" @validate={{this.validateUsername}} />
   ```

3. **Customization**:
   - Plugin outlets for extending form functionality.
   - Styling capabilities through propagated attributes.
   - Custom controls with properties provided by `form` and `field`.

   **Example Usage**:
   ```hbs
   <Form class="my-form" as |form|>
     <form.Field class="my-field" as |field|>
       <MyCustomControl id={{field.id}} @onChange={{field.set}} />
     </form.Field>
   </Form>
   ```

4. **Helpers for Testing**:
   - Test assertions for form and field validation.

   **Example usage**:
   ```javascript
   assert.form().hasErrors("the form shows errors");
   assert.form().field("foo").hasValue("bar", "user has set the value");
   ```

   - Helper for interacting with he form

   **Example usage**:
   ```javascript
   await formKit().field("foo").fillIn("bar");
   ```

5. **Page Object for System Specs**:
   - Page objects for interacting with forms in system specs.
   - Methods for submitting forms, checking alerts, and interacting with fields.

   **Example Usage**:
   ```ruby
   form = PageObjects::Components::FormKit.new(".my-form")
   form.submit
   expect(form).to have_an_alert("message")
   ```

   **Field Interactions**:
   ```ruby
   field = form.field("foo")
   expect(field).to have_value("bar")
   field.fill_in("bar")
   ```


6. **Collections handling**:
   - A specific component to handle array of objects

   **Example Usage**:
   ```gjs
    <Form @data={{hash foo=(array (hash bar=1) (hash bar=2))}} as |form|>
      <form.Collection @name="foo" as |collection|>
        <collection.Field @name="bar" @title="Bar" as |field|>
          <field.Input />
        </collection.Field>
      </form.Collection>
    </Form>
   ```
2024-07-17 11:59:35 +02:00
Robert
bae492efee
FEATURE: Add Ranked Choice Voting
using Instant Run-off Voting algorithm to Poll Plugin (Part 2 add Ranked Choice)

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2024-07-17 11:49:14 +02:00
Kris
ef27ee9fb6
UX: allow category names in select-kit to truncate if needed (#27941) 2024-07-16 17:52:17 -04:00
Kris
9a2f94f648
UX: spacing fix for related topics on mobile (#27940) 2024-07-16 17:51:55 -04:00
chapoi
754ccebe80
UX: fix overflowing quote bar (#27938) 2024-07-16 21:17:44 +02:00
Kris
fa3709041b
UX: fix padding on suggested/related toggle in PMs (#27939) 2024-07-16 14:46:15 -04:00
Sérgio Saquetim
7d729603b4
DEV: Improve args deprecation on plugin outlets (#27885) 2024-07-16 14:29:39 -03:00
Kris
d4ade75583
A11Y: remove heading tags from usercards (#27926) 2024-07-16 12:32:53 -04:00
Kris
0d4492c7b7
A11Y: Close header dropdown menus on focusout (#27901)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-07-16 09:11:26 -04:00
Joffrey JAFFEUX
c74fa300e7
FEATURE: allows browse page in chat drawer (#27919)
This commit ensures the browse page can be loaded in the drawer and doesn’t force full page mode.

Other notable changes of this commit:
- be consistent about wrapping each full page route with "c-routes.--route-name" and each drawer container with "c-drawer-routes.--route-name"
- move browse channels into its own component, it was before in the template of the channels browse
2024-07-16 12:34:37 +02:00
锦心
600f2854c7
FEATURE: Log topic slow mode changes (#27934)
Previously, we did not log any topic slow mode changes. This allowed
some malicious (or just careless) TL4 users to delete slow modes created
by moderators at will. Administrators could not see who changed the slow
mode unless they had SQL knowledge and used Data Explorer.

This commit enables logging who turns slow mode on, off, or changes it.

Related meta topic: https://meta.discourse.org/t/why-is-there-no-record-of-who-added-or-removed-slow-mode/316354
2024-07-16 17:08:09 +08:00
锦心
3bc459e178
FIX: Add plural definitions for Hungarian (#27933)
Hungarian actually has a plural form (See: https://meta.discourse.org/t/issue-with-pluralized-count-translation-override/316019/8)

In a past commit we introduced an external JS library to describe the
plural form of the language. (301713ef96)
But this JS library actually has a slightly different pluralization
definition than what we use in the backend (plurals.rb). ruby-i18n
incorrectly assumes that Hungarian does not have plural forms.
This resulted in singular text being used on the front end for
Hungarian, but admins were unable to find and edit the singular text in
customization.

This commit adds a singular definition for Hungarian to the backend,
compatible with the  "make-plural/cardinals" library, thus fixing the
above issue.
2024-07-16 15:17:18 +08:00
Martin Brennan
0783bfbbfe
FIX: Use login SMTP auth for office365 in group mailer (#27931)
Followup 7b627dc14b

In this other commit, I changed the email settings validator
to always use the `login` authentication method for
office365 and outlook, but I didn't change the actual
group SMTP mailer to do this.

This commit fixes that issue and does some minor refactoring.
2024-07-16 16:21:14 +10:00
Alan Guo Xiang Tan
25778d9861
FIX: Return 400 response codes when topic list query params are invalid (#27930)
This commit updates `TopicQuery.validators` to cover all of the
public options listed in `TopicQuery.public_valid_options`. This is done
to fix the app returning a 500 response code when an invalid value, such
as a hash, is passed as a query param when accessing the various topic
list routes.
2024-07-16 10:30:04 +08:00
Martin Brennan
00608a19c6
FIX: Show the SMTP authentication error for group UI (#27914)
Originally in 964da21817
we hid the SMTPAuthenticationError message except in
very specific cases. However this message often contains
helpful information from the mail provider, for example
here is a response from Office365:

> 535 5.7.139 Authentication unsuccessful, user is locked by your
organization's security defaults policy. Contact your administrator.

So, we will show the error message in the modal UI instead
of supressing it with a generic message to be more helpful.
2024-07-16 09:14:17 +10:00
Kris
576f880190
UX: fix name & username width on profile summary (#27925) 2024-07-15 12:49:06 -04:00
David Taylor
0b7099f34e
FIX: 2fa check error for anon users (#27924) 2024-07-15 14:19:04 +01:00
Nat
d32675ace2
Bump version to v3.3.0.beta5-dev 2024-07-15 20:30:15 +08:00
Nat
c9e24eca39
Bump version to v3.3.0.beta4 2024-07-15 20:30:14 +08:00
Vinoth Kannan
7b53e610c1
SECURITY: limit the number of characters in watched word replacements.
The watch words controller creation function, create_or_update_word(), doesn’t validate the size of the replacement parameter, unlike the word parameter, when creating a replace watched word. So anyone with moderator privileges can create watched words with almost unlimited characters.
2024-07-15 19:25:17 +08:00
Régis Hanol
6ebd0c5aec
DEV: skip flaky spec in CI (#27918) 2024-07-15 12:00:43 +02:00
Krzysztof Kotlarek
25485bddee
FIX: refresh flags cache after update (#27909)
`after_commit` should be used before refreshing processes to be sure that the database is already updated.

Also, MessageBus is used instead of events as MessageBus works correctly with many processes;
2024-07-15 19:45:25 +10:00
锦心
4d64205eef
DEV: Add slug parameter to hashtag-decorator (#27917)
In order to facilitate discourse-tag-icons and discourse-category-icons to render icons for post content, we need to provide an additional slug parameter here
2024-07-15 17:22:02 +08:00
Ted Johansson
cf5174da69
FIX: Fix broken out of date themes admin notice (#27916)
The OutOfDateThemes problem check is using an old method of setting the message, by overriding #message. It should instead use #translation_keys. (By chance I noticed the same thing applies to UnreachableThemes.
2024-07-15 16:12:44 +08:00
Natalie Tay
9bed472a77
DEV: Temporarily skip failing test on CI (#27915) 2024-07-15 15:23:01 +08:00
Kelv
1d277ba96e
DEV: add discourse prefix to deprecation ids to differentiate from ember deprecations (#27910) 2024-07-15 15:10:04 +08:00
Alan Guo Xiang Tan
a3d319ac2f
FIX: StaticController#enter should not redirect to invalid paths (#27913)
This commit updates `StaticController#enter` to not redirect to invalid
paths when the `redirect` param is set. Instead it should redirect to `/` when the
`redirect` param is invalid.
2024-07-15 14:39:37 +08:00
Martin Brennan
5f4dc1042e
FIX: Bold admin sidebar headings (#27912)
We lost these by mistake in fed9055818,
this reinstates them.
2024-07-15 16:31:16 +10:00
Kelv
98cbfd598c
DEV: add deprecation ids for base-url, fa-icon and chat service (#27911) 2024-07-15 14:29:17 +08:00