Commit Graph

3411 Commits

Author SHA1 Message Date
David McClure
880da52bb6
DEV: improve copy for instant-runoff polls (#28104) 2024-07-27 22:08:41 -04:00
Jarek Radosz
f14cf4f8a9
DEV: Fix random typos (#28103)
July 2024 edition
2024-07-26 23:13:12 +02:00
David Battersby
6f2f34f786
DEV: fix chat message grace edit period flaky (#28095)
The message grace edit window (10 seconds) was too short after freezing time, possibly causing the test to fail occasionally if the record is not updated within 5 seconds.
2024-07-26 18:16:17 +04:00
Jarek Radosz
038e5deb2a
DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00
Joffrey JAFFEUX
7a7cc815be
DEV: removes legacy modal code (#28047) 2024-07-24 18:07:17 +02:00
Joffrey JAFFEUX
0fbce0aa85
DEV: adds a way to set a title/description to a radio (#28049)
Usage:

```
<Form as |form|>
  <form.Field @name="foo" @title="Foo" as |field|>
    <field.RadioGroup as |RadioGroup|>
      <RadioGroup.Radio @value="one" as |radio|>
        <radio.Title>One title</radio.Title>
        <radio.Description>One description</radio.Description>
      </RadioGroup.Radio>
    </field.RadioGroup>
  </form.Field>
</Form>
```
2024-07-24 14:25:34 +02:00
chapoi
5b693c61af
UX: change sidebar background to secondary (#28043) 2024-07-23 15:56:21 +02:00
Discourse Translator Bot
5b5d5b4b4a
Update translations (#28041) 2024-07-23 15:23:42 +02:00
Joffrey JAFFEUX
8b18fd1556
FIX: do not reload identical route in drawer (#27992)
This is a performance optimisation to prevent the same route to keep reloading the same endpoint.

No tests as it's not changing behavior and is also quite complex to test efficiently.
2024-07-19 22:27:32 +02:00
Natalie Tay
278ae6e5fd
DEV: Try until success for clipboard copies (#27986) 2024-07-19 19:44:10 +08:00
David Taylor
94d4b187ef
UX: Show error when checkbox change fails (#27968)
e.g. due to a permissions/network issue
2024-07-18 13:22:10 +01:00
Joffrey JAFFEUX
1aa24f83bb
DEV: form-kit improvements (#27966)
- correctly support @title on fields
- correctly support @subtitle on fields
- improves error message when a field name is incorrect in assertions
2024-07-18 10:30:18 +02: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
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
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
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
Régis Hanol
6ebd0c5aec
DEV: skip flaky spec in CI (#27918) 2024-07-15 12:00:43 +02:00
Natalie Tay
9bed472a77
DEV: Temporarily skip failing test on CI (#27915) 2024-07-15 15:23:01 +08:00
Kelv
98cbfd598c
DEV: add deprecation ids for base-url, fa-icon and chat service (#27911) 2024-07-15 14:29:17 +08:00
David Battersby
f75dd1b43a
FIX: update order of chat message service steps (#27889)
A change made in #27875 added a new step to the create message service, however the step should have been placed before saving the message.
2024-07-12 11:56:07 +04:00
David Battersby
4a365bc4a2
FEATURE: prevent chat emails for messages created via SDK (#27875)
This change allows us to distinguish between regular user generated chat messages and those created via the Chat SDK.

A new created_by_sdk boolean column is added to the Chat Messages table. When this value is true, we will not include the message in the user summary email that is sent to users.
2024-07-12 10:57:14 +04:00
Joffrey JAFFEUX
897518e874
FIX: ensures chat panel can't have an invalid width (#27876)
Prior to this fix the following sequence would cause an overflow:

- open a thread
- expand thread panel to maximum width
- close panel
- reduce window width
- open thread again
- 💥

The fix is now ensuring that we never use or set a width which would cause the main panel + side panel to be larger than the chat container. We also removed the service as it was overkill for this case and it's easier to have all the implementation at one place.

This commit also uses JS animation api to set the width of the panel.

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2024-07-11 20:27:30 +02:00
Joffrey JAFFEUX
6547f78ff8
DEV: migrates reviewable-created-by to gjs (#27862) 2024-07-11 11:54:35 +02:00
Robert
d8d3d2184a
FIX: Poll: Show gear button only when there is more than one dropdown item (#27775)
During migration of Poll plugin from widget basis to glimmer, some functionality was inadvertently dropped:

- A single button should appear instead of the dropdown menu when there is only one valid "poll admin" action
- No button should appear when there are no valid "poll admin" actions for current user

This PR restores the original behaviour and adds test coverage (that didn't exist prior to migration, partly why it wasn't caught earlier)

relates to #27204

related meta topic:  https://meta.discourse.org/t/what-is-the-gear-button-under-the-poll-for/315477/2
2024-07-11 11:19:04 +08:00
Kris
c780e764d0
A11Y: usercard resizing for high zoom levels (#27846) 2024-07-10 14:51:56 -04:00
Régis Hanol
d2873d9775
DEV: wait a bit for chat message to persist (#27830)
Internal ref t/132745
2024-07-10 16:11:50 +02:00
Discourse Translator Bot
dd67375de7
Update translations (#27790) 2024-07-09 23:12:03 +02:00
Joffrey JAFFEUX
c080ac0094
FIX: show too long message error on client (#27794)
Prior to this fix we would show the message after a round trip to the server. If you had a too long message error, at this point your input would be empty and we would show an error in chat. It's important to have this server side safety net, but we can have a better UX by showing an error on the frontend before sending the message, that way you can correct your message before sending it and not lose it.
2024-07-09 18:34:35 +02:00
Kris
4ee64ad168
UX: fix card positioning, allow shrink-to-fit (#27774) 2024-07-08 17:30:43 -04:00
Jarek Radosz
619f132f57
DEV: Check for poll element presence (#27765)
Fixes a flaky test. `afterUpdate` from chart.js is not integrated with the runloop and component lifecycle, as a result we have no guarantee on when it will happen. The easiest change we can do for now is ensuring we actually have the DOM we expect to have, and if not, we exit early.


Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: merefield <merefield@gmail.com>
2024-07-08 13:58:35 +02:00
Alan Guo Xiang Tan
f9a5d149e1
DEV: Skip flaky polls acceptance test (#27757)
Example of flakiness: https://github.com/discourse/discourse/actions/runs/9831645793/job/27139325323
2024-07-08 09:11:38 +08:00
ScottMastro
21b62f7894
FIX: typo in poll "closed" (#27748)
Reference to string poll.results.close.title should be "closed" instead of "close"
2024-07-08 08:42:31 +08:00
Robert
f86a95d282
FIX: Allow safe html in poll options (#27741) 2024-07-07 15:08:00 +02:00
Robert
4f87f0d7ef
FIX: Poll: option text wrapping bevahiour styling improvement (#27738) 2024-07-05 15:27:40 +02:00
Régis Hanol
9db1620842
DEV: skip flaky system chat spec (#27737) 2024-07-05 15:27:07 +02:00
Robert
8b963986b3
FIX: Poll: critical display issue when results are only shown upon vote (#27732) 2024-07-05 10:55:14 +02:00
Alan Guo Xiang Tan
906da0f3d1
DEV: Skip flaky poll QUnit acceptance tests (#27728)
The skipped tests have become flaky after
e3b6be15b8, skip those tests for now while
we sort things out.
2024-07-05 10:59:51 +08:00
Robert
a30a861546
FIX: Poll: do not attempt to show voter list on private polls (#27714)
* FIX: avoid attempting to enrich results with undefined voters
2024-07-04 18:20:37 +02:00
chapoi
2db35149fd
UX: Chat mobile menu styling update (#27598) 2024-07-04 18:02:30 +02:00
Robert
e3b6be15b8
FEATURE: Add Instant Run-off Voting to Poll Plugin (Part 1: migrate existing plugin to Glimmer only) (#27204)
The "migration to Glimmer" has been broken out here from #27155 to make the review process less onerous and reduce change risk: 

* DEV: migrates most of the widget code to Glimmer in prep for IRV additions
* NB This already incorporates significant amounts of review and feedback from the prior PR.
* NB because there was significant additional feedback relating to older Poll code that I've improved with feedback, there are some additional changes here that are general improvements to the plugin and not specific to IRV nor Glimmer!
* There should be no trace of IRV code here.

Once this is finalised and merged we can continue to progress with #27155.
2024-07-04 13:34:48 +02:00
Loïc Guitaut
8d249457e8 DEV: Upgrade Rails to version 7.1
---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2024-07-04 10:58:21 +02:00
锦心
f3130bc6d9
FIX: Inline footnotes doesn’t work in the table at fullscreen (#27686)
* FIX: Inline footnotes doesn’t work in the table at fullscreen

meta topic: https://meta.discourse.org/t/inline-footnotes-doesnt-work-in-the-table-at-fullscreen/313445
2024-07-03 18:52:36 +08:00
Krzysztof Kotlarek
c3fadc7330
FEATURE: created edit and delete flags (#27484)
Allow admins to create edit and delete flags.
2024-07-03 08:45:37 +10:00
Keegan George
ea58140032
DEV: Remove summarization code (#27373) 2024-07-02 08:51:47 -07:00
Discourse Translator Bot
052550c6e0
Update translations (#27680) 2024-07-02 16:42:56 +02:00
Kris
9e8d8d37fa
UX: fix height of lazy youtube embeds (#27671) 2024-07-01 17:27:11 -04:00
Jan Cernik
6599b85a75
DEV: Block accidental serialization of entire AR models (#27668) 2024-07-01 17:08:48 -03:00
David Battersby
bee7312f46
FIX: show group based notifications in chat summary email (#27641)
Follow up to #27631 to account for group mentions in channels.

We only want to show mentions for groups that are currently mentionable and those that the current user belongs to.
2024-07-01 12:47:38 +04:00