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
759fb518
Commit
759fb518
authored
Sep 14, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix event issue when event for left project + project removed
parent
dc37c8aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
app/models/event.rb
app/models/event.rb
+22
-14
app/views/events/_event_membership_changed.html.haml
app/views/events/_event_membership_changed.html.haml
+1
-1
No files found.
app/models/event.rb
View file @
759fb518
...
@@ -35,13 +35,21 @@ class Event < ActiveRecord::Base
...
@@ -35,13 +35,21 @@ class Event < ActiveRecord::Base
end
end
# Next events currently enabled for system
# Next events currently enabled for system
# - push
# - push
# - new issue
# - new issue
# - merge request
# - merge request
def
allowed?
def
allowed?
push?
||
issue?
||
merge_request?
||
membership_changed?
push?
||
issue?
||
merge_request?
||
membership_changed?
end
end
def
project_name
if
project
project
.
name
else
"(deleted)"
end
end
def
push?
def
push?
action
==
self
.
class
::
Pushed
&&
valid_push?
action
==
self
.
class
::
Pushed
&&
valid_push?
end
end
...
@@ -58,31 +66,31 @@ class Event < ActiveRecord::Base
...
@@ -58,31 +66,31 @@ class Event < ActiveRecord::Base
action
==
self
.
class
::
Reopened
action
==
self
.
class
::
Reopened
end
end
def
issue?
def
issue?
target_type
==
"Issue"
target_type
==
"Issue"
end
end
def
merge_request?
def
merge_request?
target_type
==
"MergeRequest"
target_type
==
"MergeRequest"
end
end
def
new_issue?
def
new_issue?
target_type
==
"Issue"
&&
target_type
==
"Issue"
&&
action
==
Created
action
==
Created
end
end
def
new_merge_request?
def
new_merge_request?
target_type
==
"MergeRequest"
&&
target_type
==
"MergeRequest"
&&
action
==
Created
action
==
Created
end
end
def
changed_merge_request?
def
changed_merge_request?
target_type
==
"MergeRequest"
&&
target_type
==
"MergeRequest"
&&
[
Closed
,
Reopened
].
include?
(
action
)
[
Closed
,
Reopened
].
include?
(
action
)
end
end
def
changed_issue?
def
changed_issue?
target_type
==
"Issue"
&&
target_type
==
"Issue"
&&
[
Closed
,
Reopened
].
include?
(
action
)
[
Closed
,
Reopened
].
include?
(
action
)
end
end
...
@@ -98,7 +106,7 @@ class Event < ActiveRecord::Base
...
@@ -98,7 +106,7 @@ class Event < ActiveRecord::Base
joined?
||
left?
joined?
||
left?
end
end
def
issue
def
issue
target
if
target_type
==
"Issue"
target
if
target_type
==
"Issue"
end
end
...
@@ -106,7 +114,7 @@ class Event < ActiveRecord::Base
...
@@ -106,7 +114,7 @@ class Event < ActiveRecord::Base
target
if
target_type
==
"MergeRequest"
target
if
target_type
==
"MergeRequest"
end
end
def
author
def
author
@author
||=
User
.
find
(
author_id
)
@author
||=
User
.
find
(
author_id
)
end
end
...
@@ -119,7 +127,7 @@ class Event < ActiveRecord::Base
...
@@ -119,7 +127,7 @@ class Event < ActiveRecord::Base
'joined'
'joined'
elsif
left?
elsif
left?
'left'
'left'
else
else
"opened"
"opened"
end
end
end
end
...
...
app/views/events/_event_membership_changed.html.haml
View file @
759fb518
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%strong
#{
event
.
author_name
}
%strong
#{
event
.
author_name
}
%span
.event_label
{
class:
event
.
action_name
}=
event
.
action_name
%span
.event_label
{
class:
event
.
action_name
}=
event
.
action_name
project
project
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%strong
=
link_to
event
.
project
_
name
,
event
.
project
%span
.cgray
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
=
time_ago_in_words
(
event
.
created_at
)
ago.
ago.
...
...
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