Skip to content

[2.x] feat(subscriptions): add support for auto follow discussions on create#4464

Open
huoxin233 wants to merge 7 commits intoflarum:2.xfrom
huoxin233:huoxin/2.x-subscription-add-follow-on-create
Open

[2.x] feat(subscriptions): add support for auto follow discussions on create#4464
huoxin233 wants to merge 7 commits intoflarum:2.xfrom
huoxin233:huoxin/2.x-subscription-add-follow-on-create

Conversation

@huoxin233
Copy link

@huoxin233 huoxin233 commented Mar 16, 2026

Changes proposed in this pull request:

This PR introduces a new setting in the flarum/subscriptions extension that automatically subscribes users to discussions they created.

The original followAfterReply does cover discussion creation also, but not all users will want to follow every discussion they reply to, thats why a followAfterCreate is needed.

The default preference for followAfterCreate is set to true as discussion creators usually want to know when someone replied to their discussion.

Reviewers should focus on:

Would you consider including this in the core extension? Or should it be extended using another extension, as shown in my extension: https://discuss.flarum.org/d/34680-auto-follow-discussion

There have also been quite a few discussions on this behavior over the years:

Personally, I would definitely like to see this in core as this is something that should come out of the box.

Screenshot

image

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

@huoxin233 huoxin233 requested a review from a team as a code owner March 16, 2026 15:43
Copy link
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is clean and closely mirrors FollowAfterReply. A few things to address:

Default preference should be false

->registerPreference('followAfterCreate', 'boolval', false)

This is an opt-in behaviour — existing users who've never saved this preference would have it silently enabled after upgrading. Please change the default to false.

Tests needed

FollowAfterReply has integration test coverage — FollowAfterCreate should too. At minimum: a user with followAfterCreate = true ends up subscribed after starting a discussion, and a user with followAfterCreate = false does not.

followAfterCreateLoading not declared on the component

This works via dynamic properties the same way followAfterReplyLoading does, but it should be explicitly declared on SettingsPage alongside the existing loading flags.

Locale string tense

follow_after_create_label reads "discussions that I created" (past tense). Should match the existing pattern: "discussions that I create".

StyleCI

StyleCI is flagging issues — please address before we can merge.

@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 20, 2026
@imorland
Copy link
Member

Note: this is marked for beta.8 — feature cut-off is midday CET this Sunday. If the above isn't addressed in time it will have to wait until Flarum 2.1.

@huoxin233
Copy link
Author

huoxin233 commented Mar 21, 2026

All fixed!
Added tests to check FollowAfterReply also

@huoxin233 huoxin233 requested a review from imorland March 21, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants