Commit ff8ecbca authored by Alexis Reigel's avatar Alexis Reigel

rake task to reset all rss tokens

parent 3713a57f
...@@ -11,6 +11,11 @@ namespace :tokens do ...@@ -11,6 +11,11 @@ namespace :tokens do
reset_all_users_token(:reset_incoming_email_token!) reset_all_users_token(:reset_incoming_email_token!)
end end
desc "Reset all GitLab rss tokens"
task reset_all_rss: :environment do
reset_all_users_token(:reset_rss_token!)
end
def reset_all_users_token(reset_token_method) def reset_all_users_token(reset_token_method)
TmpUser.find_in_batches do |batch| TmpUser.find_in_batches do |batch|
puts "Processing batch starting with user ID: #{batch.first.id}" puts "Processing batch starting with user ID: #{batch.first.id}"
...@@ -35,4 +40,9 @@ class TmpUser < ActiveRecord::Base ...@@ -35,4 +40,9 @@ class TmpUser < ActiveRecord::Base
write_new_token(:incoming_email_token) write_new_token(:incoming_email_token)
save!(validate: false) save!(validate: false)
end end
def reset_rss_token!
write_new_token(:rss_token)
save!(validate: false)
end
end end
...@@ -18,4 +18,10 @@ describe 'tokens rake tasks' do ...@@ -18,4 +18,10 @@ describe 'tokens rake tasks' do
expect { run_rake_task('tokens:reset_all_email') }.to change { user.reload.incoming_email_token } expect { run_rake_task('tokens:reset_all_email') }.to change { user.reload.incoming_email_token }
end end
end end
describe 'reset_all_rss task' do
it 'invokes create_hooks task' do
expect { run_rake_task('tokens:reset_all_rss') }.to change { user.reload.rss_token }
end
end
end end
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