Commit Graph

11794 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
d68983e060
DEV: Use same Socket.getaddrinfo arguments as selenium-webdriver (#27301)
Follow up to c408b53689. We need better
debugging information
2024-06-03 13:11:40 +08:00
Martin Brennan
4b2bd4d682
FEATURE: Allow "move to inbox" and "move to archive" for private messages using new bulk topic dropdown (#27236)
This commit re-introduces the "Move to Inbox" and "Move to Archive"
bulk topic actions, which we had in the old modal but had not yet added
to the new "experimental" dropdown, which isn't really experimental at
this point.

Once this is merged we can remove the old modal and only
rely on the new dropdown.
2024-06-03 14:37:28 +10:00
Alan Guo Xiang Tan
c408b53689
DEV: puts debugging information when CI encounters resolution errors (#27300)
We have been seeing flaky socket resolution errors on CI and need more
debugging information to figure out why
2024-06-03 10:26:02 +08:00
Joffrey JAFFEUX
510c022131
FIX: ensures bulk-select is correctly working on mobile (#27290)
Prior to this fix we were opening a modal before closing the `DMenu` modal, given `DModal` expects only one modal at a time it was closing the latest modal and instantly closing the one we just opened.
2024-06-03 10:03:57 +10:00
Jan Cernik
96a686c8dc
DEV: Attempt to fix flaky spec (#27270) 2024-05-31 10:57:43 -03:00
Mark VanLandingham
8eec9da0b4
DEV: Plugin modifier application for About admins (#27261) 2024-05-30 10:44:53 -05:00
Sérgio Saquetim
766231b102
FIX: Prevent crash importing topics on a tagged embeddable host (#27254) 2024-05-30 12:04:36 -03:00
Alan Guo Xiang Tan
dc55b645b2
DEV: Allow site administrators to mark S3 uploads with a missing status (#27222)
This commit introduces the following changes which allows a site
administrator to mark `Upload` records with the `s3_file_missing`
verification status which will result in the `Upload` record being ignored when
`Discourse.store.list_missing_uploads` is ran on a site where S3 uploads
are enabled and `SiteSetting.enable_s3_inventory` is set to `true`.

1. Introduce `s3_file_missing` to `Upload.verification_statuses`
2. Introduce `Upload.mark_invalid_s3_uploads_as_missing` which updates
   `Upload#verification_status` of all `Upload` records from `invalid_etag` to `s3_file_missing`.
3. Introduce `rake uploads:mark_invalid_s3_uploads_as_missing` Rake task
   which allows a site administrator to change `Upload` records with
`invalid_etag` verification status to the `s3_file_missing`
verificaton_status.
4. Update `S3Inventory` to ignore `Upload` records with the
   `s3_file_missing` verification status.
2024-05-30 08:37:38 +08:00
Blake Erickson
f292e645b9
FEATURE: Show video thumbnail in composer (#27233)
When uploading a video, the composer will now show a thumbnail image in
the composer preview instead of just the video placeholder image.

If `enable_diffhtml_preview` is enabled the video will be rendered in
the composer preview and is playable.
2024-05-29 08:24:29 -06:00
Krzysztof Kotlarek
963b9fd157
FEATURE: admin can disable flags (#27171)
UI for admins to disable system flags.
2024-05-29 14:39:58 +10:00
Jan Cernik
76c56c8284
FIX: Bulk clear reminders when the reminder is expired (#27220) 2024-05-28 10:21:33 -03:00
Jan Cernik
30e963be03
DEV: Add spec for x.com onebox url matcher (#27214) 2024-05-28 09:04:20 -03:00
Martin Brennan
9c85ea5945
DEV: Remove old TODOs for message-id formats (#27196)
Introduced back in 2022 in
e3d495850d,
our new more specific message-id format for inbound and
outbound emails has now been in use for a very long time,
we can remove the support for the old formats:

`topic/:topic_id/:post_id.:random@:host`
`topic/:topic_id@:host`
`topic/:topic_id.:random@:host`
2024-05-28 13:57:09 +10:00
Alan Guo Xiang Tan
4d8eca91ef
Revert "DEV: Use 127.0.0.1 instead of localhost as Capybara's server host (#27215)" (#27218)
This reverts commit 998b50fdf4.

Ended up making system tests even more unstable
2024-05-28 11:32:22 +08:00
Martin Brennan
73c6bb2593
FIX: Admin sidebar disappeared on some routes for header dropdown (#27216)
When navigation_menu is set to header dropdown, we are
still forcing admin sidebar by checking if the user is an
admin route (c.f. 9bcbfbba43).

However in the initial commit the route check had the
false premise that all admin routes started with `admin.`;
there are others that don't. We need to force admin sidebar
on all routes starting with `admin` (no `.`).

c.f. https://meta.discourse.org/t/feedback-on-admin-sidebar-when-header-dropdown-navigation-selected/309490/3?u=martin
2024-05-28 11:47:54 +10:00
Alan Guo Xiang Tan
998b50fdf4
DEV: Use 127.0.0.1 instead of localhost as Capybara's server host (#27215)
We are seeing a weird resolution error on Github actions with the
following backtrace:

```
Failure/Error:
  visit File.join(
          GlobalSetting.relative_url_root || "",
          "/session/#{user.encoded_username}/become.json?redirect=false",
        )

Socket::ResolutionError:
  getaddrinfo: Temporary failure in name resolution

```

Switch to use `127.0.0.1` instead of forcing a name resolution.
2024-05-28 09:47:22 +08:00
Régis Hanol
5f6b6e9818 FIX: correctly compute the window for email summaries
In 958437e7dd we ensured that the email summaries are properly sent based on 'digest_attempted_at' for people who barely/never visit the forum.

This fixed the "frequency" of the email summaries but introduced a bug where the digest would be sent even though there wasn't anything new since for some users.

The logic we use to compute the threshold date for the content to be included in the digest was

```ruby
@since = opts[:since] || user.last_seen_at || user.user_stat&.digest_attempted_at || 1.month.ago
```

It was working as expected for users who haven never been seen but for users who have connected at least once, we would use their "last_seen_at" date as the "threshold date" for the content to be sent in a summary 😬

This fix changes the logic to be the most recent date amongst the `last_seen_at`, `digest_attempted_at` and `1.month.ago` so it's correctly handling cases where

- user has never been seen nor emailed a summary
- user has been seen in a while but has recently been sent a summary
- user has been sent a summary recently but hasn't been seen in a while.
2024-05-27 22:33:51 +02:00
Loïc Guitaut
2a28cda15c DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
Joffrey JAFFEUX
3b6d4c830f
DEV: correctly delete custom scheme (#27203)
We were adding the custom scheme as a symbol, but trying to delete the string. Which would result in the symbol to not be removed.

This was causing errors in others test:

```
Error encountered while proccessing /admin/color_schemes.json  I18n::MissingTranslationData: Translation missing: en.color_schemes.baseschemewithnohighlightcolor
```

Reproducible with (probably possible to have a simpler repro):

```
bundle exec rspec --order random:27167 spec/integration/invalid_request_spec.rb spec/integration/spam_rules_spec.rb spec/jobs/bulk_invite_spec.rb spec/jobs/change_display_name_spec.rb spec/jobs/cleanup_imap_sync_log_spec.rb spec/jobs/download_backup_email_spec.rb spec/jobs/fix_primary_emails_for_staged_users_spec.rb spec/jobs/fix_s3_etags_spec.rb spec/jobs/pending_users_reminder_spec.rb spec/jobs/periodical_updates_spec.rb spec/jobs/pull_hotlinked_images_spec.rb spec/jobs/regular/group_smtp_email_spec.rb spec/jobs/reindex_search_spec.rb spec/jobs/update_topic_hot_scores_spec.rb spec/jobs/user_email_spec.rb spec/lib/admin_confirmation_spec.rb spec/lib/backup_restore/database_restorer_multisite_spec.rb spec/lib/backup_restore/system_interface_spec.rb spec/lib/bookmark_reminder_notification_handler_spec.rb spec/lib/color_math_spec.rb spec/lib/content_buffer_spec.rb spec/lib/discourse_spec.rb spec/lib/discourse_tagging_spec.rb spec/lib/discourse_webauthn/registration_service_spec.rb spec/lib/email/renderer_spec.rb spec/lib/email_updater_spec.rb spec/lib/ember_cli_spec.rb spec/lib/feed_element_installer_spec.rb spec/lib/file_helper_spec.rb spec/lib/final_destination/resolver_spec.rb spec/lib/freedom_patches/schema_migration_details_spec.rb spec/lib/guardian/post_guardian_spec.rb spec/lib/guardian/topic_guardian_spec.rb spec/lib/message_id_service_spec.rb spec/lib/onebox/domain_checker_spec.rb spec/lib/onebox/engine/google_maps_onebox_spec.rb spec/lib/onebox/engine/google_play_app_onebox_spec.rb spec/lib/onebox/engine/json_spec.rb spec/lib/onebox/engine/reddit_media_onebox_spec.rb spec/lib/onebox/engine/video_onebox_spec.rb spec/lib/onebox/engine/wikipedia_onebox_spec.rb spec/lib/onebox/engine/wistia_onebox_spec.rb spec/lib/post_destroyer_spec.rb spec/lib/post_locker_spec.rb spec/lib/s3_helper_spec.rb spec/lib/s3_inventory_spec.rb spec/lib/scss_checker_spec.rb spec/lib/site_icon_manager_spec.rb spec/lib/site_setting_extension_multisite_spec.rb spec/lib/summarization/base_spec.rb spec/lib/trashable_spec.rb spec/lib/validators/category_search_priority_weights_validator_spec.rb spec/lib/validators/max_username_length_validator_spec.rb spec/lib/validators/regex_presence_validator_spec.rb spec/lib/validators/regexp_list_validator_spec.rb spec/lib/validators/topic_title_length_validator_spec.rb spec/lib/validators/url_validator_spec.rb spec/lib/work_queue_spec.rb spec/mailers/test_mailer_spec.rb spec/mailers/version_mailer_spec.rb spec/models/badge_grouping_spec.rb spec/models/category_featured_topic_spec.rb spec/models/color_scheme_spec.rb spec/models/flag_spec.rb spec/models/given_daily_like_spec.rb spec/models/plugin_store_spec.rb spec/models/screened_url_spec.rb spec/models/site_setting_spec.rb spec/models/tag_spec.rb spec/models/theme_svg_sprite_spec.rb spec/models/top_menu_item_spec.rb spec/models/topic_allowed_user_spec.rb spec/models/topic_converter_spec.rb spec/models/topic_timer_spec.rb spec/models/translation_override_spec.rb spec/models/user_archived_message_spec.rb spec/models/user_email_spec.rb spec/models/user_search_spec.rb spec/models/user_status_spec.rb spec/models/web_hook_event_spec.rb spec/multisite/pausable_multisite_spec.rb spec/multisite/pausable_spec.rb spec/requests/about_controller_spec.rb spec/requests/admin/backups_controller_spec.rb spec/requests/admin/color_schemes_controller_spec.rb spec/requests/admin/email_templates_controller_spec.rb spec/requests/admin/form_templates_controller_spec.rb spec/requests/admin/screened_ip_addresses_controller_spec.rb spec/requests/admin/site_texts_controller_spec.rb spec/requests/api/categories_spec.rb spec/requests/api/site_spec.rb spec/requests/api/tags_spec.rb spec/requests/api/uploads_spec.rb spec/requests/api/users_spec.rb spec/requests/associate_accounts_controller_spec.rb spec/requests/badges_controller_spec.rb spec/requests/csp_reports_controller_spec.rb spec/requests/edit_directory_columns_controller_spec.rb spec/requests/slugs_controller_spec.rb spec/requests/steps_controller_spec.rb spec/requests/stylesheets_controller_spec.rb spec/requests/topic_view_stats_controller_spec.rb spec/requests/user_avatars_controller_spec.rb spec/requests/users_controller_spec.rb spec/script/import_scripts/vanilla_body_parser_spec.rb spec/serializers/basic_reviewable_queued_post_serializer_spec.rb spec/serializers/found_user_serializer_spec.rb spec/serializers/reviewable_flagged_post_serializer_spec.rb spec/serializers/reviewable_queued_post_serializer_spec.rb spec/serializers/reviewable_user_serializer_spec.rb spec/serializers/theme_objects_setting_metadata_serializer_spec.rb spec/serializers/topic_tracking_state_item_serializer_spec.rb spec/serializers/user_summary_serializer_spec.rb spec/serializers/user_with_custom_fields_serializer_spec.rb spec/services/color_scheme_revisor_spec.rb spec/services/email_settings_exception_handler_spec.rb spec/services/notification_emailer_spec.rb spec/services/problem_check/email_polling_errored_recently_spec.rb spec/services/problem_check/missing_mailgun_api_key_spec.rb spec/services/problem_check/unreachable_themes_spec.rb spec/services/site_settings_spec.rb spec/services/topic_timestamp_changer_spec.rb spec/services/username_changer_spec.rb
```
2024-05-27 16:35:42 +02:00
Osama Sayegh
361992bb74
FIX: Apply crawler rate limits to cached requests (#27174)
This commit moves the logic for crawler rate limits out of the application controller and into the request tracker middleware. The reason for this move is to apply rate limits to all crawler requests instead of just the requests that make it to the application controller. Some requests are served early from the middleware stack without reaching the Rails app for performance reasons (e.g. `AnonymousCache`) which results in crawlers getting 200 responses even though they've reached their limits and should be getting 429 responses.

Internal topic: t/128810.
2024-05-27 16:26:35 +03:00
Krzysztof Kotlarek
f5516b8088
DEV: clean after replacing flags spec (#27194)
After flags are replaced, we need to bring the state back to the original. Otherwise, it causes flaky specs.
2024-05-27 19:57:41 +08:00
Gerhard Schlager
5e61d55940
FIX: Updating avatar didn't trigger a rebake of posts with quotes of the user (#27184) 2024-05-27 09:57:48 +02:00
Gerhard Schlager
9aede9c8d8
FIX: "Replace Text" didn't list "Welcome Topic" when "General" category is missing (#27182)
Replacing the text of seeded topics doesn't require categories to exist, so this change removes that requirement for updates.
2024-05-27 09:57:30 +02:00
Sam
d1191b7f5f
FEATURE: topic_view_stats table with daily fidelity (#27197)
This gives us daily fidelity of topic view stats

New table stores a row per topic viewed per day tracking
anonymous and logged on views

We also have a new endpoint `/t/ID/views-stats.json` to get the statistics for the topic.
2024-05-27 15:25:32 +10:00
Martin Brennan
3a91a92563
DEV: Remove hashtag deprecations (#27195)
Introduced in
c7860173c1,
they are no longer necessary once https://github.com/discourse/discourse-encrypt/pull/317
is merged
2024-05-27 14:00:36 +10:00
Juan David Martínez Cubillos
581dbca97f
DEV: Update Reviewables agree and edit action test (#27162) 2024-05-24 12:20:30 -07:00
Régis Hanol
bc089dc52b FIX: bypass fast edit when selected text isn't editable
When selected some text inside a post, we offer the ability to "fast edit" the selected text without opening the composer.

However, there are certain cases where this isn't working quite a expected, due to the fact that we have some text in the "cooked" version of the post that isn't literally in the "raw" version of the post.

This ensures that whenever someone selects the within

- a quote
- a onebox
- an encrypted message
- a "cooked" date

we directly show the composer instead of showing the fast edit modal and then leaving the user with an invisible error.

Internal ref. t/128400
2024-05-24 18:19:28 +02:00
Mark VanLandingham
971b66e440
DEV: Move webhook event header modifier for redelivery-recalucation (#27177) 2024-05-24 10:37:10 -05:00
Ted Johansson
69205cb1e5
DEV: Catch missing translations during test runs (#26258)
This configuration makes it so that a missing translation will raise an error during test execution. Better discover there than after deploy.
2024-05-24 22:15:53 +08:00
Krzysztof Kotlarek
89401d5fc1
FIX: flaky user_merger_spec.rb (#27169)
Flag guardian spec needs to clean state after evaluation. Each created flag is adding PostActionType.
2024-05-24 15:23:59 +10:00
Krzysztof Kotlarek
99e27c4fd5
FIX: change around to after in flag spec (#27168) 2024-05-24 12:55:21 +10:00
Alan Guo Xiang Tan
df16ab0758
FIX: S3Inventory to ignore files older than last backup restore date (#27166)
This commit updates `S3Inventory#files` to ignore S3 inventory files
which have a `last_modified` timestamp which are not at least 2 days
older than `BackupMetadata.last_restore_date` timestamp.

This check was previously only in `Jobs::EnsureS3UploadsExistence` but
`S3Inventory` can also be used via Rake tasks so this protection needs
to be in `S3Inventory` and not in the scheduled job.
2024-05-24 10:54:06 +08:00
Krzysztof Kotlarek
a4c5f85b10
FIX: flaky post action counts specs (#27165)
After flags were moved to the database, with each save they are changing available PostActionTypes. Therefore, flag specs should clear the state before and after each example not just before.

In addition, we need to clear `nil` counts for dynamically created flags from serializer.
2024-05-24 11:55:32 +10:00
Penar Musaraj
f9192835a7
FIX: Do not reset sidebar defaults in wizard (#27156)
We removed the option to enable/disable the sidebar in the wizard in
https://github.com/discourse/discourse/pull/26926, but these lines of
code were resetting it quietly to `header_dropdown`.
2024-05-23 16:45:47 -04:00
Jeff Wong
755f8de6d4
FEATURE: add agree and edit (#27088)
* FEATURE: add agree and edit

adds agree and edit - an alias for agree and keep -- but with a client action to
edit the post in the composer before the flag is agreed with

---------

Co-authored-by: Juan David Martinez <juan@discourse.org>
2024-05-23 11:21:42 -07:00
Jan Cernik
ebc3af90eb
DEV: More system specs for signup/login (#27150) 2024-05-23 10:01:05 -03:00
Ted Johansson
7b437c9401
FEATURE: Implement new required options in admin user fields UI (#27079)
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
2024-05-23 19:18:25 +08:00
Alan Guo Xiang Tan
f84eda7c8d
FIX: Post#each_upload_url yielding external URLs (#27149)
This commit updates `Post#each_upload_url` to reject URLs that do not
have a host which matches `Discourse.current_hostname` but follows the
`/uploads/short-url` uploads URL format. This situation most commonly
happen when users copy upload URL link between different Discourse
sites.
2024-05-23 15:15:16 +10:00
Krzysztof Kotlarek
cfbbfd177c
DEV: move post flags into database (#27125)
This is preparation for a feature that will allow admins to define their custom flags. Current behaviour should stay untouched.
2024-05-23 12:19:07 +10:00
Martin Brennan
312a930ac8
UX: Disable plugin list settings button for some plugins (#27124)
For plugins with only an "enabled" site setting, it doesn't
make sense to take them to the site settings page, since the
toggle switch in the list can be used to change enabled/disabled.

This will not be the case for plugins that have their own custom
config page (like Automation), but we will deal with this when
we actually overhaul this plugin to use the new show page.

Also adds another rspec fixture of a test plugin.
2024-05-23 12:04:26 +10:00
Ted Johansson
3137e60653
DEV: Database backed admin notices (#26192)
This PR introduces a basic AdminNotice model to store these notices. Admin notices are categorized by their source/type (currently only notices from problem check.) They also have a priority.
2024-05-23 09:29:08 +08:00
marstall
d75339af76
DEV: let reply_by_email, visit_link_to_respond email strings be modified by plugins (#27133)
* DEV: allow reply_by_email, visit_link_to_respond strings to be modified by plugins

* DEV: separate visit_link_to_respond and reply_by_email modifiers out
2024-05-22 15:33:06 -04:00
Penar Musaraj
9d7f374c0f
DEV: Fix a flakey test, skip another one (#27132) 2024-05-22 11:59:47 -04:00
Amanda Alves Branquinho
b0d95c8c78
FEATURE: Add bulk action to bookmark (#26856)
This PR aims to add bulk actions to the user's bookmarks.

After this feature, all users should be able to select multiple bookmarks and perform the actions of "deleting" or "clear reminders"
2024-05-22 12:50:21 -03:00
benj
e42ba6e90a
UX: Group membership PMs thread (#26974)
Instead of creating two separate Topics when a user (1) requests to join a group and (2) gets accepted in, this makes the acceptance message into a Post under the origin group request Topic.
2024-05-22 11:47:28 -04:00
Régis Hanol
8f7a3e5b29 FIX: subfolder absolute links in summaries
This fixes the `PrettyText.make_all_links_absolute` to better handle subfolder.

In subfolder, when given the cooked version of a post, links to mentions includes the `Discourse.base_path` prefix. Adding the `Discourse.base_url` was doubling the `Discourse.base_path`.

The issue was hidden behind the specs which was stubbing `Discourse.base_url` instead of relying on `Discourse.base_path`.

This fixes both the "algorithm" used in `PrettyText.make_all_links_absolute` to better handle this case and correct the specs to properly handle subfolder cases.

There are lots of changes in the specs due to a refactoring to use squiggly heredoc strings for easier reading and less escaping.
2024-05-22 15:38:18 +02:00
Régis Hanol
958437e7dd
FIX: send activity summaries based on "last seen" (#27035)
instead of "last emailed" so that people getting email notifications (from a watched topic for example) also get the activity summaries.

Context - https://meta.discourse.org/t/activity-summary-not-sent-if-other-emails-are-sent/293040

Internal Ref - t/125582

Improvement over 95885645d9
2024-05-22 10:23:03 +02:00
Régis Hanol
3d4d21693b
FIX: various revision history modal quirks (#27058)
- FIX: properly scope category changes to what the current user can see
- UX: previous category is now highlighted in "red", new category is highlighted in "green"
- PERF: no need to serialize the categories
- FIX: properly track wiki
- FIX: properly track post_type (aka. Staff Color)
- FIX: properly track making a topic a PM
- FIX: never show the category changes when a topic is made a PM
- PERF: post_revision serializer is now more leaner (never includes title changes when post_number > 1, never includes user changes if there aren't any)
- UX: always sort the tags by name
2024-05-22 10:09:20 +02:00
Sam
322a20a9f4
FIX: paginating posts should allow for deletions and PMs (#27098)
Note this may have performance issues in some cases, will need to be monitored

Previous to this change we were bracketing on 50 id windows. They may end up
having zero posts we are searching for leading to posts.rss and .json returning
no results.

- avoids Post.last.id which is expensive
- order by id desc which is better cause we bracket on id
2024-05-22 15:36:29 +10:00
Jarek Radosz
4b29ab8572
DEV: Fix glimmer suggested topic item badges (#27123) 2024-05-22 03:06:45 +02:00