Commit Graph

1250 Commits

Author SHA1 Message Date
Martin Brennan
c7860173c1
DEV: Clean up hashtag code (#25397)
* Delete dead code
* Split up hashtag-autocomplete into more logical modules
2024-01-29 09:48:56 +10:00
Joffrey JAFFEUX
68288a3bfc
FIX: allows to translate yesterday (#25446)
The value [Yesterday] was a fixed string which couldn't be translated. Also removes nextWeek/nextDay which make no sense for dates which are always supposed to be in the past.
2024-01-27 14:03:58 +08:00
Kris
6b185f8655
PERF: eliminate some slow CSS selectors (#25392) 2024-01-26 13:10:45 -05:00
chapoi
08b882097a
UX: chat > channel info: show member count on tab (#25439)
* UX: chat > channel info: show member count on tab
2024-01-26 12:10:56 +01:00
David Battersby
4f5843e819
DEV: remove chat footer thread count reference (#25436)
Removes an unused modifier from chat footer on mobile.
2024-01-26 14:00:10 +08:00
Ted Johansson
7e5d2a95ee
DEV: Convert min_trust_level_to_tag_topics to groups (#25273)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_level_to_tag_topics site setting to tag_topic_allowed_groups.
2024-01-26 13:25:03 +08:00
Joffrey JAFFEUX
7b173e883f
FEATURE: display last message on mobile (#25384)
Direct messages on mobile will now display the last message in the channels list.
2024-01-25 15:30:21 +01:00
Ted Johansson
57ea56ee05
DEV: Remove full group refreshes from tests (#25414)
We have all these calls to Group.refresh_automatic_groups! littered throughout the tests. Including tests that are seemingly unrelated to groups. This is because automatic group memberships aren't fabricated when making a vanilla user. There are two places where you'd want to use this:

You have fabricated a user that needs a certain trust level (which is now based on group membership.)
You need the system user to have a certain trust level.
In the first case, we can pass refresh_auto_groups: true to the fabricator instead. This is a more lightweight operation that only considers a single user, instead of all users in all groups.

The second case is no longer a thing after #25400.
2024-01-25 14:28:26 +08:00
Martin Brennan
57ededb770
DEV: Move admin sidebar out of initializer (#25396)
Having the admin sidebar code in an instance initializer is not
ideal because:

* It runs during app boot which may not even be necessary based on site settings
* It makes it hard for plugins to register additional links in time without resorting
to before/after initializer gymnastics

This PR moves the admin sidebar into a lib and creates the panel
in custom-sections.js, then the sections and links are loaded when
the main sidebar component is rendered, which leaves plugins enough
time to add additional links in an initializer.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-01-25 10:45:14 +10:00
Joffrey JAFFEUX
a3c1fff65a
DEV: removes flakey spec (#25405)
scroll position is not reliable enough
2024-01-24 18:56:50 +01:00
Jarek Radosz
57c4b6bd50
DEV: Update js linting setup (#25365) 2024-01-24 15:30:03 +01:00
David Battersby
85d74ec8bf
DEV: remove pseudo-class selector in chat channel page object (#25399)
The channels-list div is only rendered once now so the :first-child pseudo-class can be removed.
2024-01-24 12:24:40 +08:00
David Battersby
04d2ec45b4
DEV: remove user thread count route (#25385)
Removes a now redundant route for the user thread count.
2024-01-24 10:32:34 +08:00
Discourse Translator Bot
da2c0cd5c0
Update translations (#25386) 2024-01-23 18:29:34 +01:00
David Battersby
67244a2318
FIX: use site setting to show my threads chat footer tab (#25277)
Fixes an issue with delayed rendering of the My Threads tab in chat mobile footer.

Previously we made an ajax request to determine the number of threads a user had before rendering the tab, however it is much faster (and better UX) if we can rely on a site setting for this.

The new chat_threads_enabled site setting is set to true when the site has chat channels with threading enabled.
2024-01-23 19:14:46 +08:00
Joffrey JAFFEUX
eff485e4c0
FIX: renders channels-list wrapper only once (#25383)
This bug was causing broken layout when using the `header_dropdown` setting instead of `sidebar` as we were rendering `<div class="channels-list"></div>` two times.
2024-01-23 11:33:45 +01:00
David Taylor
9d3800adec
DEV: Implement text() for SidebarChatMyThreadsSection (#25371)
In normal use, this `text()` getter is never called. However, when running with the Ember inspector, it is eagerly evaluated and hits throws the "not implemented" error in the base class.
2024-01-23 10:16:47 +00:00
Martin Brennan
db70e7a842
FIX: Minor bookmark issues (#25358)
* FIX: Minor bookmark issues

* We were showing "missing %{name} value" when the name for the
  bookmark was undefined with title translations
* There was no way to see the bookmark details on hover in chat
  for a message where the bookmark icon was in the left gutter.
  We can show the title on the bookmark button in the chat message
  actions instead.

* Minor fix

* DEV: Test fix
2024-01-23 16:49:41 +10:00
Jarek Radosz
126ed84bbb
DEV: Remove unused chat css (#25363)
There are no longer any references to `chat-tabs`/`tabpanel` outside this scss files
2024-01-23 06:56:17 +08:00
Joffrey JAFFEUX
aee7197c43
FIX: correctly save scroll position in channel (#25345)
Due to an incorrect test the previous service was incorrectly implementing the map, and was most importantly not deleting the state when reaching bottom.
2024-01-19 22:49:14 +01:00
Joffrey JAFFEUX
ccb5fa1a5a
FIX: correctly exclude muted channels from thread unreads (#25339) 2024-01-19 22:05:41 +01:00
Joffrey JAFFEUX
a840c295d8
FIX: fixed a bug where keyboard on ios was broken (#25338)
It was broken on iOS PWA, when you had the keyboard open and would leave the app. When you came back the body was scrolled and it was looking buggy until you close/reopen keyboard.

This commit attempt to reposition the page correctly 200ms after the tab is visible again.
2024-01-19 17:07:59 +01:00
Joffrey JAFFEUX
3bd88d7586
FIX: ensures active message is cleared on threads opening (#25337)
No test as this is a very specific edge case, already hard to repro manually.
2024-01-19 16:34:24 +01:00
Joffrey JAFFEUX
9365d8b544
FEATURE: save/retrieve scroll position in chat channel (#25336)
Note this is only saved on each tab session.
2024-01-19 16:34:11 +01:00
Joffrey JAFFEUX
2014f1a0b7
FEATURE: implements dates separators for threads (#25335)
This commit creates a shared implementation of the dates computation and moves all the logic (new messages since last visit and dates separator into one single component <ChatMessageSeparator />).

The frontend tests have been removed and only a single system spec has been added for threads as everything is sharing the same implementation and the existing channel specs should catch any regression.
2024-01-19 16:21:48 +01:00
Selase Krakani
d5d0bab19d
DEV: Promote historic post_deploy migrations (#25334)
This commit promotes all post_deploy migrations which existed in Discourse v3.1.0 (timestamp <= 20230405121454)
2024-01-19 14:47:42 +00:00
Jan Cernik
f4e51e0789
FEATURE: Allow users to DM groups in chat (#25189)
Allows users to create DMs by selecting groups as a target. It also allows adding user groups to an existing chat

- When creating the channel, it expands the user group and adds all its members with chat enabled to the channel.
- After creation, there's no difference between adding a group or adding its members individually.
- Users can add multiple groups and users simultaneously.
- There are UI validations; the member count preview updates according to the member count of added groups, and it does not allow users to add more members than SiteSetting.chat_max_direct_message_users."
2024-01-19 11:09:47 -03:00
Andrei Prigorshnev
610d5b45c7
FIX: errors when loading My Threads and Channel Threads (#25310)
This PR fixes the problems described below. We also need tests for this, 
they'll be in a follow-up. When there is a group mention inside a chat 
thread, the next problems are happening.

1. When trying to look at _My Threads_ the list of threads is failing to load 
and there are errors on the console:

Server Error in the current_user_threads_controller:

Message
ActiveRecord::AssociationNotFoundError (Association named 'user' was not 
found on Chat::GroupMention; perhaps you misspelled it?)

app/controllers/application_controller.rb:423:in `block in with_resolved_locale'
app/controllers/application_controller.rb:423:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/missing_avatars.rb:22:in `call'
lib/middleware/turbo_dev.rb:31:in `call'
Backtrace
activerecord (7.0.8) lib/active_record/associations.rb:302:in `association'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:79:in `block in grouped_records'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:77:in `each'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:77:in `grouped_records'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:114:in `loaders'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:71:in `runnable_loaders'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `each'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `flat_map'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `call'
activerecord (7.0.8) lib/active_record/associations/preloader.rb:118:in `call'
activerecord (7.0.8) lib/active_record/relation.rb:830:in `block in preload_associations'
activerecord (7.0.8) lib/active_record/relation.rb:829:in `each'
activerecord (7.0.8) lib/active_record/relation.rb:829:in `preload_associations'
activerecord (7.0.8) lib/active_record/relation.rb:918:in `block in exec_queries'
activerecord (7.0.8) lib/active_record/relation.rb:962:in `skip_query_cache_if_necessary'
activerecord (7.0.8) lib/active_record/relation.rb:908:in `exec_queries'
activerecord (7.0.8) lib/active_record/relation.rb:695:in `load'
activerecord (7.0.8) lib/active_record/relation.rb:250:in `records'
activerecord (7.0.8) lib/active_record/relation.rb:783:in `blank?'
plugins/chat/app/services/service/base.rb:143:in `call'
plugins/chat/app/services/service/base.rb:368:in `block in run!'
plugins/chat/app/services/service/base.rb:368:in `each'
plugins/chat/app/services/service/base.rb:368:in `run!'
plugins/chat/app/services/service/base.rb:361:in `run'
<internal:kernel>:90:in `tap'
plugins/chat/app/services/service/base.rb:229:in `call'
plugins/chat/app/helpers/chat/with_service_helper.rb:22:in `run_service'
plugins/chat/lib/service_runner.rb:121:in `call'
plugins/chat/lib/service_runner.rb:115:in `call'
plugins/chat/app/helpers/chat/with_service_helper.rb:18:in `with_service'
plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb:5:in `index'
actionpack (7.0.8) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.8) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.8) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.8) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:423:in `block in with_resolved_locale'
i18n (1.14.1) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:423:in `with_resolved_locale'
activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.8) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.8) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/rescue.rb:23:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.8) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.8) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.8) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.8) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.8) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.8) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.3.0) lib/mini_profiler/profiling_methods.rb:115:in `block in profile_method' 
actionpack (7.0.8) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.8) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:852:in `call'
railties (7.0.8) lib/rails/engine.rb:530:in `call'
railties (7.0.8) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.8) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.0.8) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (7.0.8) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.8) lib/rack/head.rb:12:in `call'
actionpack (7.0.8) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/cookies.rb:704:in `call'
activerecord (7.0.8) lib/active_record/migration.rb:638:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
logster (2.14.0) lib/logster/middleware/reporter.rb:40:in `call'
railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.8) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
lib/middleware/missing_avatars.rb:22:in `call'
lib/middleware/turbo_dev.rb:31:in `call'
rack-mini-profiler (3.3.0) lib/mini_profiler.rb:334:in `call'
message_bus (4.3.8) lib/message_bus/rack/middleware.rb:60:in `call'
railties (7.0.8) lib/rails/engine.rb:530:in `call'
railties (7.0.8) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.8) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.8) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.8) lib/rack/urlmap.rb:58:in `each'
rack (2.2.8) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
bin/unicorn:93:in `load'
bin/unicorn:93:in `block in <main>'
bin/unicorn:92:in `fork'
bin/unicorn:92:in `<main>'

</details>

2. When looking at _channel threads_, threads are getting rendered successfully, 
but there are still errors on the console. The server error is similar to the first case, 
but it's in the `channel_threads_controller`.

This regression was introduced in 62f423da15.

The idea of the fix is that we only need to load user_mentions in those controllers 
anyway (we send them to the client in order to be able to show user status on mentions).
2024-01-18 17:35:32 +04:00
David Battersby
6fa836d781
FIX: prevent popup when thread count request fails (#25308)
On the rare occasions that an ajax request for thread count fails, we should fail silently without alerting the user.
2024-01-18 16:28:23 +08:00
Andrei Prigorshnev
20c5f7aef8
PERF: Avoid loading the whole record when we only need id (#25301) 2024-01-18 08:50:26 +08:00
Andrei Prigorshnev
62f423da15
DEV: Redesign chat mentions (#24752)
At the moment, when someone is mentioning a group, or using here or 
all mention, we create a chat_mention record per user. What we want 
instead is to have special kinds of mentions, so we can create only one 
chat_mention record in such cases. This PR implements that.

Note, that such mentions will still have N related notifications, one 
notification per a user. We don't expect we'll have performance 
problems on the notifications side, but if at some point we do, we 
should be able to solve them on the side of notifications 
(notifications are handled in jobs, also some little delays with 
the notifications are acceptable, so we can make sure notifications 
are properly queued, and that processing of every notification is 
fast enough to make delays small enough).

The preparation work for this PR was done in fbd24fa, where we make 
it possible for one mention to have several related notifications.

A pretty tricky part of this PR is schema and data migration, I've explained 
related details inline on the migration files.
2024-01-17 15:24:01 +04:00
David Battersby
6876c52857
FIX: set channels tab as default on mobile chat footer (#25296)
This change moves the "Channels" tab to first position in the chat footer nav, and loads it as the default page when opening chat for the first time on mobile.
2024-01-17 17:12:55 +08:00
David Battersby
c91bd3ca07
UX: hide draft post notice on mobile chat (#25297) 2024-01-17 16:45:25 +08:00
Discourse Translator Bot
50f8a51923
Update translations (#25278) 2024-01-16 14:54:32 +01:00
Joffrey JAFFEUX
a8330222f9
FIX: correctly support safe-area-inset-bottom in footer (#25276) 2024-01-16 11:12:36 +01:00
David Battersby
4512e5652f
FEATURE: Mobile Chat Footer Redesign (#25161)
This update adds three tabs to the bottom of the chat overlay to make it easier for users to navigate chat on mobile.

As a result of this change:

- Direct Messages are now shown separately from public channels on mobile
- My Threads has now moved from the channel list to it's own tab on mobile
- My Threads can still be accessed on desktop via the sidebar and within the drawer channel list
- Chat back button has been updated to navigate to the correct tab (for both channels and threads)

Some special cases:

- If DMs are not used then the tab is not rendered
- If the user has no threads then the tab is not rendered
- If both the tabs for DMs and Threads aren't available then the whole footer will not be rendered
- Chat footer is only shown on the listing pages (DMs, Channels, My Threads)

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-01-16 14:29:33 +08:00
Penar Musaraj
f2cf5434f3
Revert "DEV: Convert min_trust_level_to_tag_topics to groups (#25258)" (#25262)
This reverts commit c7e3d27624 due to
test failures. This is temporary.
2024-01-15 11:33:47 -05:00
Ted Johansson
c7e3d27624
DEV: Convert min_trust_level_to_tag_topics to groups (#25258)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_level_to_tag_topics site setting to tag_topic_allowed_groups.
2024-01-15 20:59:08 +08:00
chapoi
60a4d09f1a
UX: Chat composer dropdown styling mobile (#25244) 2024-01-15 09:59:24 +01:00
Kris
731699a7cf
UX: adjust onebox styles for chat, title line-height (#25249) 2024-01-12 18:14:26 -05:00
Kris
92708f2ff5
DEV: remove :has selector from chat settings (#25248) 2024-01-12 18:04:27 -05:00
chapoi
190a8db55d
UX: remove lock icon positioning (#25241) 2024-01-12 15:53:57 +01:00
chapoi
b063d92ad1
UX: chat header size and alignments (#25239)
This commit:

- increased the size of chat-header-offset from 46px to 56px on mobile
- tweaked navbar padding
- Increased the gap between back button and title; this means no more perfect alignment, but I think that's perfectly fine and a fair trade off for an easier click target for the back button without fear of hitting the title
2024-01-12 14:27:44 +01:00
chapoi
bad14899e6
UX: change chat back button to btn-transparent (#25184) 2024-01-12 13:11:25 +01:00
Jarek Radosz
3a0bf97401
DEV: Minor cleanup of navbar components (#25222)
Convert components to template-only where applicable.
2024-01-11 19:20:27 +01:00
Jarek Radosz
6d9fcf8f76
DEV: Don't apply this-fallback to strict-mode components (#25216)
fixes the issue with imported components references in plugin gjs files
2024-01-11 11:35:00 +01:00
Penar Musaraj
26747540d2
FIX: Chat summary email link in subfolder setups (#25188)
This regressed in 2791e75072. That commit
fixed subfolder URLs in general, but the `full_url` was adding the
subfolder prefix a second time, thus breaking this URL in emails.
2024-01-10 11:52:57 -05:00
Discourse Translator Bot
2e0ec679c5
Update translations (#25185) 2024-01-09 15:09:36 +01:00
chapoi
d4ce503460
UX: add max width for c-navbar on mobile to prevent horizontal scroll (#25182) 2024-01-09 13:18:05 +01:00
Jarek Radosz
0d38b4d0a9
UX: Add title attr to thread titles (#25178)
…so it's possible to read them when they're inevitably trunacted
2024-01-09 01:57:36 +01:00