Commit 0e4c8993 authored by Benjamin Neff's avatar Benjamin Neff

Remove started sharing notifications where the contact doesn't exist

Before #6873 we deleted contacts when someone blocks a person, but we
didn't drop the notification for the started sharing event. In #6864
we try to get the contact for the notification, which is not there

So we need to remove the notifications for the contacts that don't exit
parent 08c6d485
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
class Notification < ActiveRecord::Base
def up
Notification.where(type: "Notifications::StartedSharing", target_type: "Person")
.joins("INNER JOIN people ON = notifications.target_id")
.joins("LEFT OUTER JOIN contacts ON contacts.person_id =")
.delete_all(" IS NULL")
......@@ -11,7 +11,7 @@
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160813115514) do
ActiveRecord::Schema.define(version: 20160820181334) do
create_table "account_deletions", force: :cascade do |t|
t.string "diaspora_handle", limit: 255
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment