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
54fb0f85
Commit
54fb0f85
authored
Dec 19, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'notification_refactoring'
parents
f09e1599
839aa735
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
265 additions
and
65 deletions
+265
-65
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+0
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+5
-0
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+1
-4
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+2
-22
app/mailers/notify.rb
app/mailers/notify.rb
+31
-0
app/models/issue.rb
app/models/issue.rb
+1
-0
app/models/mailer_observer.rb
app/models/mailer_observer.rb
+75
-0
app/models/merge_request.rb
app/models/merge_request.rb
+16
-0
app/models/note.rb
app/models/note.rb
+5
-0
app/models/project.rb
app/models/project.rb
+10
-9
app/models/users_project.rb
app/models/users_project.rb
+7
-8
app/views/notify/changed_issue_email.html.haml
app/views/notify/changed_issue_email.html.haml
+16
-0
app/views/notify/changed_merge_request_email.html.haml
app/views/notify/changed_merge_request_email.html.haml
+16
-0
app/views/notify/new_issue_email.html.haml
app/views/notify/new_issue_email.html.haml
+1
-1
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+20
-0
app/views/notify/note_merge_request_email.html.haml
app/views/notify/note_merge_request_email.html.haml
+23
-0
config/application.rb
config/application.rb
+1
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+1
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+16
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+10
-9
spec/models/users_project_spec.rb
spec/models/users_project_spec.rb
+7
-8
spec/requests/issues_spec.rb
spec/requests/issues_spec.rb
+1
-2
No files found.
app/controllers/admin/users_controller.rb
View file @
54fb0f85
...
@@ -27,7 +27,6 @@ class Admin::UsersController < ApplicationController
...
@@ -27,7 +27,6 @@ class Admin::UsersController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@admin_user
.
save
if
@admin_user
.
save
Notify
.
new_user_email
(
@admin_user
,
params
[
:user
][
:password
]).
deliver
format
.
html
{
redirect_to
[
:admin
,
@admin_user
],
notice:
'User was successfully created.'
}
format
.
html
{
redirect_to
[
:admin
,
@admin_user
],
notice:
'User was successfully created.'
}
format
.
json
{
render
json:
@admin_user
,
status: :created
,
location:
@admin_user
}
format
.
json
{
render
json:
@admin_user
,
status: :created
,
location:
@admin_user
}
else
else
...
...
app/controllers/application_controller.rb
View file @
54fb0f85
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
before_filter
:authenticate_user!
before_filter
:authenticate_user!
before_filter
:set_current_user_for_mailer
protect_from_forgery
protect_from_forgery
helper_method
:abilities
,
:can?
helper_method
:abilities
,
:can?
...
@@ -19,6 +20,10 @@ class ApplicationController < ActionController::Base
...
@@ -19,6 +20,10 @@ class ApplicationController < ActionController::Base
end
end
end
end
def
set_current_user_for_mailer
MailerObserver
.
current_user
=
current_user
end
def
abilities
def
abilities
@abilities
||=
Six
.
new
@abilities
||=
Six
.
new
end
end
...
...
app/controllers/issues_controller.rb
View file @
54fb0f85
...
@@ -67,10 +67,7 @@ class IssuesController < ApplicationController
...
@@ -67,10 +67,7 @@ class IssuesController < ApplicationController
def
create
def
create
@issue
=
@project
.
issues
.
new
(
params
[
:issue
])
@issue
=
@project
.
issues
.
new
(
params
[
:issue
])
@issue
.
author
=
current_user
@issue
.
author
=
current_user
@issue
.
save
if
@issue
.
save
&&
@issue
.
assignee
!=
current_user
Notify
.
new_issue_email
(
@issue
).
deliver
end
respond_with
(
@issue
)
respond_with
(
@issue
)
end
end
...
...
app/controllers/notes_controller.rb
View file @
54fb0f85
...
@@ -12,10 +12,8 @@ class NotesController < ApplicationController
...
@@ -12,10 +12,8 @@ class NotesController < ApplicationController
def
create
def
create
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
.
author
=
current_user
@note
.
author
=
current_user
@note
.
notify
=
true
if
params
[
:notify
]
==
'1'
if
@note
.
save
@note
.
save
notify
if
params
[
:notify
]
==
'1'
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
:back
}
format
.
html
{
redirect_to
:back
}
...
@@ -35,22 +33,4 @@ class NotesController < ApplicationController
...
@@ -35,22 +33,4 @@ class NotesController < ApplicationController
end
end
end
end
protected
def
notify
@project
.
users
.
reject
{
|
u
|
u
.
id
==
current_user
.
id
}
.
each
do
|
u
|
case
@note
.
noteable_type
when
"Commit"
then
Notify
.
note_commit_email
(
u
,
@note
).
deliver
when
"Issue"
then
Notify
.
note_issue_email
(
u
,
@note
).
deliver
when
"MergeRequest"
true
# someone should write email notification
when
"Snippet"
true
else
Notify
.
note_wall_email
(
u
,
@note
).
deliver
end
end
end
end
end
app/mailers/notify.rb
View file @
54fb0f85
...
@@ -30,6 +30,14 @@ class Notify < ActionMailer::Base
...
@@ -30,6 +30,14 @@ class Notify < ActionMailer::Base
@commit
=
@project
.
repo
.
commits
(
note
.
noteable_id
).
first
@commit
=
@project
.
repo
.
commits
(
note
.
noteable_id
).
first
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
end
end
def
note_merge_request_email
(
user
,
note
)
@user
=
user
@note
=
note
@project
=
note
.
project
@merge_request
=
note
.
noteable
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
end
def
note_issue_email
(
user
,
note
)
def
note_issue_email
(
user
,
note
)
@user
=
user
@user
=
user
...
@@ -38,4 +46,27 @@ class Notify < ActionMailer::Base
...
@@ -38,4 +46,27 @@ class Notify < ActionMailer::Base
@issue
=
note
.
noteable
@issue
=
note
.
noteable
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
end
end
def
new_merge_request_email
(
merge_request
)
@user
=
merge_request
.
assignee
@merge_request
=
merge_request
@project
=
merge_request
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@merge_request
.
title
}
"
)
end
def
changed_merge_request_email
(
user
,
merge_request
)
@user
=
user
@assignee_was
||=
User
.
find
(
merge_request
.
assignee_id_was
)
@merge_request
=
merge_request
@project
=
merge_request
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@merge_request
.
title
}
"
)
end
def
changed_issue_email
(
user
,
issue
)
@user
=
user
@assignee_was
||=
User
.
find
(
issue
.
assignee_id_was
)
@issue
=
issue
@project
=
issue
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@issue
.
title
}
"
)
end
end
end
app/models/issue.rb
View file @
54fb0f85
...
@@ -59,5 +59,6 @@ end
...
@@ -59,5 +59,6 @@ end
# closed :boolean default(FALSE), not null
# closed :boolean default(FALSE), not null
# position :integer default(0)
# position :integer default(0)
# critical :boolean default(FALSE), not null
# critical :boolean default(FALSE), not null
# branch_name :string(255)
#
#
app/models/mailer_observer.rb
0 → 100644
View file @
54fb0f85
class
MailerObserver
<
ActiveRecord
::
Observer
observe
:issue
,
:user
,
:note
,
:merge_request
cattr_accessor
:current_user
def
after_create
(
model
)
new_issue
(
model
)
if
model
.
kind_of?
(
Issue
)
new_user
(
model
)
if
model
.
kind_of?
(
User
)
new_note
(
model
)
if
model
.
kind_of?
(
Note
)
new_merge_request
(
model
)
if
model
.
kind_of?
(
MergeRequest
)
end
def
after_update
(
model
)
changed_merge_request
(
model
)
if
model
.
kind_of?
(
MergeRequest
)
changed_issue
(
model
)
if
model
.
kind_of?
(
Issue
)
end
protected
def
new_issue
(
issue
)
if
issue
.
assignee
!=
current_user
Notify
.
new_issue_email
(
issue
).
deliver
end
end
def
new_user
(
user
)
Notify
.
new_user_email
(
user
,
user
.
password
).
deliver
end
def
new_note
(
note
)
return
unless
note
.
notify
note
.
project
.
users
.
reject
{
|
u
|
u
.
id
==
current_user
.
id
}
.
each
do
|
u
|
case
note
.
noteable_type
when
"Commit"
then
Notify
.
note_commit_email
(
u
,
note
).
deliver
when
"Issue"
then
Notify
.
note_issue_email
(
u
,
note
).
deliver
when
"MergeRequest"
then
Notify
.
note_merge_request_email
(
u
,
note
).
deliver
when
"Snippet"
true
else
Notify
.
note_wall_email
(
u
,
note
).
deliver
end
end
end
def
new_merge_request
(
merge_request
)
if
merge_request
.
assignee
!=
current_user
Notify
.
new_merge_request_email
(
merge_request
).
deliver
end
end
def
changed_merge_request
(
merge_request
)
if
merge_request
.
assignee_id_changed?
recipients_ids
=
merge_request
.
assignee_id_was
,
merge_request
.
assignee_id
recipients_ids
.
delete
current_user
.
id
User
.
find
(
recipients_ids
).
each
do
|
user
|
Notify
.
changed_merge_request_email
(
user
,
merge_request
).
deliver
end
end
end
def
changed_issue
(
issue
)
if
issue
.
assignee_id_changed?
recipients_ids
=
issue
.
assignee_id_was
,
issue
.
assignee_id
recipients_ids
.
delete
current_user
.
id
User
.
find
(
recipients_ids
).
each
do
|
user
|
Notify
.
changed_issue_email
(
user
,
issue
).
deliver
end
end
end
end
app/models/merge_request.rb
View file @
54fb0f85
...
@@ -44,3 +44,19 @@ class MergeRequest < ActiveRecord::Base
...
@@ -44,3 +44,19 @@ class MergeRequest < ActiveRecord::Base
project
.
commit
(
source_branch
)
project
.
commit
(
source_branch
)
end
end
end
end
# == Schema Information
#
# Table name: merge_requests
#
# id :integer not null, primary key
# target_branch :string(255) not null
# source_branch :string(255) not null
# project_id :integer not null
# author_id :integer
# assignee_id :integer
# title :string(255)
# closed :boolean default(FALSE), not null
# created_at :datetime
# updated_at :datetime
#
app/models/note.rb
View file @
54fb0f85
...
@@ -13,6 +13,7 @@ class Note < ActiveRecord::Base
...
@@ -13,6 +13,7 @@ class Note < ActiveRecord::Base
:prefix
=>
true
:prefix
=>
true
attr_protected
:author
,
:author_id
attr_protected
:author
,
:author_id
attr_accessor
:notify
validates_presence_of
:project
validates_presence_of
:project
...
@@ -35,6 +36,10 @@ class Note < ActiveRecord::Base
...
@@ -35,6 +36,10 @@ class Note < ActiveRecord::Base
scope
:inc_author
,
includes
(
:author
)
scope
:inc_author
,
includes
(
:author
)
mount_uploader
:attachment
,
AttachmentUploader
mount_uploader
:attachment
,
AttachmentUploader
def
notify
@notify
||=
false
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
app/models/project.rb
View file @
54fb0f85
...
@@ -247,14 +247,15 @@ end
...
@@ -247,14 +247,15 @@ end
#
#
# Table name: projects
# Table name: projects
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# name :string(255)
# name :string(255)
# path :string(255)
# path :string(255)
# description :text
# description :text
# created_at :datetime
# created_at :datetime
# updated_at :datetime
# updated_at :datetime
# private_flag :boolean default(TRUE), not null
# private_flag :boolean default(TRUE), not null
# code :string(255)
# code :string(255)
# owner_id :integer
# owner_id :integer
# default_branch :string(255) default("master"), not null
#
#
app/models/users_project.rb
View file @
54fb0f85
...
@@ -23,13 +23,12 @@ end
...
@@ -23,13 +23,12 @@ end
#
#
# Table name: users_projects
# Table name: users_projects
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# user_id :integer not null
# user_id :integer not null
# project_id :integer not null
# project_id :integer not null
# read :boolean default(FALSE)
# created_at :datetime
# write :boolean default(FALSE)
# updated_at :datetime
# admin :boolean default(FALSE)
# repo_access :integer default(0), not null
# created_at :datetime
# project_access :integer default(0), not null
# updated_at :datetime
#
#
app/views/notify/changed_issue_email.html.haml
0 → 100644
View file @
54fb0f85
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Reassigned Issue
=
link_to
truncate
(
@issue
.
title
,
:length
=>
16
),
project_issue_url
(
@project
,
@issue
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Assignee changed from
#{
@assignee_was
.
name
}
to
#{
@issue
.
assignee
.
name
}
%td
app/views/notify/changed_merge_request_email.html.haml
0 → 100644
View file @
54fb0f85
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Reassigned Merge Request
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@project
,
@merge_request
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Assignee changed from
#{
@assignee_was
.
name
}
to
#{
@merge_request
.
assignee
.
name
}
%td
app/views/notify/new_issue_email.html.haml
View file @
54fb0f85
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Hi
#{
@user
.
name
}
!
New Issue was created and assigned to you.
New Issue was created and assigned to you.
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/new_merge_request_email.html.haml
0 → 100644
View file @
54fb0f85
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New Merge Request
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@project
,
@merge_request
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Branches:
#{
@merge_request
.
source_branch
}
→
#{
@merge_request
.
target_branch
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Asignee:
#{
@merge_request
.
author
.
name
}
→
#{
@merge_request
.
assignee
.
name
}
%td
app/views/notify/note_merge_request_email.html.haml
0 → 100644
View file @
54fb0f85
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New comment for Merge Request
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@project
,
@merge_request
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
%a
{
:href
=>
"#"
,
:style
=>
"color: #0eb6ce; text-decoration: none;"
}
#{
@note
.
author
.
name
}
left next message:
%br
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:width
=>
"558"
}
%tr
%td
{
:valign
=>
"top"
}
%cite
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
=
@note
.
note
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
config/application.rb
View file @
54fb0f85
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum
_observer
config
.
active_record
.
observers
=
:mailer
_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
...
...
spec/models/issue_spec.rb
View file @
54fb0f85
...
@@ -39,5 +39,6 @@ end
...
@@ -39,5 +39,6 @@ end
# closed :boolean default(FALSE), not null
# closed :boolean default(FALSE), not null
# position :integer default(0)
# position :integer default(0)
# critical :boolean default(FALSE), not null
# critical :boolean default(FALSE), not null
# branch_name :string(255)
#
#
spec/models/merge_request_spec.rb
View file @
54fb0f85
...
@@ -26,3 +26,19 @@ describe MergeRequest do
...
@@ -26,3 +26,19 @@ describe MergeRequest do
:assignee
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
),
:project
=>
Factory
.
create
(
:project
)).
should
be_valid
}
:project
=>
Factory
.
create
(
:project
)).
should
be_valid
}
end
end
# == Schema Information
#
# Table name: merge_requests
#
# id :integer not null, primary key
# target_branch :string(255) not null
# source_branch :string(255) not null
# project_id :integer not null
# author_id :integer
# assignee_id :integer
# title :string(255)
# closed :boolean default(FALSE), not null
# created_at :datetime
# updated_at :datetime
#
spec/models/project_spec.rb
View file @
54fb0f85
...
@@ -168,14 +168,15 @@ end
...
@@ -168,14 +168,15 @@ end
#
#
# Table name: projects
# Table name: projects
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# name :string(255)
# name :string(255)
# path :string(255)
# path :string(255)
# description :text
# description :text
# created_at :datetime
# created_at :datetime
# updated_at :datetime
# updated_at :datetime
# private_flag :boolean default(TRUE), not null
# private_flag :boolean default(TRUE), not null
# code :string(255)
# code :string(255)
# owner_id :integer
# owner_id :integer
# default_branch :string(255) default("master"), not null
#
#
spec/models/users_project_spec.rb
View file @
54fb0f85
...
@@ -20,13 +20,12 @@ end
...
@@ -20,13 +20,12 @@ end
#
#
# Table name: users_projects
# Table name: users_projects
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# user_id :integer not null
# user_id :integer not null
# project_id :integer not null
# project_id :integer not null
# read :boolean default(FALSE)
# created_at :datetime
# write :boolean default(FALSE)
# updated_at :datetime
# admin :boolean default(FALSE)
# repo_access :integer default(0), not null
# created_at :datetime
# project_access :integer default(0), not null
# updated_at :datetime
#
#
spec/requests/issues_spec.rb
View file @
54fb0f85
...
@@ -147,13 +147,12 @@ describe "Issues" do
...
@@ -147,13 +147,12 @@ describe "Issues" do
click_button
"Save"
click_button
"Save"
end
end
it
"should send valid email to user
with email & password
"
do
it
"should send valid email to user"
do
click_button
"Save"
click_button
"Save"
issue
=
Issue
.
last
issue
=
Issue
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
.
subject
.
should
have_content
(
"New Issue was created"
)
email
.
subject
.
should
have_content
(
"New Issue was created"
)
email
.
body
.
should
have_content
(
issue
.
title
)
email
.
body
.
should
have_content
(
issue
.
title
)
email
.
body
.
should
have_content
(
issue
.
assignee
.
name
)
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