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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
c90d167b
Commit
c90d167b
authored
Aug 09, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Member.expired scope.
parent
08ecf0e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
app/models/member.rb
app/models/member.rb
+1
-0
app/workers/remove_expired_members_worker.rb
app/workers/remove_expired_members_worker.rb
+1
-1
No files found.
app/models/member.rb
View file @
c90d167b
...
@@ -31,6 +31,7 @@ class Member < ActiveRecord::Base
...
@@ -31,6 +31,7 @@ class Member < ActiveRecord::Base
scope
:non_invite
,
->
{
where
(
invite_token:
nil
)
}
scope
:non_invite
,
->
{
where
(
invite_token:
nil
)
}
scope
:request
,
->
{
where
.
not
(
requested_at:
nil
)
}
scope
:request
,
->
{
where
.
not
(
requested_at:
nil
)
}
scope
:has_access
,
->
{
where
(
'access_level > 0'
)
}
scope
:has_access
,
->
{
where
(
'access_level > 0'
)
}
scope
:expired
,
->
{
where
(
'expires_at <= ?'
,
Time
.
current
)
}
scope
:guests
,
->
{
where
(
access_level:
GUEST
)
}
scope
:guests
,
->
{
where
(
access_level:
GUEST
)
}
scope
:reporters
,
->
{
where
(
access_level:
REPORTER
)
}
scope
:reporters
,
->
{
where
(
access_level:
REPORTER
)
}
...
...
app/workers/remove_expired_members_worker.rb
View file @
c90d167b
...
@@ -2,7 +2,7 @@ class RemoveExpiredMembersWorker
...
@@ -2,7 +2,7 @@ class RemoveExpiredMembersWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
def
perform
def
perform
Member
.
where
(
'expires_at <= ?'
,
Time
.
current
)
.
find_each
do
|
member
|
Member
.
expired
.
find_each
do
|
member
|
begin
begin
Members
::
AuthorizedDestroyService
.
new
(
member
).
execute
Members
::
AuthorizedDestroyService
.
new
(
member
).
execute
rescue
=>
ex
rescue
=>
ex
...
...
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