diff --git a/Changelog.md b/Changelog.md index f6c9fe53463df752acb715091387d7dc32653ce6..4f96202cece391ec89425897e92f74d5f42a2a84 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ * Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252) * Show the user if a contact is sharing with them when viewing their profile page [#2948](https://github.com/diaspora/diaspora/issues/2948) * Made Unicorn timeout configurable and increased the default to 90 seconds +* Follow DiasporaHQ upon account creation is now configurable to another account [#4278](https://github.com/diaspora/diaspora/pull/4278) # 0.1.1.0 diff --git a/app/models/user.rb b/app/models/user.rb index faca1f6af99c82a337e90e6a7f57a894ce260ef0..a53bfe4888b960b6dfc3fa02324cece110108f8a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -391,8 +391,8 @@ class User < ActiveRecord::Base self.aspects.create(:name => I18n.t('aspects.seed.work')) aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances')) - if AppConfig.settings.follow_diasporahq? - default_account = Webfinger.new('diasporahq@joindiaspora.com').fetch + if AppConfig.settings.autofollow_on_join? + default_account = Webfinger.new(AppConfig.settings.autofollow_on_join_user).fetch self.share_with(default_account, aq) if default_account end aq diff --git a/config/defaults.yml b/config/defaults.yml index e9f56a4da654c363719adf2ed5c07fff1b2cec29..7454595bfbe7a79bea10e4222a6399f226a544fb 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -53,7 +53,8 @@ defaults: settings: pod_name: 'Diaspora*' enable_registrations: true - follow_diasporahq: true + autofollow_on_join: true + autofollow_on_join_user: 'diasporahq@joindiaspora.com' invitations: open: true count: 25 @@ -121,7 +122,8 @@ development: server: unicorn_worker: 1 settings: - follow_diasporahq: false + autofollow_on_join: false + autofollow_on_join_user: '' production: i_am_a_dummy: # Remove if you add an actual override test: @@ -132,7 +134,8 @@ test: assets: serve: true settings: - follow_diasporahq: false + autofollow_on_join: false + autofollow_on_join_user: '' invitations: open: true services: diff --git a/config/diaspora.yml.example b/config/diaspora.yml.example index 1b681ad0e605d066d0e47be4c07ad91121a777ef..1ca7c1afd7db92c45baa9d2ddf2ff53890ebf426 100644 --- a/config/diaspora.yml.example +++ b/config/diaspora.yml.example @@ -205,12 +205,16 @@ configuration: ## Section ## the first registration (you). #enable_registrations: true - ## Set this to false if you don't want your users to follow the - ## diasporahq@joindiaspora.com account on account creation. + ## Users will automatically follow a specified account on creation + ## Set this to false if you don't want your users to automatically + ## follow an account upon creation. + #autfollow_on_join: true + ## The diasporahq account helps users start with some activity in ## their stream and get news about Diaspora, but if you don't want - ## your server to contact joindiaspora.com, set this to false: - #follow_diasporahq: false + ## your server to contact joindiaspora.com, you can change account + ## below or set autofollow_on_join to false + #autofollow_on_join_user: 'diasporahq@joindiaspora.com' ## Settings about invitations invitations: ## Section diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 58fcbc142134d03d5c471c330533cc153f592bdf..d0ac01f5a7de9625f5d220a0f0e4e33bab80255e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -864,26 +864,29 @@ describe User do end end - describe "diasporahq sharing" do + describe "autofollow sharing" do let(:user) { FactoryGirl.create(:user) } before(:each) do - @old_followhq_value = AppConfig.settings.follow_diasporahq? + @old_autofollow_value = AppConfig.settings.autofollow_on_join? + @old_autofollow_user = AppConfig.settings.autofollow_on_join_user end after(:each) do - AppConfig.settings.follow_diasporahq = @old_followhq_value + AppConfig.settings.autofollow_on_join = @old_followhq_value + AppConfig.settings.autofollow_on_join_user = @old_autofollow_user end - context "with sharing with diasporahq enabled" do - it "should start sharing with the diasporahq account" do - AppConfig.settings.follow_diasporahq = true + context "with autofollow sharing enabled" do + it "should start sharing with autofollow account" do + AppConfig.settings.autofollow_on_join = true + AppConfig.settings.autofollow_on_join_user = 'one' wf_mock = mock wf_mock.should_receive(:fetch) - Webfinger.should_receive(:new).and_return(wf_mock) + Webfinger.should_receive(:new).with('one').and_return(wf_mock) user.seed_aspects end @@ -891,7 +894,7 @@ describe User do context "with sharing with diasporahq enabled" do it "should not start sharing with the diasporahq account" do - AppConfig.settings.follow_diasporahq = false + AppConfig.settings.autofollow_on_join = false Webfinger.should_not_receive(:new)