Commit Graph

1769 Commits

Author SHA1 Message Date
Joffrey JAFFEUX fca6805aca
UX: removes silence from chat message actions (#19282) 2022-12-01 15:32:22 +01:00
chapoi b83d9fa802
UX: chat index refactor (#19264)
* Refactor: split out chat index files

* Refactor: is-online offset
2022-12-01 14:56:04 +01:00
Joffrey JAFFEUX 630bde1ba2
PERF: do not cancel debounce and prevents popper on scroll (#19280)
This commit also replaces deprecated `mousewheel` by `wheel` event listener
2022-12-01 14:33:46 +01:00
David Taylor 07fb7fc54d
DEV: Colocate all chat component templates (#19266) 2022-11-30 17:55:07 +00:00
Jarek Radosz 49e0fc04f7
Revert "DEV: Clean up all message bus subscriptions (#18675)" (#19267)
This reverts commit b0839ccf27.
2022-11-30 16:29:10 +00:00
David Taylor 2b53c2cfca
DEV: Enable `@cached` decorator for themes and plugins (#19261)
`ember-cached-decorator-polyfill` uses a Babel transformation to apply this polyfill in core. Adding that Babel transformation to themes and plugins will be complex, so we use this to patch it at runtime. This can be removed once `@glimmer/tracking` is updated to a version
with native `@cached` support.
2022-11-30 15:53:54 +00:00
Jarek Radosz b0839ccf27
DEV: Clean up all message bus subscriptions (#18675)
1. "What Goes Up Must Come Down" – if you subscribe to message bus, make sure you also unsubscribe
2. When you unsubscribe - remove only your subscription, not **all** subscriptions on given channel
2022-11-30 16:49:51 +01:00
David Taylor 105f500693
FIX: Show chat channel info on reviewable items (#19260)
`reviewable.chat_channel` is a plain javascript object from the server's JSON response. We need to turn it into a true `ChatChannel` object before passing to `<ChatChannelTitle>`

This commit also converts `<ReviewableChatMessage>` to a Glimmer component
2022-11-30 14:08:30 +00:00
Discourse Translator Bot cf347811c6
Update translations (#19238) 2022-11-29 15:36:51 +01:00
David Taylor c139767055
DEV: Remove `Ember.TEMPLATES` and centralize template resolution rules (#19220)
In the past, the result of template compilation would be stored directly in `Ember.TEMPLATES`. Following the move to more modern ember-cli-based compilation, templates are now compiled to es6 modules. To handle forward/backwards compatibility during these changes we had logic in `discourse-boot` which would extract templates from the es6 modules and store them into the legacy-style `Ember.TEMPLATES` object.

This commit removes that shim, and updates our resolver to fetch templates directly from es6 modules. This is closer to how 'vanilla' Ember handles template resolution. We still have a lot of discourse-specific logic, but now it is centralised in one location and should be easier to understand and normalize in future.

This commit should not introduce any behaviour change.
2022-11-29 10:24:35 +00:00
Joffrey JAFFEUX f7c29d959b
FIX: do not apply hover state to non capable devices (#19228) 2022-11-28 21:33:44 +01:00
Joffrey JAFFEUX 0291e1bf45
DEV: skip breaking tests (#19226) 2022-11-28 20:33:49 +01:00
chapoi bf9b346b76
UX: chat index UX fixes (#19227) 2022-11-28 20:33:39 +01:00
Joffrey JAFFEUX a3abbe07db
FIX: ensures date/time don't linebreak (#19225) 2022-11-28 19:43:36 +01:00
Keegan George 7a8e018965
UX: reworks channel index (drawer and mobile) (#18892)
- Multiple style improvements
- adds last sent message date to the view

Co-authored-by: chapoi <charlie@discourse.org>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2022-11-28 18:38:05 +01:00
Roman Rizzi 07a9163ea8
FEATURE: Deleting a user with their posts also deletes chat messages. (#19194)
This commit introduce a new API for registering callbacks, which we'll execute when a user gets destroyed, and the `delete_posts` opt is true. The chat plugin registers one callback and queues a job to destroy every message from that user in batches.
2022-11-28 13:32:57 -03:00
Roman Rizzi 6d9e950cac
FIX: Unsilence users on chat message flag disagree. (#19198)
* FIX: Unsilence users on chat message flag disagree.

We have an auto silence rule in place for chat message flags, so we need to unsilence users if the flag gets rejected.

Additionally, it also fixes the `disagree_and_restore` action, which wasn't recovering a deleted message.

* Update plugins/chat/spec/models/reviewable_chat_message_spec.rb

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2022-11-28 11:11:35 -03:00
Joffrey JAFFEUX 0cb6d8c8fc
FIX: prevents audio to play when appended (#19199) 2022-11-28 09:22:13 +01:00
Martin Brennan 3de765c895
SECURITY: Limit chat message char length (#19207)
Only allow maximum of 6000 characters for chat messages when they
are created or edited. A hidden setting can control this limit,
6000 is the default.

There is also a migration here to truncate any existing messages to
6000 characters if the message is already over that and if the
chat_messages table exists. We also set cooked_version to NULL
for those messages so we can identify them for rebake.
2022-11-28 10:48:30 +10:00
Joffrey JAFFEUX b032115506
DEV: removes select-kit deprecation (#19200) 2022-11-26 15:17:43 +01:00
Joffrey JAFFEUX 637fb9831b
FIX: ensures chat sidebar is present when core sidebar is disabled (#19197) 2022-11-25 19:28:10 +01:00
Joffrey JAFFEUX 34f4d51238
FIX: prevents drawer error when resizing core composer (#19195)
The drawer is registering events which are expecting the drawer to always be present which was not the case anymore. A previous refactor also changed this component to be tagless.
2022-11-25 18:33:54 +01:00
Joffrey JAFFEUX 9ade68233c
UX: alters chat icon behavior on drawer and mobile (#19192)
Refines the behavior of clicking the chat icon in mobile and when in drawer mode as follows: If chat is open, clicking the icon takes you to the index.
2022-11-25 15:12:32 +01:00
Joffrey JAFFEUX 84c1cc70d6
REFACTOR: naming and state refactor (#19187)
- better handling of drawer state using chat state manager
- removes various float and topic occurrences to use drawer
- ensures user can chat before doing a lot of chat setup
- fixes a bug which was creating presence errors in tests
- removes dead code
2022-11-25 14:15:38 +01:00
Martin Brennan cad2fe6089
FIX: Push category hashtag slug match to top (#19174)
When searching for categories it is possible for
a child category to have a slug that matches the term
exactly, but will not be found by .lookup since we
don't return these categories unless the ref matches
parent:child.

Introduces a search_sort method to each hashtag data
source so they can provide their custom sort logic of
results, in category's case putting all matching slugs
to the top regardless of parent/child relationship
then sorting by text.
2022-11-25 15:28:49 +10:00
Martin Brennan a34838d671
FIX: Minor hashtag autocomplete fixes (#19173)
* Do not search category name when searching channels to avoid
  confusing results
* Overflow text in autocomplete menu with ... if it is too long
* Make autocomplete menu less height
2022-11-24 15:45:13 +11:00
Martin Brennan 274b21663e
FIX: Experimental hashtag search result matching and limit fixes (#19144)
This changes the hashtag search to first do a lookup to find
results where the slug exactly matches the
search term. Now when we search for hashtags, the
exact matches will be found first and put at the top of
the results.

`ChatChannelFetcher` has also been modified here to allow
for more options for performance -- we do not need to
query DM channels for secured IDs when looking up or searching
channels for hashtags, since they should never show in
results there (they have no slugs). Nor do we need to include
the channel archive records.

Also changes the limit of hashtag results to 20 by default
with a hidden site setting, and makes it so the scroll for the
results is overflowed.
2022-11-24 10:07:59 +10:00
Kris 6b7bdc991d
UX: improve mention styling, simplify (#19169)
* UX: improve mention styling, simplify

* revert default
2022-11-24 09:35:57 +11:00
Roman Rizzi 023333a8e5
DEV: Make summary subject logic more explicit (#19167) 2022-11-23 14:29:41 -03:00
Martin Brennan 1dadf4381f
DEV: Fix chat_allowed_groups migration (#19163)
Follow-up to 0c1e5a76ee
2022-11-23 15:28:12 +10:00
Martin Brennan c9ab270abd
FEATURE: Add descriptions on hover for hashtag search results (#19162)
Adds the description as a title="" attribute on the hashtag
autocomplete search items for tags, categories, and channels.
These descriptions can be seen by the user since they are
able to see the results that are returned by the search via
Guardian checks.
2022-11-23 14:59:00 +10:00
Martin Brennan 0c1e5a76ee
FIX: Set chat_allowed_groups based on chat_enabled setting (#19146)
Sets the chat_allowed_groups to staff (the old default) in the database for
people who already have chat enabled if they did not already change it.
        
The assumption is that most people who this applies to will be
upgrading from a version that has neither of these two PRs (
the other PR being #19116) to a version that has both of these PRs.

So, for existing site with chat enabled who haven’t set groups, we
want to persist the value which is more likely to match what that are
upgrading from (staff).

People who don’t yet have chat enabled should get the new value (TL1
and staff) when they do enable it.

Follow up to 05b740036e
2022-11-23 14:12:54 +10:00
Kris d6ddb337c8
UX: use solid envelope icon for consistency (#19157) 2022-11-23 08:46:35 +08:00
Rafael dos Santos Silva c18453e38c
FEATURE: Allow staff to flag chat messages (#18919) 2022-11-22 12:14:15 -03:00
Discourse Translator Bot 2eee6fb644
Update translations (#19150) 2022-11-22 15:01:19 +01:00
Loïc Guitaut 01392ab90c FIX: Delete associated channel upon category deletion
Currently when a category is deleted, if it has an associated chat
channel, the latter won’t be deleted automatically.

The fix is quite simple as we were simply missing a `dependent:
:destroy` option on the existing relation.
2022-11-22 10:04:29 +01:00
Joffrey JAFFEUX e9863b145c
UX: ensures browse view input is focused on page load (#19137)
No test as I don't think it's worth the complexity of a test.
2022-11-22 08:57:17 +01:00
Joffrey JAFFEUX d127d2acdf
FIX: allows to change sound when no sound was ever set (#19136)
It fixes a bug which was only allowing users with a sound to change it. Users with `none` could not change it again after a full page reset.
2022-11-22 08:57:06 +01:00
Kris bc61629d0f
A11Y: improved titles for chat in the sidebar (#19134) 2022-11-22 09:24:39 +08:00
Joffrey JAFFEUX 5573257158
FIX: enable_auto_join_users was used in create channel (#19128)
7e39a21de1
broke the explanation of the check box on `create-channel` view.

Actions:
- uses core yes_value/no_value
- re-add the correct translation for `enable_auto_join_users`
- removes `disable_auto_join_users` which is not used anymore
2022-11-21 14:28:11 +01:00
Joffrey JAFFEUX 3f24a5e9e2
FIX: better chat-message-actions position (#19111)
- prevents menu to hide underlying text
- prevents `chat-message-actions` to close when hovering dropdown of 3
dots button as mouse would hover an other message due to the small space
between `chat-message-actions` menu and the dropdown of the 3 dots
button

<!-- 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. -->
2022-11-21 09:10:52 +01:00
Martin Brennan 05b740036e
FEATURE: Add TL1 to chat_allowed_groups by default (#19116)
By doing this, we will:

* Have an open, but safe default People reach `@trust_level_1` pretty
quickly, but `@trust_level_0` is still excluded by default, to limit new
accounts joining and immediately spamming or otherwise abusing channels.
* Make it easier to change the default By keeping `@staff` in the
default, we make it easy for admins to remove `@trust_level_1` and
optionally add additional groups to their liking.
2022-11-21 09:17:40 +10:00
Martin Brennan d3f02a1270
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.

**Serverside**

We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.

Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.

The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.

When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.

**Markdown**

The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.

This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.

**Chat Channels**

This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.

------

**Known Rough Edges**

- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 08:37:06 +10:00
Kris 8dff9a7fd2
UX: padding adjustment for empty channel message (#19105) 2022-11-18 14:25:22 -05:00
Joffrey JAFFEUX 26fadbdece
FIX: hides user card button when current user can't DM (#19093) 2022-11-17 23:44:05 +01:00
Loïc Guitaut 3fd0423b1b FEATURE: Stop hiding “allow archiving channels” setting 2022-11-17 11:03:42 +01:00
Discourse Translator Bot 33f601c8ad
Update translations (#19033) 2022-11-16 11:39:47 +01:00
chapoi 7e39a21de1
UX: redesign of chat settings + add chat retention info (#19017)
* UX: redesign of chat settings
2022-11-16 11:10:42 +01:00
Joffrey JAFFEUX df7730d938
UX: improves arrow support in chat emoji picker (#19038) 2022-11-16 08:52:48 +01:00
chapoi 3277a858bf
UX: add channel header offset to browse page height (#19030) 2022-11-15 11:35:40 +01:00