- Add BOOKMARK_COLUMNS, create_bookmarks, and process_bookmark to
base.rb
- Implement import_bookmarks in generic_bulk.rb for Topic and Post
bookmarks
- Track bookmark sequence IDs to prevent conflicts
- Update topic_users.bookmarked flag after bookmark import
- Add refresh_directory_items to sync user stats post-import
"Backuper" is a spelling error. When adding "-er" to a word ending in a
consonant after a short vowel, the consonant is doubled: up → upper,
run → runner, backup → backupper.
Rather than "Backupper" (awkward), rename to "Creator" which:
- Is a real word
- Provides symmetry with BackupRestore::Restorer
- Matches naming patterns elsewhere (HostedSiteCreator, etc.)
BackupRestore::Backuper → BackupRestore::Creator
When a collaborator makes a `@discoursebot backport` comment on a PR,
this workflow will create matching PRs for the same change against each
currently-supported version branch
Category changes:
- Fix existing_id handling to check if string is numeric before using as
site setting name. Previously numeric strings like '3' would cause
errors when passed to SiteSetting.get().
Group changes:
- Add existing_id support for groups, allowing mapping imported groups
to existing Discourse groups by ID or name.
- When existing_id is specified, skip group creation and map imported_id
to the existing group.
This enables importing users into pre-existing groups without creating
duplicates, similar to category existing_id functionality.
Co-authored-by: root <root@migrations02.sjc4.discourse.cloud>
This commit adds a new "Email on flagged post" automation which can be configured to send emails to users when a post is flagged. The automation can be configured to trigger only when posts are flagged in certain categories or only when certain tags are present on the post's topic.
The body of the email sent can also be configured with the following placeholders available:
* topic_url
* topic_title
* post_url
* post_number
* flagger_username
* flagged_username
* flag_type
* category
* tags
* post_excerpt
Fixes operator precedence issue where `name.presence || username` was
being evaluated after the array append, resulting in nil being added
to bbcode_parts when name is nil.
The fix wraps the expression in parentheses to ensure the || operator
- Switches to typescript 'composite project' mode for improved
organization & performance
- Generates declarations from core modules, and outputs to a new
`@discourse/types` package
- Introduces tsconfigs for core plugins, which leans on that new
`@discourse/types` package
- In future, we plan to publish this discourse-types package for other
themes/plugins to use
The motivation at this stage is primarily to improve editor
autocompletion. We provide absolutely no guarantees about the accuracy
or stability of the generated types.
For now, some issues have been resolved by adding manual `@type`
declarations.
In particular, extensionless imports of `.gjs` files are broken when
running in composite-project mode, so in those cases we have to add
manual `@type {import("./the-file.gjs").default}` declarations.
Unfortunately this failure does not show up in IDEs. We hope to get this
resolved soon.
---------
Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Chris Manson <chris@manson.ie>
This time (following the admin move) - select-kit, float-kit,
truth-helpers, and dialog-holder
---------
Co-authored-by: David Taylor <david@taylorhq.com>
To simplify our repository architecture, we're moving the admin panel from a separate package(/ember-addon) to a directory inside the main app package. This will make future configuration of tools like typescript/glint, and Vite, much easier. It also means that the admin panel is now transpiled via Webpack, and can internally make use of async-imports and bundle-splitting.
Admin modules will now be referenced like `discourse/admin/...`. Backwards-compatibility is maintained for the old import paths via a custom babel transform.
A 'compatModules' technique is used to keep all of the admin invokables and routes/controllers/templates available to Ember's resolver.
This extends the **MyLittleForum (MLF) importer** with several optional features to make migrations more complete and reliable.
### New Features (optional via environment variables)
**Uploads import**: supports attachments and images from the MLF uploads table.
- Imported uploads are stored with relative links, ensuring they continue to work even if the forum domain changes.
- **Legacy link rewriting**: absolute links (`index.php?id=...`) are converted into working Discourse permalinks.
- Rewritten links are also created as relative links, so they remain valid after a domain move.
- **Parent category option**: all imported MLF categories can be placed under a chosen existing category.
- **Upload repair pass / incremental imports:** already-imported posts can be rescanned to fix broken or newly available upload references, allowing the importer to be run again later with a more up-to-date dataset.
- **Relaxed upload constraints**: temporarily increases file size limits and allows all extensions during the import step.
### Other Improvements
- Adjusted for MyLittleForum 2.x schema changes (e.g. `user_location` instead of `user_place`).
- User import now respects already staged users; avoids errors that would otherwise occur when trying to create them again.
- Improved BBCode → Markdown conversion: lists and quotes are converted more reliably.
- Especially improves handling of quotes at the beginning of posts and ensures following text is not mistakenly included in the quoted block.
- Thread interlinking restored: legacy links between threads are now rewritten to point to the correct Discourse topics.
### Environment Variables
- `PARENT_CATEGORY` – import all categories under an existing Discourse category.
- `REWRITE_LINKS` – rewrite absolute legacy links.
- `UPLOADS_DIR` – path to the MLF uploads directory (flat namespace).
- `REPAIR_UPLOAD_LINKS` – repair pass for already-imported posts with links.
- `LOOSEN_UPLOAD_CONSTRAINTS` – relax upload size/extension checks during import and increases file size limits and allows all extensions during the import step.
We can't enable `Rails/WhereNot` lint/autofix, because it would break
code that uses mini_sql instead of AR (which rubocop, and tbh also we,
can't easily differentiate)
Those are safe because they either:
* are executed in AR model scope definitions
* are clearly chained starting from a AR model
* are less-clearly chained, but still can be traced to a AR model/scope
---------
Co-authored-by: Loïc Guitaut <loic@discourse.org>
SMF2 importer script accepts the database prefix param (-f) but it is
not properly applied for some of the tables. To fix it, the hardcoded
`smf_` prefix is replaced by `{prefix}` as for other tables in the
importer script.
Affected tables:
- personal_messages
- pm_recipients
In #33558 we removed automatic_backups_enabled setting, and instead rely on backup_frequency being blank to disable.
There was a big oversight there with the site setting type system, which will coerce the value to an integer. It also makes it so you can't blank the value out in the UI.
This is a "fix forward" solution where instead of "set to blank to disable" we do "set to 0 to disable". This works along the grain of the site setting type system for a workable fix where we don't have to deal with the irreversible migration in the previous change.
We can potentially go and add in "nullable" to the type system at a later point.
We're removing the automatic_backups_enabled toggle and depending solely on the backup_frequency value. This PR replaces the setting and adds a migration for any forum that has automatic_backups_enabled disabled.
Shortened AI agent file, so we conserve tokens
Use symlinks for all agent files where needed to avoid round trips to
llm
Added config for Open AI Codex / Gemini and Cursor
This commit responds to feedback in the Discourse Meta discussion
https://meta.discourse.org/t/monospace-font-in-the-markdown-only-editor/359936
This change introduces a user preference that allows users to choose
whether the Markdown editor uses a monospace font. The default setting
is `true` for new sites, but set to `false` for existing sites to avoid
disrupting current users' experiences.
Admins can change the `default_other_enable_markdown_monospace_font`
site setting to manage this for all users.
Building the Discourse ember app is resource-intensive process. This
commit introduces a framework for us to build these assets centrally,
and make them available for people to download.
On every commit to `main`, a new GitHub actions workflow will build
development & production versions of the core assets, and publish them
as a github release under the `discourse/discourse-assets` repository. A
separate repository is being used to avoid polluting the main
`discourse/discourse` repository with one-git-tag-per-release.
The `assemble_ember_build.rb` script is updated to fetch the relevant
asset bundle. Requests are made to `get.discourse.org`, which then
redirects to GitHub releases. This redirection service is being used so
that we have the option to switch away from GitHub releases in future
without breaking existing Discourse installations.
For now, this behavior can be enabled by setting
`DISCOURSE_DOWNLOAD_PRE_BUILT_ASSETS=1`. In the near future, we hope to
make this the default, with opt-out via
`DISCOURSE_DOWNLOAD_PRE_BUILT_ASSETS=0`.
We believe the rich editor is a great experience for the
vast majority of sites and users, so we are enabling it
for all sites and all users by default.
This commit does the following:
* Hides the rich_editor site setting and sets it to true by default.
It can still be overridden by sites that want to disable it
completely.
* Sets `rich_editor` to true for all sites to enable the rich editor
everywhere.
* Adds a new `default_composition_mode` site setting and corresponding
user option that defaults to Rich for all users. The other option is
Markdown.
* Changes the rich editor toggle in the composer to use the new
database-backed user option (`composition_mode`) instead of a local
storage key/value store. This makes the preference persistent
across devices.
Existing key/value store settings for the markdown toggle are
kept, the preference will be saved to the user option automatically.
This change makes it easier to review failed uploads, especially
downloadable ones, by standardizing `skip_reason` and adding a
`skip_details` column to the uploads DB's `uploads` table for extended
failure information.
1. Ensure `Creating optimized images...` message is only available
during optimization
2. Guard upload lookup for optimization
3. Replace undefined `stacktrace` method invocation with `backtrace`
This PR improves the generic bulk import and base scripts by adding
support for several previously unimplemented features and attributes:
- Category Moderation Groups: Implements the import of group-based
moderation settings for categories.
- Group Attributes: Adds import support for public_admission,
public_exit, allow_membership_requests, and assignable_level.
- User Attributes: Adds import support for trust_level and
primary_group_id.
- User Option: Adds import support for the hide_profile_and_presence
user option.
- Multiple Tag Groups per Tag: Updates tag import logic to handle tags
belonging to multiple tag groups.
This commit introduces new features and utilities related to the backup
and restore system that make use of remote URLs:
- `discourse restore` accepts a URL to a backup file
- `discourse backup_url` generates a URL of a backup file (S3 only)
- `discourse import_backup_url` downloads a backup file from a URL to
the configured backup store
This can be used to move content between two Discourse instances by
backing up the entire site, copying the backup URL, importing or
restoring it on the other instance.
This PR addresses a problem with the Xenforo importer.
Xenforo has moved from "likes" table and now calls the same table
"reactions" table. Similarly the columns has been also renamed.
With this PR, the importer is upgraded to use the latest naming.
Signed-off-by: Abhiram Shibu <abhiramshibu1998@gmail.com>
Extend the `import_site_settings` import step to enable the
`migrated_site` flag if possible.
It also includes an escape hatch via the
`SKIP_MIGRATED_SITE_FLAG_UPDATE` flag for cases where you really don't
want to toggle it on.
Building the Discourse JS app is very resource-intensive. This commit
introduces an `assemble_ember_build` script which will check the
existing content of the `dist/` directory and re-use the core build if
possible. Plugins will always be rebuilt.
For now, this functionality is only useful for multi-stage (i.e.
non-standard) Discourse deployments. But in future, this script may be
extended to pull the contents of the `dist/` directory from a remote
location.
Ensure `last_read_post_number` is set to the latest post for imported
topic users with a `watching` notification level, even if they haven't
engaged with the topic