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
817a4914
Commit
817a4914
authored
May 15, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not update remember_created_at when in a Geo secondary node
parent
1df30f45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
app/models/ee/user.rb
app/models/ee/user.rb
+10
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+32
-0
No files found.
app/models/ee/user.rb
View file @
817a4914
...
...
@@ -52,5 +52,15 @@ module EE
def
admin_or_auditor?
admin?
||
auditor?
end
def
remember_me!
return
if
::
Gitlab
::
Geo
.
secondary?
super
end
def
forget_me!
return
if
::
Gitlab
::
Geo
.
secondary?
super
end
end
end
spec/models/user_spec.rb
View file @
817a4914
...
...
@@ -1938,4 +1938,36 @@ describe User, models: true do
expect
(
user
.
preferred_language
).
to
eq
(
'en'
)
end
end
describe
'#forget_me!'
do
subject
{
create
(
:user
,
remember_created_at:
Time
.
now
)
}
it
'clears remember_created_at'
do
subject
.
forget_me!
expect
(
subject
.
reload
.
remember_created_at
).
to
be_nil
end
it
'does not clear remember_created_at when in a Geo secondary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
expect
{
subject
.
forget_me!
}.
not_to
change
(
subject
,
:remember_created_at
)
end
end
describe
'#remember_me!'
do
subject
{
create
(
:user
,
remember_created_at:
nil
)
}
it
'updates remember_created_at'
do
subject
.
remember_me!
expect
(
subject
.
reload
.
remember_created_at
).
not_to
be_nil
end
it
'does not update remember_created_at when in a Geo secondary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
expect
{
subject
.
remember_me!
}.
not_to
change
(
subject
,
:remember_created_at
)
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