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
Boxiang Sun
gitlab-ce
Commits
09ef69b7
Commit
09ef69b7
authored
Mar 16, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code folding fix
parent
9698b36c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
8 deletions
+19
-8
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+3
-3
app/models/subscribe.rb
app/models/subscribe.rb
+3
-0
app/services/notification_service.rb
app/services/notification_service.rb
+5
-5
db/migrate/20150313012111_create_subscribes_table.rb
db/migrate/20150313012111_create_subscribes_table.rb
+4
-0
db/schema.rb
db/schema.rb
+4
-0
No files found.
app/models/concerns/issuable.rb
View file @
09ef69b7
...
@@ -134,9 +134,9 @@ module Issuable
...
@@ -134,9 +134,9 @@ module Issuable
end
end
def
subscribe_status
(
user
)
def
subscribe_status
(
user
)
sub
=
subscribes
.
find_by_user_id
(
user
.
id
)
sub
scribe
=
subscribes
.
find_by_user_id
(
user
.
id
)
if
sub
if
sub
scribe
return
sub
.
subscribed
return
sub
scribe
.
subscribed
end
end
participants
.
include?
(
user
)
participants
.
include?
(
user
)
...
...
app/models/subscribe.rb
View file @
09ef69b7
class
Subscribe
<
ActiveRecord
::
Base
class
Subscribe
<
ActiveRecord
::
Base
belongs_to
:user
belongs_to
:user
validates
:issue_id
,
uniqueness:
{
scope: :user_id
,
allow_nil:
true
}
validates
:merge_request_id
,
uniqueness:
{
scope: :user_id
,
allow_nil:
true
}
end
end
app/services/notification_service.rb
View file @
09ef69b7
...
@@ -368,16 +368,16 @@ class NotificationService
...
@@ -368,16 +368,16 @@ class NotificationService
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
recipients
=
add_subscribers
(
recipients
,
project
)
recipients
=
add_subscribe
d_use
rs
(
recipients
,
project
)
recipients
=
recipients
.
concat
(
project_watchers
(
project
)).
uniq
recipients
=
recipients
.
concat
(
project_watchers
(
project
)).
uniq
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
recipients
end
end
def
add_subscribers
(
recipients
,
target
)
def
add_subscribe
d_use
rs
(
recipients
,
target
)
subs
=
target
.
subscribes
subs
cribes
=
target
.
subscribes
if
subs
.
any?
if
subs
cribes
.
any?
recipients
.
merge
(
subs
.
where
(
"subscribed is true"
).
map
(
&
:user
))
recipients
.
merge
(
subs
cribes
.
where
(
"subscribed is true"
).
map
(
&
:user
))
else
else
recipients
recipients
end
end
...
...
db/migrate/20150313012111_create_subscribes_table.rb
View file @
09ef69b7
...
@@ -8,5 +8,9 @@ class CreateSubscribesTable < ActiveRecord::Migration
...
@@ -8,5 +8,9 @@ class CreateSubscribesTable < ActiveRecord::Migration
t
.
timestamps
t
.
timestamps
end
end
add_index
:subscribes
,
:user_id
add_index
:subscribes
,
:issue_id
add_index
:subscribes
,
:merge_request_id
end
end
end
end
db/schema.rb
View file @
09ef69b7
...
@@ -406,6 +406,10 @@ ActiveRecord::Schema.define(version: 20150313012111) do
...
@@ -406,6 +406,10 @@ ActiveRecord::Schema.define(version: 20150313012111) do
t
.
datetime
"updated_at"
t
.
datetime
"updated_at"
end
end
add_index
"subscribes"
,
[
"issue_id"
],
name:
"index_subscribes_on_issue_id"
,
using: :btree
add_index
"subscribes"
,
[
"merge_request_id"
],
name:
"index_subscribes_on_merge_request_id"
,
using: :btree
add_index
"subscribes"
,
[
"user_id"
],
name:
"index_subscribes_on_user_id"
,
using: :btree
create_table
"taggings"
,
force:
true
do
|
t
|
create_table
"taggings"
,
force:
true
do
|
t
|
t
.
integer
"tag_id"
t
.
integer
"tag_id"
t
.
integer
"taggable_id"
t
.
integer
"taggable_id"
...
...
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