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
25da1415
Commit
25da1415
authored
Jan 19, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jeromedalbert-add_website_url_to_user'
parents
d95e56f0
f8aae4b7
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
94 additions
and
9 deletions
+94
-9
CHANGELOG
CHANGELOG
+1
-0
app/models/user.rb
app/models/user.rb
+13
-2
app/views/admin/users/_form.html.haml
app/views/admin/users/_form.html.haml
+3
-0
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+3
-0
app/views/users/_profile.html.haml
app/views/users/_profile.html.haml
+4
-0
db/migrate/20140116231608_add_website_url_to_users.rb
db/migrate/20140116231608_add_website_url_to_users.rb
+5
-0
db/schema.rb
db/schema.rb
+2
-1
doc/api/session.md
doc/api/session.md
+1
-0
doc/api/users.md
doc/api/users.md
+6
-0
features/profile/profile.feature
features/profile/profile.feature
+2
-2
features/steps/profile/profile.rb
features/steps/profile/profile.rb
+4
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/users.rb
lib/api/users.rb
+3
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+46
-0
No files found.
CHANGELOG
View file @
25da1415
...
@@ -17,6 +17,7 @@ v 6.5.0
...
@@ -17,6 +17,7 @@ v 6.5.0
- Fix 500 error for rdoc files
- Fix 500 error for rdoc files
- Ability to customize merge commit message (sponsored by Say Media)
- Ability to customize merge commit message (sponsored by Say Media)
- Search autocomplete via ajax
- Search autocomplete via ajax
- Add website url to user profile
v6.4.3
v6.4.3
- Don't use unicorn worker killer if PhusionPassenger is defined
- Don't use unicorn worker killer if PhusionPassenger is defined
...
...
app/models/user.rb
View file @
25da1415
...
@@ -41,7 +41,8 @@
...
@@ -41,7 +41,8 @@
# confirmed_at :datetime
# confirmed_at :datetime
# confirmation_sent_at :datetime
# confirmation_sent_at :datetime
# unconfirmed_email :string(255)
# unconfirmed_email :string(255)
# hide_no_ssh_key :boolean default(FALSE), not null
# hide_no_ssh_key :boolean default(FALSE)
# website_url :string(255) default(""), not null
#
#
require
'carrierwave/orm/activerecord'
require
'carrierwave/orm/activerecord'
...
@@ -52,7 +53,7 @@ class User < ActiveRecord::Base
...
@@ -52,7 +53,7 @@ class User < ActiveRecord::Base
:recoverable
,
:rememberable
,
:trackable
,
:validatable
,
:omniauthable
,
:confirmable
,
:registerable
:recoverable
,
:rememberable
,
:trackable
,
:validatable
,
:omniauthable
,
:confirmable
,
:registerable
attr_accessible
:email
,
:password
,
:password_confirmation
,
:remember_me
,
:bio
,
:name
,
:username
,
attr_accessible
:email
,
:password
,
:password_confirmation
,
:remember_me
,
:bio
,
:name
,
:username
,
:skype
,
:linkedin
,
:twitter
,
:color_scheme_id
,
:theme_id
,
:force_random_password
,
:skype
,
:linkedin
,
:twitter
,
:
website_url
,
:
color_scheme_id
,
:theme_id
,
:force_random_password
,
:extern_uid
,
:provider
,
:password_expires_at
,
:avatar
,
:hide_no_ssh_key
,
:extern_uid
,
:provider
,
:password_expires_at
,
:avatar
,
:hide_no_ssh_key
,
as:
[
:default
,
:admin
]
as:
[
:default
,
:admin
]
...
@@ -424,4 +425,14 @@ class User < ActiveRecord::Base
...
@@ -424,4 +425,14 @@ class User < ActiveRecord::Base
order
(
'id DESC'
).
limit
(
1000
).
order
(
'id DESC'
).
limit
(
1000
).
update_all
(
updated_at:
Time
.
now
)
update_all
(
updated_at:
Time
.
now
)
end
end
def
full_website_url
return
"http://
#{
website_url
}
"
if
website_url
!~
/^https?:\/\//
website_url
end
def
short_website_url
website_url
.
gsub
(
/https?:\/\//
,
''
)
end
end
end
app/views/admin/users/_form.html.haml
View file @
25da1415
...
@@ -80,6 +80,9 @@
...
@@ -80,6 +80,9 @@
.form-group
.form-group
=
f
.
label
:twitter
,
class:
'control-label'
=
f
.
label
:twitter
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:twitter
,
class:
'form-control'
.col-sm-10
=
f
.
text_field
:twitter
,
class:
'form-control'
.form-group
=
f
.
label
:website_url
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:website_url
,
class:
'form-control'
.form-actions
.form-actions
-
if
@user
.
new_record?
-
if
@user
.
new_record?
...
...
app/views/profiles/show.html.haml
View file @
25da1415
...
@@ -46,6 +46,9 @@
...
@@ -46,6 +46,9 @@
.form-group
.form-group
=
f
.
label
:twitter
,
class:
"control-label"
=
f
.
label
:twitter
,
class:
"control-label"
.col-sm-10
=
f
.
text_field
:twitter
,
class:
"form-control"
.col-sm-10
=
f
.
text_field
:twitter
,
class:
"form-control"
.form-group
=
f
.
label
:website_url
,
class:
"control-label"
.col-sm-10
=
f
.
text_field
:website_url
,
class:
"form-control"
.form-group
.form-group
=
f
.
label
:bio
,
class:
"control-label"
=
f
.
label
:bio
,
class:
"control-label"
.col-sm-10
.col-sm-10
...
...
app/views/users/_profile.html.haml
View file @
25da1415
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
%li
%li
%span
.light
Twitter:
%span
.light
Twitter:
%strong
=
link_to
user
.
twitter
,
"http://www.twitter.com/
#{
user
.
twitter
}
"
%strong
=
link_to
user
.
twitter
,
"http://www.twitter.com/
#{
user
.
twitter
}
"
-
unless
user
.
website_url
.
blank?
%li
%span
.light
Website url:
%strong
=
link_to
user
.
short_website_url
,
user
.
full_website_url
-
unless
user
.
bio
.
blank?
-
unless
user
.
bio
.
blank?
%li
%li
%span
.light
Bio:
%span
.light
Bio:
...
...
db/migrate/20140116231608_add_website_url_to_users.rb
0 → 100644
View file @
25da1415
class
AddWebsiteUrlToUsers
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:website_url
,
:string
,
{
:null
=>
false
,
:default
=>
''
}
end
end
db/schema.rb
View file @
25da1415
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201
31217102743
)
do
ActiveRecord
::
Schema
.
define
(
version:
201
40116231608
)
do
create_table
"broadcast_messages"
,
force:
true
do
|
t
|
create_table
"broadcast_messages"
,
force:
true
do
|
t
|
t
.
text
"message"
,
null:
false
t
.
text
"message"
,
null:
false
...
@@ -301,6 +301,7 @@ ActiveRecord::Schema.define(version: 20131217102743) do
...
@@ -301,6 +301,7 @@ ActiveRecord::Schema.define(version: 20131217102743) do
t
.
datetime
"confirmation_sent_at"
t
.
datetime
"confirmation_sent_at"
t
.
string
"unconfirmed_email"
t
.
string
"unconfirmed_email"
t
.
boolean
"hide_no_ssh_key"
,
default:
false
t
.
boolean
"hide_no_ssh_key"
,
default:
false
t
.
string
"website_url"
,
default:
""
,
null:
false
end
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
doc/api/session.md
View file @
25da1415
...
@@ -26,6 +26,7 @@ __You can login with both GitLab and LDAP credentials now__
...
@@ -26,6 +26,7 @@ __You can login with both GitLab and LDAP credentials now__
"skype"
:
""
,
"skype"
:
""
,
"linkedin"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
,
"dark_scheme"
:
false
,
"dark_scheme"
:
false
,
"theme_id"
:
1
,
"theme_id"
:
1
,
"is_admin"
:
false
,
"is_admin"
:
false
,
...
...
doc/api/users.md
View file @
25da1415
...
@@ -20,6 +20,7 @@ GET /users
...
@@ -20,6 +20,7 @@ GET /users
"skype"
:
""
,
"skype"
:
""
,
"linkedin"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
,
"extern_uid"
:
"john.smith"
,
"extern_uid"
:
"john.smith"
,
"provider"
:
"provider_name"
,
"provider"
:
"provider_name"
,
"theme_id"
:
1
,
"theme_id"
:
1
,
...
@@ -38,6 +39,7 @@ GET /users
...
@@ -38,6 +39,7 @@ GET /users
"skype"
:
""
,
"skype"
:
""
,
"linkedin"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
,
"extern_uid"
:
"jack.smith"
,
"extern_uid"
:
"jack.smith"
,
"provider"
:
"provider_name"
,
"provider"
:
"provider_name"
,
"theme_id"
:
1
,
"theme_id"
:
1
,
...
@@ -74,6 +76,7 @@ Parameters:
...
@@ -74,6 +76,7 @@ Parameters:
"skype"
:
""
,
"skype"
:
""
,
"linkedin"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
,
"extern_uid"
:
"john.smith"
,
"extern_uid"
:
"john.smith"
,
"provider"
:
"provider_name"
,
"provider"
:
"provider_name"
,
"theme_id"
:
1
,
"theme_id"
:
1
,
...
@@ -102,6 +105,7 @@ Parameters:
...
@@ -102,6 +105,7 @@ Parameters:
+
`skype`
(optional) - Skype ID
+
`skype`
(optional) - Skype ID
+
`linkedin`
(optional) - Linkedin
+
`linkedin`
(optional) - Linkedin
+
`twitter`
(optional) - Twitter account
+
`twitter`
(optional) - Twitter account
+
`website_url`
(optional) - Website url
+
`projects_limit`
(optional) - Number of projects user can create
+
`projects_limit`
(optional) - Number of projects user can create
+
`extern_uid`
(optional) - External UID
+
`extern_uid`
(optional) - External UID
+
`provider`
(optional) - External provider name
+
`provider`
(optional) - External provider name
...
@@ -127,6 +131,7 @@ Parameters:
...
@@ -127,6 +131,7 @@ Parameters:
+
`skype`
- Skype ID
+
`skype`
- Skype ID
+
`linkedin`
- Linkedin
+
`linkedin`
- Linkedin
+
`twitter`
- Twitter account
+
`twitter`
- Twitter account
+
`website_url`
- Website url
+
`projects_limit`
- Limit projects each user can create
+
`projects_limit`
- Limit projects each user can create
+
`extern_uid`
- External UID
+
`extern_uid`
- External UID
+
`provider`
- External provider name
+
`provider`
- External provider name
...
@@ -174,6 +179,7 @@ GET /user
...
@@ -174,6 +179,7 @@ GET /user
"skype"
:
""
,
"skype"
:
""
,
"linkedin"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
,
"theme_id"
:
1
,
"theme_id"
:
1
,
"color_scheme_id"
:
2
,
"color_scheme_id"
:
2
,
"is_admin"
:
false
,
"is_admin"
:
false
,
...
...
features/profile/profile.feature
View file @
25da1415
...
@@ -8,8 +8,8 @@ Feature: Profile
...
@@ -8,8 +8,8 @@ Feature: Profile
Scenario
:
I
edit profile
Scenario
:
I
edit profile
Given
I visit profile page
Given
I visit profile page
Then
I change my
contact
info
Then
I change my
profile
info
And
I should see new
contact
info
And
I should see new
profile
info
Scenario
:
I
change my password without old one
Scenario
:
I
change my password without old one
Given
I visit profile password page
Given
I visit profile password page
...
...
features/steps/profile/profile.rb
View file @
25da1415
...
@@ -6,18 +6,20 @@ class Profile < Spinach::FeatureSteps
...
@@ -6,18 +6,20 @@ class Profile < Spinach::FeatureSteps
page
.
should
have_content
"Profile settings"
page
.
should
have_content
"Profile settings"
end
end
step
'I change my
contact
info'
do
step
'I change my
profile
info'
do
fill_in
"user_skype"
,
with:
"testskype"
fill_in
"user_skype"
,
with:
"testskype"
fill_in
"user_linkedin"
,
with:
"testlinkedin"
fill_in
"user_linkedin"
,
with:
"testlinkedin"
fill_in
"user_twitter"
,
with:
"testtwitter"
fill_in
"user_twitter"
,
with:
"testtwitter"
fill_in
"user_website_url"
,
with:
"testurl"
click_button
"Save changes"
click_button
"Save changes"
@user
.
reload
@user
.
reload
end
end
step
'I should see new
contact
info'
do
step
'I should see new
profile
info'
do
@user
.
skype
.
should
==
'testskype'
@user
.
skype
.
should
==
'testskype'
@user
.
linkedin
.
should
==
'testlinkedin'
@user
.
linkedin
.
should
==
'testlinkedin'
@user
.
twitter
.
should
==
'testtwitter'
@user
.
twitter
.
should
==
'testtwitter'
@user
.
website_url
.
should
==
'testurl'
end
end
step
'I change my avatar'
do
step
'I change my avatar'
do
...
...
lib/api/entities.rb
View file @
25da1415
module
API
module
API
module
Entities
module
Entities
class
User
<
Grape
::
Entity
class
User
<
Grape
::
Entity
expose
:id
,
:username
,
:email
,
:name
,
:bio
,
:skype
,
:linkedin
,
:twitter
,
expose
:id
,
:username
,
:email
,
:name
,
:bio
,
:skype
,
:linkedin
,
:twitter
,
:website_url
,
:theme_id
,
:color_scheme_id
,
:state
,
:created_at
,
:extern_uid
,
:provider
:theme_id
,
:color_scheme_id
,
:state
,
:created_at
,
:extern_uid
,
:provider
expose
:is_admin?
,
as: :is_admin
expose
:is_admin?
,
as: :is_admin
expose
:can_create_group?
,
as: :can_create_group
expose
:can_create_group?
,
as: :can_create_group
...
...
lib/api/users.rb
View file @
25da1415
...
@@ -36,6 +36,7 @@ module API
...
@@ -36,6 +36,7 @@ module API
# skype - Skype ID
# skype - Skype ID
# linkedin - Linkedin
# linkedin - Linkedin
# twitter - Twitter account
# twitter - Twitter account
# website_url - Website url
# projects_limit - Number of projects user can create
# projects_limit - Number of projects user can create
# extern_uid - External authentication provider UID
# extern_uid - External authentication provider UID
# provider - External provider
# provider - External provider
...
@@ -67,6 +68,7 @@ module API
...
@@ -67,6 +68,7 @@ module API
# skype - Skype ID
# skype - Skype ID
# linkedin - Linkedin
# linkedin - Linkedin
# twitter - Twitter account
# twitter - Twitter account
# website_url - Website url
# projects_limit - Limit projects each user can create
# projects_limit - Limit projects each user can create
# extern_uid - External authentication provider UID
# extern_uid - External authentication provider UID
# provider - External provider
# provider - External provider
...
@@ -78,7 +80,7 @@ module API
...
@@ -78,7 +80,7 @@ module API
put
":id"
do
put
":id"
do
authenticated_as_admin!
authenticated_as_admin!
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:projects_limit
,
:username
,
:extern_uid
,
:provider
,
:bio
,
:can_create_group
,
:admin
]
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:
website_url
,
:
projects_limit
,
:username
,
:extern_uid
,
:provider
,
:bio
,
:can_create_group
,
:admin
]
user
=
User
.
find
(
params
[
:id
])
user
=
User
.
find
(
params
[
:id
])
not_found!
(
"User not found"
)
unless
user
not_found!
(
"User not found"
)
unless
user
...
...
spec/models/user_spec.rb
View file @
25da1415
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
# confirmed_at :datetime
# confirmed_at :datetime
# confirmation_sent_at :datetime
# confirmation_sent_at :datetime
# unconfirmed_email :string(255)
# unconfirmed_email :string(255)
# hide_no_ssh_key :boolean default(FALSE)
# website_url :string(255) default(""), not null
#
#
require
'spec_helper'
require
'spec_helper'
...
@@ -293,4 +295,48 @@ describe User do
...
@@ -293,4 +295,48 @@ describe User do
user
.
avatar_type
.
should
==
[
"only images allowed"
]
user
.
avatar_type
.
should
==
[
"only images allowed"
]
end
end
end
end
describe
'#full_website_url'
do
let
(
:user
)
{
create
(
:user
)
}
it
'begins with http if website url omits it'
do
user
.
website_url
=
'test.com'
expect
(
user
.
full_website_url
).
to
eq
'http://test.com'
end
it
'begins with http if website url begins with http'
do
user
.
website_url
=
'http://test.com'
expect
(
user
.
full_website_url
).
to
eq
'http://test.com'
end
it
'begins with https if website url begins with https'
do
user
.
website_url
=
'https://test.com'
expect
(
user
.
full_website_url
).
to
eq
'https://test.com'
end
end
describe
'#short_website_url'
do
let
(
:user
)
{
create
(
:user
)
}
it
'does not begin with http if website url omits it'
do
user
.
website_url
=
'test.com'
expect
(
user
.
short_website_url
).
to
eq
'test.com'
end
it
'does not begin with http if website url begins with http'
do
user
.
website_url
=
'http://test.com'
expect
(
user
.
short_website_url
).
to
eq
'test.com'
end
it
'does not begin with https if website url begins with https'
do
user
.
website_url
=
'https://test.com'
expect
(
user
.
short_website_url
).
to
eq
'test.com'
end
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