Skip to content
Extraits de code Groupes Projets
Valider f695b5d3 rédigé par zachrab's avatar zachrab
Parcourir les fichiers

Set disable_mail to true

Add #clear_account! disable mail spec

Add migration for disabling mail for all closed accounts

Change migration to use #update_all for disable_mail attribute

Add #clear_account! false fields spec
parent 5af43243
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -489,10 +489,10 @@ class User < ActiveRecord::Base
self[field] = nil
end
[:getting_started,
:disable_mail,
:show_community_spotlight_in_stream].each do |field|
self[field] = false
end
self[:disable_mail] = true
self[:strip_exif] = true
self[:email] = "deletedaccount_#{self[:id]}@example.org"
......
class DisableMailForClosedAccount < ActiveRecord::Migration
def up
User.joins(:person).where(people: {closed_account: true}).update_all(disable_mail: true)
end
def down
User.joins(:person).where(people: {closed_account: true}).update_all(disable_mail: false)
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150106050733) do
ActiveRecord::Schema.define(version: 20150209230946) do
create_table "account_deletions", force: true do |t|
t.string "diaspora_handle"
......
......@@ -962,6 +962,18 @@ describe User, :type => :model do
expect(@user.send(attr.to_sym)).to be_blank
end
end
it 'disables mail' do
@user.disable_mail = false
@user.clear_account!
expect(@user.reload.disable_mail).to be true
end
it 'sets getting_started and show_community_spotlight_in_stream fields to false' do
@user.clear_account!
expect(@user.reload.getting_started).to be false
expect(@user.reload.show_community_spotlight_in_stream).to be false
end
end
describe "#clearable_attributes" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter