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