Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ after you've upgraded. * Avoid page to jump to top after a post deletion [#7638](https://github.com/diaspora/diaspora/pull/7638) * Handle duplicate account deletions [#7639](https://github.com/diaspora/diaspora/pull/7639) * Handle duplicate account migrations [#7641](https://github.com/diaspora/diaspora/pull/7641) * Handle bugs related to missing users [#7632](https://github.com/diaspora/diaspora/pull/7632) ## Features * Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530) Loading app/models/notification.rb +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ # class Notification < ApplicationRecord belongs_to :recipient, class_name: "User" has_many :notification_actors, dependent: :destroy has_many :notification_actors, dependent: :delete_all has_many :actors, class_name: "Person", through: :notification_actors, source: :person belongs_to :target, polymorphic: true Loading db/migrate/20171012202650_cleanup_invalid_contacts.rb 0 → 100644 +44 −0 Original line number Diff line number Diff line # frozen_string_literal: true class CleanupInvalidContacts < ActiveRecord::Migration[5.1] class Contact < ApplicationRecord belongs_to :user belongs_to :person has_many :aspect_memberships, dependent: :delete_all before_destroy :destroy_notifications def destroy_notifications Notification.where( target_type: "Person", target_id: person_id, recipient_id: user_id, type: "Notifications::StartedSharing" ).destroy_all end end class User < ApplicationRecord end class Person < ApplicationRecord belongs_to :owner, class_name: "User", optional: true end class Notification < ApplicationRecord self.inheritance_column = nil has_many :notification_actors, dependent: :delete_all end class NotificationActor < ApplicationRecord end class AspectMembership < ApplicationRecord end def up Contact.left_outer_joins(:user).where("users.id is NULL").destroy_all Contact.left_outer_joins(person: :owner).where("people.owner_id is NOT NULL").where("users.id is NULL").destroy_all end end Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ after you've upgraded. * Avoid page to jump to top after a post deletion [#7638](https://github.com/diaspora/diaspora/pull/7638) * Handle duplicate account deletions [#7639](https://github.com/diaspora/diaspora/pull/7639) * Handle duplicate account migrations [#7641](https://github.com/diaspora/diaspora/pull/7641) * Handle bugs related to missing users [#7632](https://github.com/diaspora/diaspora/pull/7632) ## Features * Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530) Loading
app/models/notification.rb +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ # class Notification < ApplicationRecord belongs_to :recipient, class_name: "User" has_many :notification_actors, dependent: :destroy has_many :notification_actors, dependent: :delete_all has_many :actors, class_name: "Person", through: :notification_actors, source: :person belongs_to :target, polymorphic: true Loading
db/migrate/20171012202650_cleanup_invalid_contacts.rb 0 → 100644 +44 −0 Original line number Diff line number Diff line # frozen_string_literal: true class CleanupInvalidContacts < ActiveRecord::Migration[5.1] class Contact < ApplicationRecord belongs_to :user belongs_to :person has_many :aspect_memberships, dependent: :delete_all before_destroy :destroy_notifications def destroy_notifications Notification.where( target_type: "Person", target_id: person_id, recipient_id: user_id, type: "Notifications::StartedSharing" ).destroy_all end end class User < ApplicationRecord end class Person < ApplicationRecord belongs_to :owner, class_name: "User", optional: true end class Notification < ApplicationRecord self.inheritance_column = nil has_many :notification_actors, dependent: :delete_all end class NotificationActor < ApplicationRecord end class AspectMembership < ApplicationRecord end def up Contact.left_outer_joins(:user).where("users.id is NULL").destroy_all Contact.left_outer_joins(person: :owner).where("people.owner_id is NOT NULL").where("users.id is NULL").destroy_all end end