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
3713a57f
Commit
3713a57f
authored
May 23, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add rss_token attribute to user model
parent
c013d23d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
2 deletions
+32
-2
app/models/user.rb
app/models/user.rb
+2
-1
config/application.rb
config/application.rb
+1
-0
db/migrate/20170523091700_add_rss_token_to_users.rb
db/migrate/20170523091700_add_rss_token_to_users.rb
+19
-0
db/schema.rb
db/schema.rb
+3
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+7
-0
No files found.
app/models/user.rb
View file @
3713a57f
...
...
@@ -15,6 +15,7 @@ class User < ActiveRecord::Base
add_authentication_token_field
:authentication_token
add_authentication_token_field
:incoming_email_token
add_authentication_token_field
:rss_token
default_value_for
:admin
,
false
default_value_for
(
:external
)
{
current_application_settings
.
user_default_external
}
...
...
@@ -152,7 +153,7 @@ class User < ActiveRecord::Base
before_validation
:set_public_email
,
if:
->
(
user
)
{
user
.
public_email_changed?
}
after_update
:update_emails_with_primary_email
,
if:
->
(
user
)
{
user
.
email_changed?
}
before_save
:ensure_authentication_token
,
:ensure_incoming_email_token
before_save
:ensure_authentication_token
,
:ensure_incoming_email_token
,
:ensure_rss_token
before_save
:ensure_external_user_rights
after_save
:ensure_namespace_correct
after_initialize
:set_projects_limit
...
...
config/application.rb
View file @
3713a57f
...
...
@@ -65,6 +65,7 @@ module Gitlab
hook
import_url
incoming_email_token
rss_token
key
otp_attempt
password
...
...
db/migrate/20170523091700_add_rss_token_to_users.rb
0 → 100644
View file @
3713a57f
class
AddRssTokenToUsers
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column
:users
,
:rss_token
,
:string
add_concurrent_index
:users
,
:rss_token
end
def
down
remove_concurrent_index
:users
,
:rss_token
if
index_exists?
:users
,
:rss_token
remove_column
:users
,
:rss_token
end
end
db/schema.rb
View file @
3713a57f
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2017052
1184006
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017052
3091700
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -1362,6 +1362,7 @@ ActiveRecord::Schema.define(version: 20170521184006) do
t
.
date
"last_activity_on"
t
.
boolean
"notified_of_own_activity"
t
.
string
"preferred_language"
t
.
string
"rss_token"
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
@@ -1375,6 +1376,7 @@ ActiveRecord::Schema.define(version: 20170521184006) do
add_index
"users"
,
[
"name"
],
name:
"index_users_on_name"
,
using: :btree
add_index
"users"
,
[
"name"
],
name:
"index_users_on_name_trigram"
,
using: :gin
,
opclasses:
{
"name"
=>
"gin_trgm_ops"
}
add_index
"users"
,
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
,
using: :btree
add_index
"users"
,
[
"rss_token"
],
name:
"index_users_on_rss_token"
,
using: :btree
add_index
"users"
,
[
"state"
],
name:
"index_users_on_state"
,
using: :btree
add_index
"users"
,
[
"username"
],
name:
"index_users_on_username"
,
using: :btree
add_index
"users"
,
[
"username"
],
name:
"index_users_on_username_trigram"
,
using: :gin
,
opclasses:
{
"username"
=>
"gin_trgm_ops"
}
...
...
spec/models/user_spec.rb
View file @
3713a57f
...
...
@@ -440,6 +440,13 @@ describe User, models: true do
end
end
describe
'rss token'
do
it
'has rss token'
do
user
=
create
(
:user
)
expect
(
user
.
rss_token
).
not_to
be_blank
end
end
describe
'#recently_sent_password_reset?'
do
it
'is false when reset_password_sent_at is nil'
do
user
=
build_stubbed
(
:user
,
reset_password_sent_at:
nil
)
...
...
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