Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ff8ecbca
Commit
ff8ecbca
authored
May 23, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rake task to reset all rss tokens
parent
3713a57f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
lib/tasks/tokens.rake
lib/tasks/tokens.rake
+10
-0
spec/tasks/tokens_spec.rb
spec/tasks/tokens_spec.rb
+6
-0
No files found.
lib/tasks/tokens.rake
View file @
ff8ecbca
...
...
@@ -11,6 +11,11 @@ namespace :tokens do
reset_all_users_token
(
:reset_incoming_email_token!
)
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
)
TmpUser
.
find_in_batches
do
|
batch
|
puts
"Processing batch starting with user ID:
#{
batch
.
first
.
id
}
"
...
...
@@ -35,4 +40,9 @@ class TmpUser < ActiveRecord::Base
write_new_token
(
:incoming_email_token
)
save!
(
validate:
false
)
end
def
reset_rss_token!
write_new_token
(
:rss_token
)
save!
(
validate:
false
)
end
end
spec/tasks/tokens_spec.rb
View file @
ff8ecbca
...
...
@@ -18,4 +18,10 @@ describe 'tokens rake tasks' do
expect
{
run_rake_task
(
'tokens:reset_all_email'
)
}.
to
change
{
user
.
reload
.
incoming_email_token
}
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment