Merge pull request #5640 from zachrab/5625-disable-mail-to-deleted-user

Fixes issue #5625
This commit is contained in:
Jonne Haß 2015-02-20 02:29:09 +01:00
commit 9ad26604b7
5 changed files with 24 additions and 2 deletions

View file

@ -134,6 +134,7 @@ diaspora.yml file**. The existing settings from 0.4.x and before will not work a
* Fix missing translation on privacy settings page [#5671](https://github.com/diaspora/diaspora/pull/5671)
* Fix code overflow for the mobile website [#5675](https://github.com/diaspora/diaspora/pull/5675)
* Strip Unicode format characters prior post processing [#5680](https://github.com/diaspora/diaspora/pull/5680)
* Disable email notifications for closed user accounts [#5640](https://github.com/diaspora/diaspora/pull/5640)
## Features
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)

View file

@ -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"

View file

@ -0,0 +1,9 @@
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

View file

@ -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"

View file

@ -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