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
c8b92a4b
Commit
c8b92a4b
authored
Feb 14, 2013
by
Sebastian Ziebell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into fixes/api
parents
c305eb31
ed3f4408
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
201 additions
and
233 deletions
+201
-233
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+6
-2
app/models/event.rb
app/models/event.rb
+18
-18
app/models/merge_request.rb
app/models/merge_request.rb
+3
-3
app/models/project.rb
app/models/project.rb
+2
-2
app/models/user.rb
app/models/user.rb
+5
-1
app/observers/activity_observer.rb
app/observers/activity_observer.rb
+1
-1
app/observers/users_project_observer.rb
app/observers/users_project_observer.rb
+2
-2
app/views/admin/users/index.html.haml
app/views/admin/users/index.html.haml
+56
-52
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+76
-120
app/views/projects/_new_form.html.haml
app/views/projects/_new_form.html.haml
+1
-1
app/views/users/_profile.html.haml
app/views/users/_profile.html.haml
+9
-9
app/views/users/_projects.html.haml
app/views/users/_projects.html.haml
+2
-2
app/views/users/show.html.haml
app/views/users/show.html.haml
+2
-2
config/unicorn.rb.example
config/unicorn.rb.example
+1
-1
features/steps/dashboard/dashboard.rb
features/steps/dashboard/dashboard.rb
+2
-2
features/steps/dashboard/dashboard_event_filters.rb
features/steps/dashboard/dashboard_event_filters.rb
+3
-3
features/steps/shared/project.rb
features/steps/shared/project.rb
+1
-1
lib/event_filter.rb
lib/event_filter.rb
+5
-5
spec/factories.rb
spec/factories.rb
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+1
-1
spec/models/project_hooks_spec.rb
spec/models/project_hooks_spec.rb
+1
-1
spec/observers/activity_observer_spec.rb
spec/observers/activity_observer_spec.rb
+3
-3
No files found.
app/controllers/admin/users_controller.rb
View file @
c8b92a4b
...
@@ -9,8 +9,12 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -9,8 +9,12 @@ class Admin::UsersController < Admin::ApplicationController
end
end
def
show
def
show
@projects
=
Project
.
scoped
# Projects user can be added to
@projects
=
@projects
.
without_user
(
admin_user
)
if
admin_user
.
authorized_projects
.
present?
@not_in_projects
=
Project
.
scoped
@not_in_projects
=
@not_in_projects
.
without_user
(
admin_user
)
if
admin_user
.
authorized_projects
.
present?
# Projects he already own or joined
@projects
=
admin_user
.
authorized_projects
.
where
(
'projects.id in (?)'
,
admin_user
.
authorized_projects
.
map
(
&
:id
))
end
end
def
team_update
def
team_update
...
...
app/models/event.rb
View file @
c8b92a4b
...
@@ -20,15 +20,15 @@ class Event < ActiveRecord::Base
...
@@ -20,15 +20,15 @@ class Event < ActiveRecord::Base
default_scope
where
(
"author_id IS NOT NULL"
)
default_scope
where
(
"author_id IS NOT NULL"
)
C
reated
=
1
C
REATED
=
1
U
pdated
=
2
U
PDATED
=
2
C
losed
=
3
C
LOSED
=
3
R
eopened
=
4
R
EOPENED
=
4
P
ushed
=
5
P
USHED
=
5
C
ommented
=
6
C
OMMENTED
=
6
M
erged
=
7
M
ERGED
=
7
J
oined
=
8
# User joined project
J
OINED
=
8
# User joined project
L
eft
=
9
# User left project
L
EFT
=
9
# User left project
delegate
:name
,
:email
,
to: :author
,
prefix:
true
,
allow_nil:
true
delegate
:name
,
:email
,
to: :author
,
prefix:
true
,
allow_nil:
true
delegate
:title
,
to: :issue
,
prefix:
true
,
allow_nil:
true
delegate
:title
,
to: :issue
,
prefix:
true
,
allow_nil:
true
...
@@ -43,15 +43,15 @@ class Event < ActiveRecord::Base
...
@@ -43,15 +43,15 @@ class Event < ActiveRecord::Base
# Scopes
# Scopes
scope
:recent
,
->
{
order
(
"created_at DESC"
)
}
scope
:recent
,
->
{
order
(
"created_at DESC"
)
}
scope
:code_push
,
->
{
where
(
action:
P
ushed
)
}
scope
:code_push
,
->
{
where
(
action:
P
USHED
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
).
recent
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
).
recent
}
class
<<
self
class
<<
self
def
determine_action
(
record
)
def
determine_action
(
record
)
if
[
Issue
,
MergeRequest
].
include?
record
.
class
if
[
Issue
,
MergeRequest
].
include?
record
.
class
Event
::
C
reated
Event
::
C
REATED
elsif
record
.
kind_of?
Note
elsif
record
.
kind_of?
Note
Event
::
C
ommented
Event
::
C
OMMENTED
end
end
end
end
end
end
...
@@ -79,19 +79,19 @@ class Event < ActiveRecord::Base
...
@@ -79,19 +79,19 @@ class Event < ActiveRecord::Base
end
end
def
push?
def
push?
action
==
self
.
class
::
P
ushed
&&
valid_push?
action
==
self
.
class
::
P
USHED
&&
valid_push?
end
end
def
merged?
def
merged?
action
==
self
.
class
::
M
erged
action
==
self
.
class
::
M
ERGED
end
end
def
closed?
def
closed?
action
==
self
.
class
::
C
losed
action
==
self
.
class
::
C
LOSED
end
end
def
reopened?
def
reopened?
action
==
self
.
class
::
R
eopened
action
==
self
.
class
::
R
EOPENED
end
end
def
milestone?
def
milestone?
...
@@ -111,11 +111,11 @@ class Event < ActiveRecord::Base
...
@@ -111,11 +111,11 @@ class Event < ActiveRecord::Base
end
end
def
joined?
def
joined?
action
==
J
oined
action
==
J
OINED
end
end
def
left?
def
left?
action
==
L
eft
action
==
L
EFT
end
end
def
membership_changed?
def
membership_changed?
...
...
app/models/merge_request.rb
View file @
c8b92a4b
...
@@ -133,11 +133,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -133,11 +133,11 @@ class MergeRequest < ActiveRecord::Base
end
end
def
merge_event
def
merge_event
self
.
project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
M
erged
).
last
self
.
project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
M
ERGED
).
last
end
end
def
closed_event
def
closed_event
self
.
project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
C
losed
).
last
self
.
project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
C
LOSED
).
last
end
end
def
commits
def
commits
...
@@ -184,7 +184,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -184,7 +184,7 @@ class MergeRequest < ActiveRecord::Base
self
.
mark_as_merged!
self
.
mark_as_merged!
Event
.
create
(
Event
.
create
(
project:
self
.
project
,
project:
self
.
project
,
action:
Event
::
M
erged
,
action:
Event
::
M
ERGED
,
target_id:
self
.
id
,
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
target_type:
"MergeRequest"
,
author_id:
user_id
author_id:
user_id
...
...
app/models/project.rb
View file @
c8b92a4b
...
@@ -103,7 +103,7 @@ class Project < ActiveRecord::Base
...
@@ -103,7 +103,7 @@ class Project < ActiveRecord::Base
end
end
def
with_push
def
with_push
includes
(
:events
).
where
(
'events.action = ?'
,
Event
::
P
ushed
)
includes
(
:events
).
where
(
'events.action = ?'
,
Event
::
P
USHED
)
end
end
def
active
def
active
...
@@ -336,7 +336,7 @@ class Project < ActiveRecord::Base
...
@@ -336,7 +336,7 @@ class Project < ActiveRecord::Base
def
observe_push
(
data
)
def
observe_push
(
data
)
Event
.
create
(
Event
.
create
(
project:
self
,
project:
self
,
action:
Event
::
P
ushed
,
action:
Event
::
P
USHED
,
data:
data
,
data:
data
,
author_id:
data
[
:user_id
]
author_id:
data
[
:user_id
]
)
)
...
...
app/models/user.rb
View file @
c8b92a4b
...
@@ -138,7 +138,7 @@ class User < ActiveRecord::Base
...
@@ -138,7 +138,7 @@ class User < ActiveRecord::Base
end
end
def
search
query
def
search
query
where
(
"name LIKE :query
or email
LIKE :query"
,
query:
"%
#{
query
}
%"
)
where
(
"name LIKE :query
OR email LIKE :query OR username
LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
end
end
end
...
@@ -313,4 +313,8 @@ class User < ActiveRecord::Base
...
@@ -313,4 +313,8 @@ class User < ActiveRecord::Base
UserTeam
.
where
(
id:
ids
)
UserTeam
.
where
(
id:
ids
)
end
end
end
end
def
owned_teams
UserTeam
.
where
(
owner_id:
self
.
id
)
end
end
end
app/observers/activity_observer.rb
View file @
c8b92a4b
...
@@ -26,7 +26,7 @@ class ActivityObserver < ActiveRecord::Observer
...
@@ -26,7 +26,7 @@ class ActivityObserver < ActiveRecord::Observer
project:
record
.
project
,
project:
record
.
project
,
target_id:
record
.
id
,
target_id:
record
.
id
,
target_type:
record
.
class
.
name
,
target_type:
record
.
class
.
name
,
action:
(
record
.
closed
?
Event
::
C
losed
:
Event
::
Reopened
),
action:
(
record
.
closed
?
Event
::
C
LOSED
:
Event
::
REOPENED
),
author_id:
record
.
author_id_of_changes
author_id:
record
.
author_id_of_changes
)
)
end
end
...
...
app/observers/users_project_observer.rb
View file @
c8b92a4b
...
@@ -7,7 +7,7 @@ class UsersProjectObserver < ActiveRecord::Observer
...
@@ -7,7 +7,7 @@ class UsersProjectObserver < ActiveRecord::Observer
def
after_create
(
users_project
)
def
after_create
(
users_project
)
Event
.
create
(
Event
.
create
(
project_id:
users_project
.
project
.
id
,
project_id:
users_project
.
project
.
id
,
action:
Event
::
J
oined
,
action:
Event
::
J
OINED
,
author_id:
users_project
.
user
.
id
author_id:
users_project
.
user
.
id
)
)
end
end
...
@@ -15,7 +15,7 @@ class UsersProjectObserver < ActiveRecord::Observer
...
@@ -15,7 +15,7 @@ class UsersProjectObserver < ActiveRecord::Observer
def
after_destroy
(
users_project
)
def
after_destroy
(
users_project
)
Event
.
create
(
Event
.
create
(
project_id:
users_project
.
project
.
id
,
project_id:
users_project
.
project
.
id
,
action:
Event
::
L
eft
,
action:
Event
::
L
EFT
,
author_id:
users_project
.
user
.
id
author_id:
users_project
.
user
.
id
)
)
end
end
...
...
app/views/admin/users/index.html.haml
View file @
c8b92a4b
...
@@ -3,56 +3,60 @@
...
@@ -3,56 +3,60 @@
=
link_to
'New User'
,
new_admin_user_path
,
class:
"btn btn-small pull-right"
=
link_to
'New User'
,
new_admin_user_path
,
class:
"btn btn-small pull-right"
%br
%br
=
form_tag
admin_users_path
,
method: :get
,
class:
'form-inline'
do
.row
=
text_field_tag
:name
,
params
[
:name
],
class:
"xlarge"
.span3
=
submit_tag
"Search"
,
class:
"btn submit btn-primary"
.admin-filter
%ul
.nav.nav-tabs
=
form_tag
admin_users_path
,
method: :get
,
class:
'form-inline'
do
%li
{
class:
"#{'active' unless params[:filter]}"
}
=
search_field_tag
:name
,
params
[
:name
],
placeholder:
'Name, email or username'
,
class:
'search-text-input span2'
=
link_to
admin_users_path
do
=
button_tag
type:
'submit'
,
class:
'btn'
do
Active
%i
.icon-search
%span
.badge
=
User
.
active
.
count
%ul
.nav.nav-pills.nav-stacked
%li
{
class:
"#{'active' if params[:filter] == "
admins
"}"
}
%li
{
class:
"#{'active' unless params[:filter]}"
}
=
link_to
admin_users_path
(
filter:
"admins"
)
do
=
link_to
admin_users_path
do
Admins
Active
%span
.badge
=
User
.
admins
.
count
%small
.pull-right
=
User
.
active
.
count
%li
{
class:
"#{'active' if params[:filter] == "
blocked
"}"
}
%li
{
class:
"#{'active' if params[:filter] == "
admins
"}"
}
=
link_to
admin_users_path
(
filter:
"blocked"
)
do
=
link_to
admin_users_path
(
filter:
"admins"
)
do
Blocked
Admins
%span
.badge
=
User
.
blocked
.
count
%small
.pull-right
=
User
.
admins
.
count
%li
{
class:
"#{'active' if params[:filter] == "
wop
"}"
}
%li
{
class:
"#{'active' if params[:filter] == "
blocked
"}"
}
=
link_to
admin_users_path
(
filter:
"wop"
)
do
=
link_to
admin_users_path
(
filter:
"blocked"
)
do
Without projects
Blocked
%span
.badge
=
User
.
without_projects
.
count
%small
.pull-right
=
User
.
blocked
.
count
%li
{
class:
"#{'active' if params[:filter] == "
wop
"}"
}
=
link_to
admin_users_path
(
filter:
"wop"
)
do
Without projects
%small
.pull-right
=
User
.
without_projects
.
count
%hr
=
link_to
'Reset'
,
admin_users_path
,
class:
"btn btn-cancel"
%table
.span9
%thead
.ui-box
%tr
%h5
.title
%th
Admin
Users (
#{
@admin_users
.
total_count
}
)
%th
%ul
.well-list
Name
-
@admin_users
.
each
do
|
user
|
%i
.icon-sort-down
%li
%th
Username
-
if
user
.
blocked?
%th
Email
%i
.icon-lock.cred
%th
Projects
-
else
%th
Edit
%i
.icon-user.cgreen
%th
.cred
Danger Zone!
=
link_to
user
.
name
,
[
:admin
,
user
]
-
if
user
.
admin?
-
@admin_users
.
each
do
|
user
|
%strong
.cred
(Admin)
%tr
-
if
user
==
current_user
%td
=
check_box_tag
"admin"
,
1
,
user
.
admin
,
disabled: :disabled
%span
.cred
It's you!
%td
=
link_to
user
.
name
,
[
:admin
,
user
]
.pull-right
%td
=
user
.
username
%span
.light
%td
=
user
.
email
%i
.icon-envelope
%td
=
user
.
users_projects
.
count
=
mail_to
user
.
email
,
user
.
email
,
class:
'light'
%td
=
link_to
'Edit'
,
edit_admin_user_path
(
user
),
id:
"edit_
#{
dom_id
(
user
)
}
"
,
class:
"btn btn-small"
%td
.bgred
=
link_to
'Edit'
,
edit_admin_user_path
(
user
),
id:
"edit_
#{
dom_id
(
user
)
}
"
,
class:
"btn btn-small"
-
if
user
==
current_user
-
unless
user
==
current_user
%span
.cred
It's you!
-
if
user
.
blocked
-
else
=
link_to
'Unblock'
,
unblock_admin_user_path
(
user
),
method: :put
,
class:
"btn btn-small success"
-
if
user
.
blocked
-
else
=
link_to
'Unblock'
,
unblock_admin_user_path
(
user
),
method: :put
,
class:
"btn btn-small success"
=
link_to
'Block'
,
block_admin_user_path
(
user
),
confirm:
'USER WILL BE BLOCKED! Are you sure?'
,
method: :put
,
class:
"btn btn-small btn-remove"
-
else
=
link_to
'Destroy'
,
[
:admin
,
user
],
confirm:
"USER
#{
user
.
name
}
WILL BE REMOVED! Are you sure?"
,
method: :delete
,
class:
"btn btn-small btn-remove"
=
link_to
'Block'
,
block_admin_user_path
(
user
),
confirm:
'USER WILL BE BLOCKED! Are you sure?'
,
method: :put
,
class:
"btn btn-small btn-remove"
%li
.bottom
=
link_to
'Destroy'
,
[
:admin
,
user
],
confirm:
"USER
#{
user
.
name
}
WILL BE REMOVED! Are you sure?"
,
method: :delete
,
class:
"btn btn-small btn-remove"
=
paginate
@admin_users
,
theme:
"gitlab"
=
paginate
@admin_users
,
theme:
"admin"
app/views/admin/users/show.html.haml
View file @
c8b92a4b
%h3
.page_title
.row
User:
#{
@admin_user
.
name
}
.span6
-
if
@admin_user
.
blocked
%h3
.page_title
%small
Blocked
=
image_tag
gravatar_icon
(
@admin_user
.
email
,
90
),
class:
"avatar s90"
-
if
@admin_user
.
admin
=
@admin_user
.
name
%small
Administrator
-
if
@admin_user
.
blocked
=
link_to
edit_admin_user_path
(
@admin_user
),
class:
"btn pull-right"
do
%span
.cred
(Blocked)
%i
.icon-edit
-
if
@admin_user
.
admin
Edit
%span
.cred
(Admin)
.pull-right
%br
=
link_to
edit_admin_user_path
(
@admin_user
),
class:
"btn pull-right"
do
%i
.icon-edit
%table
.zebra-striped
Edit
%thead
%br
%tr
%small
@
#{
@admin_user
.
username
}
%th
Profile
%br
%th
%small
member since
#{
@admin_user
.
created_at
.
stamp
(
"Nov 12, 2031"
)
}
%tr
.clearfix
%td
%hr
%b
%h5
Email:
Add User to Projects
%td
%small
=
@admin_user
.
email
%tr
%td
%b
Username:
%td
=
@admin_user
.
username
%tr
%td
%b
Admin:
%td
=
check_box_tag
"admin"
,
1
,
@admin_user
.
admin
,
disabled: :disabled
%tr
%td
%b
Blocked:
%td
=
check_box_tag
"blocked"
,
1
,
@admin_user
.
blocked
,
disabled: :disabled
%tr
%td
%b
Created at:
%td
=
@admin_user
.
created_at
.
stamp
(
"March 1, 1999"
)
%tr
%td
%b
Projects limit:
%td
=
@admin_user
.
projects_limit
-
unless
@admin_user
.
skype
.
empty?
%tr
%td
%b
Skype:
%td
=
@admin_user
.
skype
-
unless
@admin_user
.
linkedin
.
empty?
%tr
%td
%b
Linkedin:
%td
=
@admin_user
.
linkedin
-
unless
@admin_user
.
twitter
.
empty?
%tr
%td
%b
Twitter:
%td
=
@admin_user
.
twitter
%br
%h5
Add User to Projects
%br
=
form_tag
team_update_admin_user_path
(
@admin_user
),
class:
"bulk_import"
,
method: :put
do
%table
%thead
%tr
%th
Projects
%th
Project Access:
%tr
%td
=
select_tag
:project_ids
,
options_from_collection_for_select
(
@projects
,
:id
,
:name_with_namespace
),
multiple:
true
,
data:
{
placeholder:
'Select projects'
},
class:
'chosen span5'
%td
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
class:
"project-access-select chosen span3"
%tr
%td
=
submit_tag
'Add'
,
class:
"btn btn-primary"
%td
Read more about project permissions
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
%br
%br
=
form_tag
team_update_admin_user_path
(
@admin_user
),
class:
"bulk_import"
,
method: :put
do
-
if
@admin_user
.
groups
.
present?
.control-group
%h5
Owner of groups:
=
label_tag
:project_ids
,
"Projects"
,
class:
'control-label'
%br
.controls
=
select_tag
:project_ids
,
options_from_collection_for_select
(
@not_in_projects
,
:id
,
:name_with_namespace
),
multiple:
true
,
data:
{
placeholder:
'Select projects'
},
class:
'chosen span3'
%table
.zebra-striped
.control-group
%thead
=
label_tag
:project_access
,
"Project Access"
,
class:
'control-label'
%tr
.controls
%th
Name
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
class:
"project-access-select chosen span3"
-
@admin_user
.
groups
.
each
do
|
group
|
.form-actions
%tr
=
submit_tag
'Add'
,
class:
"btn btn-create"
%td
=
link_to
group
.
name
,
admin_group_path
(
group
)
.pull-right
%br
-
if
@admin_user
.
owned_groups
.
present?
.ui-box
%h5
.title
Owned groups:
%ul
.well-list
-
@admin_user
.
groups
.
each
do
|
group
|
%li
%strong
=
link_to
group
.
name
,
admin_group_path
(
group
)
-
if
@admin_user
.
authorized_projects
.
present?
-
if
@admin_user
.
owned_teams
.
present?
%h5
Authorized Projects:
.ui-box
%br
%h5
.title
Owned teams:
%ul
.well-list
-
@admin_user
.
owned_teams
.
each
do
|
team
|
%li
%strong
=
link_to
team
.
name
,
admin_team_path
(
team
)
%table
.zebra-striped
%thead
%tr
%th
Name
%th
Project Access
%th
%th
-
@admin_user
.
tm_in_authorized_projects
.
each
do
|
tm
|
.span6
-
project
=
tm
.
project
=
render
'users/profile'
,
user:
@admin_user
%tr
.ui-box
%td
=
link_to
project
.
name_with_namespace
,
admin_project_path
(
project
)
%h5
.title
Projects (
#{
@projects
.
count
}
)
%td
=
tm
.
project_access_human
%ul
.well-list
%td
=
link_to
'Edit Access'
,
edit_admin_project_member_path
(
project
,
tm
.
user
),
class:
"btn btn-small"
-
@projects
.
each
do
|
project
|
%td
=
link_to
'Remove from team'
,
admin_project_member_path
(
project
,
tm
.
user
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove"
%li
=
link_to
admin_project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
project
.
namespace
=
project
.
namespace
.
human_name
\/
%strong
.well-title
=
truncate
(
project
.
name
,
length:
45
)
%span
.pull-right.light
-
if
project
.
owner
==
@admin_user
%i
.icon-wrench
-
tm
=
project
.
team
.
get_tm
(
@admin_user
.
id
)
-
if
tm
=
tm
.
project_access_human
=
link_to
edit_admin_project_member_path
(
project
,
tm
.
user
),
class:
"btn btn-small"
do
%i
.icon-edit
=
link_to
admin_project_member_path
(
project
,
tm
.
user
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove"
do
%i
.icon-remove
%p
.light
%i
.icon-wrench
–
user is a project owner
app/views/projects/_new_form.html.haml
View file @
c8b92a4b
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
=
f
.
label
:import_url
do
=
f
.
label
:import_url
do
%span
Import existing repo
%span
Import existing repo
.input
.input
=
f
.
text_field
:import_url
,
class:
'xlarge'
=
f
.
text_field
:import_url
,
class:
'xlarge'
,
placeholder:
'https://github.com/randx/six.git'
.light
.light
URL should be clonable
URL should be clonable
...
...
app/views/users/_profile.html.haml
View file @
c8b92a4b
...
@@ -4,20 +4,20 @@
...
@@ -4,20 +4,20 @@
%ul
.well-list
%ul
.well-list
%li
%li
%strong
Email
%strong
Email
%span
.pull-right
=
mail_to
@
user
.
email
%span
.pull-right
=
mail_to
user
.
email
-
unless
@
user
.
skype
.
blank?
-
unless
user
.
skype
.
blank?
%li
%li
%strong
Skype
%strong
Skype
%span
.pull-right
=
@
user
.
skype
%span
.pull-right
=
user
.
skype
-
unless
@
user
.
linkedin
.
blank?
-
unless
user
.
linkedin
.
blank?
%li
%li
%strong
LinkedIn
%strong
LinkedIn
%span
.pull-right
=
@
user
.
linkedin
%span
.pull-right
=
user
.
linkedin
-
unless
@
user
.
twitter
.
blank?
-
unless
user
.
twitter
.
blank?
%li
%li
%strong
Twitter
%strong
Twitter
%span
.pull-right
=
@
user
.
twitter
%span
.pull-right
=
user
.
twitter
-
unless
@
user
.
bio
.
blank?
-
unless
user
.
bio
.
blank?
%li
%li
%strong
Bio
%strong
Bio
%span
.pull-right
=
@
user
.
bio
%span
.pull-right
=
user
.
bio
app/views/users/_projects.html.haml
View file @
c8b92a4b
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
%strong
.well-title
%strong
.well-title
=
truncate
(
project
.
name
,
length:
45
)
=
truncate
(
project
.
name
,
length:
45
)
%span
.pull-right.light
%span
.pull-right.light
-
if
project
.
owner
==
@
user
-
if
project
.
owner
==
user
%i
.icon-wrench
%i
.icon-wrench
-
tm
=
project
.
team
.
get_tm
(
@
user
.
id
)
-
tm
=
project
.
team
.
get_tm
(
user
.
id
)
-
if
tm
-
if
tm
=
tm
.
project_access_human
=
tm
.
project_access_human
%p
.light
%p
.light
...
...
app/views/users/show.html.haml
View file @
c8b92a4b
...
@@ -17,5 +17,5 @@
...
@@ -17,5 +17,5 @@
%h5
Recent events
%h5
Recent events
=
render
@events
=
render
@events
.span4
.span4
=
render
'profile'
=
render
'profile'
,
user:
@user
=
render
'projects'
=
render
'projects'
,
user:
@user
config/unicorn.rb.example
View file @
c8b92a4b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# note that config/gitlab.yml web path should also be changed
# note that config/gitlab.yml web path should also be changed
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
app_dir =
"/home/git/gitlab/"
app_dir =
File.expand_path '../../', __FILE__
worker_processes 2
worker_processes 2
working_directory app_dir
working_directory app_dir
...
...
features/steps/dashboard/dashboard.rb
View file @
c8b92a4b
...
@@ -33,7 +33,7 @@ class Dashboard < Spinach::FeatureSteps
...
@@ -33,7 +33,7 @@ class Dashboard < Spinach::FeatureSteps
Event
.
create
(
Event
.
create
(
project:
project
,
project:
project
,
author_id:
user
.
id
,
author_id:
user
.
id
,
action:
Event
::
J
oined
action:
Event
::
J
OINED
)
)
end
end
...
@@ -47,7 +47,7 @@ class Dashboard < Spinach::FeatureSteps
...
@@ -47,7 +47,7 @@ class Dashboard < Spinach::FeatureSteps
Event
.
create
(
Event
.
create
(
project:
project
,
project:
project
,
author_id:
user
.
id
,
author_id:
user
.
id
,
action:
Event
::
L
eft
action:
Event
::
L
EFT
)
)
end
end
...
...
features/steps/dashboard/dashboard_event_filters.rb
View file @
c8b92a4b
...
@@ -45,7 +45,7 @@ class EventFilters < Spinach::FeatureSteps
...
@@ -45,7 +45,7 @@ class EventFilters < Spinach::FeatureSteps
@event
=
Event
.
create
(
@event
=
Event
.
create
(
project:
@project
,
project:
@project
,
action:
Event
::
P
ushed
,
action:
Event
::
P
USHED
,
data:
data
,
data:
data
,
author_id:
@user
.
id
author_id:
@user
.
id
)
)
...
@@ -56,7 +56,7 @@ class EventFilters < Spinach::FeatureSteps
...
@@ -56,7 +56,7 @@ class EventFilters < Spinach::FeatureSteps
Event
.
create
(
Event
.
create
(
project:
@project
,
project:
@project
,
author_id:
user
.
id
,
author_id:
user
.
id
,
action:
Event
::
J
oined
action:
Event
::
J
OINED
)
)
end
end
...
@@ -64,7 +64,7 @@ class EventFilters < Spinach::FeatureSteps
...
@@ -64,7 +64,7 @@ class EventFilters < Spinach::FeatureSteps
merge_request
=
create
:merge_request
,
author:
@user
,
project:
@project
merge_request
=
create
:merge_request
,
author:
@user
,
project:
@project
Event
.
create
(
Event
.
create
(
project:
@project
,
project:
@project
,
action:
Event
::
M
erged
,
action:
Event
::
M
ERGED
,
target_id:
merge_request
.
id
,
target_id:
merge_request
.
id
,
target_type:
"MergeRequest"
,
target_type:
"MergeRequest"
,
author_id:
@user
.
id
author_id:
@user
.
id
...
...
features/steps/shared/project.rb
View file @
c8b92a4b
...
@@ -33,7 +33,7 @@ module SharedProject
...
@@ -33,7 +33,7 @@ module SharedProject
@event
=
Event
.
create
(
@event
=
Event
.
create
(
project:
@project
,
project:
@project
,
action:
Event
::
P
ushed
,
action:
Event
::
P
USHED
,
data:
data
,
data:
data
,
author_id:
@user
.
id
author_id:
@user
.
id
)
)
...
...
lib/event_filter.rb
View file @
c8b92a4b
...
@@ -37,15 +37,15 @@ class EventFilter
...
@@ -37,15 +37,15 @@ class EventFilter
filter
=
params
.
dup
filter
=
params
.
dup
actions
=
[]
actions
=
[]
actions
<<
Event
::
P
ushed
if
filter
.
include?
'push'
actions
<<
Event
::
P
USHED
if
filter
.
include?
'push'
actions
<<
Event
::
M
erged
if
filter
.
include?
'merged'
actions
<<
Event
::
M
ERGED
if
filter
.
include?
'merged'
if
filter
.
include?
'team'
if
filter
.
include?
'team'
actions
<<
Event
::
J
oined
actions
<<
Event
::
J
OINED
actions
<<
Event
::
L
eft
actions
<<
Event
::
L
EFT
end
end
actions
<<
Event
::
C
ommented
if
filter
.
include?
'comments'
actions
<<
Event
::
C
OMMENTED
if
filter
.
include?
'comments'
events
=
events
.
where
(
action:
actions
)
events
=
events
.
where
(
action:
actions
)
end
end
...
...
spec/factories.rb
View file @
c8b92a4b
...
@@ -123,7 +123,7 @@ FactoryGirl.define do
...
@@ -123,7 +123,7 @@ FactoryGirl.define do
factory
:event
do
factory
:event
do
factory
:closed_issue_event
do
factory
:closed_issue_event
do
project
project
action
{
Event
::
C
losed
}
action
{
Event
::
C
LOSED
}
target
factory: :closed_issue
target
factory: :closed_issue
author
factory: :user
author
factory: :user
end
end
...
...
spec/models/event_spec.rb
View file @
c8b92a4b
...
@@ -52,7 +52,7 @@ describe Event do
...
@@ -52,7 +52,7 @@ describe Event do
@event
=
Event
.
create
(
@event
=
Event
.
create
(
project:
project
,
project:
project
,
action:
Event
::
P
ushed
,
action:
Event
::
P
USHED
,
data:
data
,
data:
data
,
author_id:
@user
.
id
author_id:
@user
.
id
)
)
...
...
spec/models/project_hooks_spec.rb
View file @
c8b92a4b
...
@@ -19,7 +19,7 @@ describe Project, "Hooks" do
...
@@ -19,7 +19,7 @@ describe Project, "Hooks" do
event
.
should_not
be_nil
event
.
should_not
be_nil
event
.
project
.
should
==
project
event
.
project
.
should
==
project
event
.
action
.
should
==
Event
::
P
ushed
event
.
action
.
should
==
Event
::
P
USHED
event
.
data
.
should
==
data
event
.
data
.
should
==
data
end
end
end
end
...
...
spec/observers/activity_observer_spec.rb
View file @
c8b92a4b
...
@@ -17,7 +17,7 @@ describe ActivityObserver do
...
@@ -17,7 +17,7 @@ describe ActivityObserver do
end
end
it_should_be_valid_event
it_should_be_valid_event
it
{
@event
.
action
.
should
==
Event
::
C
reated
}
it
{
@event
.
action
.
should
==
Event
::
C
REATED
}
it
{
@event
.
target
.
should
==
@merge_request
}
it
{
@event
.
target
.
should
==
@merge_request
}
end
end
...
@@ -30,7 +30,7 @@ describe ActivityObserver do
...
@@ -30,7 +30,7 @@ describe ActivityObserver do
end
end
it_should_be_valid_event
it_should_be_valid_event
it
{
@event
.
action
.
should
==
Event
::
C
reated
}
it
{
@event
.
action
.
should
==
Event
::
C
REATED
}
it
{
@event
.
target
.
should
==
@issue
}
it
{
@event
.
target
.
should
==
@issue
}
end
end
...
@@ -44,7 +44,7 @@ describe ActivityObserver do
...
@@ -44,7 +44,7 @@ describe ActivityObserver do
end
end
it_should_be_valid_event
it_should_be_valid_event
it
{
@event
.
action
.
should
==
Event
::
C
ommented
}
it
{
@event
.
action
.
should
==
Event
::
C
OMMENTED
}
it
{
@event
.
target
.
should
==
@note
}
it
{
@event
.
target
.
should
==
@note
}
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