Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a ChangesetSubscription model #5540

Open
gravitystorm opened this issue Jan 23, 2025 · 0 comments
Open

Create a ChangesetSubscription model #5540

gravitystorm opened this issue Jan 23, 2025 · 0 comments
Labels
refactor Refactoring, or things that work but could be done better

Comments

@gravitystorm
Copy link
Collaborator

We have various subscription models, such as NoteSubscription and DiaryEntrySubscription. We also have a table "changeset_subscribers" which does the same thing (pairs of user_id/object_id), but we don't have a corresponding model. Instead we declare it as a join association in Changesets, and use custom methods on the changeset model (e.g. changeset.subscribe(user)) to indirectly add and remove the rows in that table.

I think it would be worth refactoring this code, to make subscriptions behave the same way across all three models. So we should

  • Create a ChangesetSubscription model, although it will need self.table_name = "changeset_subscribers"
  • Refactor changeset_subscriptions_controller to use the ChangesetSubscription model, likely through changeset.subscriptions.new
  • Remove the subscribe/unsubscribe methods from the Changeset model, since these aren't acting on the Changeset model itself.
@gravitystorm gravitystorm added the refactor Refactoring, or things that work but could be done better label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring, or things that work but could be done better
Projects
None yet
Development

No branches or pull requests

1 participant