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
f5f0ed55
Commit
f5f0ed55
authored
May 18, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
307a6ba5
f9319042
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
140 additions
and
35 deletions
+140
-35
CHANGELOG
CHANGELOG
+2
-2
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+2
-2
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+1
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+9
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+9
-1
app/models/concerns/participable.rb
app/models/concerns/participable.rb
+14
-6
app/services/notification_service.rb
app/services/notification_service.rb
+15
-8
app/views/shared/_visibility_radios.html.haml
app/views/shared/_visibility_radios.html.haml
+1
-1
app/views/shared/snippets/_form.html.haml
app/views/shared/snippets/_form.html.haml
+1
-1
db/migrate/20150406133311_add_invite_data_to_member.rb
db/migrate/20150406133311_add_invite_data_to_member.rb
+12
-1
db/migrate/20150417122318_remove_import_data_from_project.rb
db/migrate/20150417122318_remove_import_data_from_project.rb
+5
-1
db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb
...5173433_add_default_snippet_visibility_to_app_settings.rb
+5
-1
docker/single/Dockerfile
docker/single/Dockerfile
+1
-0
docker/single/assets/gitlab.rb
docker/single/assets/gitlab.rb
+37
-0
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+14
-2
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+1
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+10
-5
No files found.
CHANGELOG
View file @
f5f0ed55
...
...
@@ -45,8 +45,8 @@ v 7.11.0 (unreleased)
- Fix bug where avatar filenames were not actually deleted from the database during removal (Stan Hu)
- Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu)
- Protect OmniAuth request phase against CSRF.
-
-
-
Don't send notifications to mentioned users that don't have access to the project in question.
-
Add search issues/MR by number
- Move snippets UI to fluid layout
- Improve UI for sidebar. Increase separation between navigation and content
- Improve new project command options (Ben Bodenmiller)
...
...
app/assets/javascripts/application.js.coffee
View file @
f5f0ed55
...
...
@@ -140,8 +140,8 @@ $ ->
# Place the logo tooltip on the right when collapsed, bottom when expanded
$el
.
parents
(
'header'
).
hasClass
(
'header-collapsed'
)
and
'right'
or
'bottom'
else
# Otherwise use the data-placement attribute
like normal
$el
.
data
(
'placement'
)
# Otherwise use the data-placement attribute
, or 'bottom' if undefined
$el
.
data
(
'placement'
)
or
'bottom'
})
# Form submitter
...
...
app/assets/stylesheets/pages/projects.scss
View file @
f5f0ed55
...
...
@@ -129,7 +129,7 @@
}
.option-descr
{
margin-left
:
24
px
;
margin-left
:
36
px
;
color
:
$gray
;
}
}
...
...
app/controllers/projects/issues_controller.rb
View file @
f5f0ed55
...
...
@@ -19,7 +19,15 @@ class Projects::IssuesController < Projects::ApplicationController
def
index
terms
=
params
[
'issue_search'
]
@issues
=
get_issues_collection
@issues
=
@issues
.
full_search
(
terms
)
if
terms
.
present?
if
terms
.
present?
if
terms
=~
/\A#(\d+)\z/
@issues
=
@issues
.
where
(
iid:
$1
)
else
@issues
=
@issues
.
full_search
(
terms
)
end
end
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
f5f0ed55
...
...
@@ -19,7 +19,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
index
terms
=
params
[
'issue_search'
]
@merge_requests
=
get_merge_requests_collection
@merge_requests
=
@merge_requests
.
full_search
(
terms
)
if
terms
.
present?
if
terms
.
present?
if
terms
=~
/\A[#!](\d+)\z/
@merge_requests
=
@merge_requests
.
where
(
iid:
$1
)
else
@merge_requests
=
@merge_requests
.
full_search
(
terms
)
end
end
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
...
...
app/models/concerns/participable.rb
View file @
f5f0ed55
...
...
@@ -35,8 +35,8 @@ module Participable
end
end
def
participants
(
current_user
=
self
.
author
)
self
.
class
.
participant_attrs
.
flat_map
do
|
attr
|
def
participants
(
current_user
=
self
.
author
,
project
=
self
.
project
)
participants
=
self
.
class
.
participant_attrs
.
flat_map
do
|
attr
|
meth
=
method
(
attr
)
value
=
...
...
@@ -46,20 +46,28 @@ module Participable
meth
.
call
end
participants_for
(
value
,
current_user
)
participants_for
(
value
,
current_user
,
project
)
end
.
compact
.
uniq
if
project
participants
.
select!
do
|
user
|
user
.
can?
(
:read_project
,
project
)
end
end
participants
end
private
def
participants_for
(
value
,
current_user
=
nil
)
def
participants_for
(
value
,
current_user
=
nil
,
project
=
nil
)
case
value
when
User
[
value
]
when
Enumerable
,
ActiveRecord
::
Relation
value
.
flat_map
{
|
v
|
participants_for
(
v
,
current_user
)
}
value
.
flat_map
{
|
v
|
participants_for
(
v
,
current_user
,
project
)
}
when
Participable
value
.
participants
(
current_user
)
value
.
participants
(
current_user
,
project
)
end
end
end
app/services/notification_service.rb
View file @
f5f0ed55
...
...
@@ -91,10 +91,14 @@ class NotificationService
# * project team members with notification level higher then Participating
#
def
merge_mr
(
merge_request
,
current_user
)
recipients
=
reject_muted_users
([
merge_request
.
author
,
merge_request
.
assignee
],
merge_request
.
target_project
)
recipients
=
[
merge_request
.
author
,
merge_request
.
assignee
]
recipients
=
add_project_watchers
(
recipients
,
merge_request
.
target_project
)
recipients
=
reject_muted_users
(
recipients
,
merge_request
.
target_project
)
recipients
=
add_subscribed_users
(
recipients
,
merge_request
)
recipients
=
reject_unsubscribed_users
(
recipients
,
merge_request
)
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
target_project
)).
uniq
recipients
.
delete
(
current_user
)
recipients
.
each
do
|
recipient
|
...
...
@@ -137,20 +141,17 @@ class NotificationService
recipients
=
recipients
.
concat
(
participants
)
# Merge project watchers
recipients
=
recipients
.
concat
(
project_watchers
(
note
.
project
)).
compact
.
uniq
recipients
=
add_project_watchers
(
recipients
,
note
.
project
)
# Reject users with Mention notification level, except those mentioned in _this_ note.
recipients
=
reject_mention_users
(
recipients
-
note
.
mentioned_users
,
note
.
project
)
recipients
=
recipients
+
note
.
mentioned_users
# Reject mutes users
recipients
=
reject_muted_users
(
recipients
,
note
.
project
)
recipients
=
add_subscribed_users
(
recipients
,
note
.
noteable
)
recipients
=
reject_unsubscribed_users
(
recipients
,
note
.
noteable
)
# Reject author
recipients
.
delete
(
note
.
author
)
# build notify method like 'note_commit_email'
...
...
@@ -287,6 +288,10 @@ class NotificationService
users
end
def
add_project_watchers
(
recipients
,
project
)
recipients
.
concat
(
project_watchers
(
project
)).
compact
.
uniq
end
# Remove users with disabled notifications from array
# Also remove duplications and nil recipients
def
reject_muted_users
(
users
,
project
=
nil
)
...
...
@@ -403,11 +408,13 @@ class NotificationService
[
target
.
author
,
target
.
assignee
]
end
recipients
=
reject_muted_us
ers
(
recipients
,
project
)
recipients
=
add_project_watch
ers
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
=
add_subscribed_users
(
recipients
,
target
)
recipients
=
recipients
.
concat
(
project_watchers
(
project
)).
uniq
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
end
...
...
app/views/shared/_visibility_radios.html.haml
View file @
f5f0ed55
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
.radio
-
restricted
=
restricted_visibility_levels
.
include?
(
level
)
=
label
model_method
,
level
do
=
form
.
label
"
#{
model_method
}
_
#{
level
}
"
do
=
form
.
radio_button
model_method
,
level
,
checked:
(
selected_level
==
level
),
disabled:
restricted
=
visibility_level_icon
(
level
)
.option-title
...
...
app/views/shared/snippets/_form.html.haml
View file @
f5f0ed55
...
...
@@ -11,7 +11,7 @@
.col-sm-10
=
f
.
text_field
:title
,
placeholder:
"Example Snippet"
,
class:
'form-control'
,
required:
true
=
render
'shared/visibility_level'
,
f:
f
,
visibility_level:
visibility_level
,
can_change_visibility_level:
true
,
form_model:
@snippet
.form-group
.file-editor
=
f
.
label
:file_name
,
"File"
,
class:
'control-label'
...
...
db/migrate/20150406133311_add_invite_data_to_member.rb
View file @
f5f0ed55
class
AddInviteDataToMember
<
ActiveRecord
::
Migration
def
change
def
up
add_column
:members
,
:created_by_id
,
:integer
add_column
:members
,
:invite_email
,
:string
add_column
:members
,
:invite_token
,
:string
...
...
@@ -9,4 +9,15 @@ class AddInviteDataToMember < ActiveRecord::Migration
add_index
:members
,
:invite_token
,
unique:
true
end
def
down
remove_index
:members
,
:invite_token
change_column
:members
,
:user_id
,
:integer
,
null:
false
remove_column
:members
,
:invite_accepted_at
remove_column
:members
,
:invite_token
remove_column
:members
,
:invite_email
remove_column
:members
,
:created_by_id
end
end
db/migrate/20150417122318_remove_import_data_from_project.rb
View file @
f5f0ed55
class
RemoveImportDataFromProject
<
ActiveRecord
::
Migration
def
change
def
up
remove_column
:projects
,
:import_data
end
def
down
add_column
:projects
,
:import_data
,
:text
end
end
db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb
View file @
f5f0ed55
class
AddDefaultSnippetVisibilityToAppSettings
<
ActiveRecord
::
Migration
def
change
def
up
add_column
:application_settings
,
:default_snippet_visibility
,
:integer
visibility
=
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
]
execute
(
"update application_settings set default_snippet_visibility =
#{
visibility
}
"
)
end
def
down
remove_column
:application_settings
,
:default_snippet_visibility
end
end
docker/single/Dockerfile
View file @
f5f0ed55
...
...
@@ -28,6 +28,7 @@ EXPOSE 80 22
# Copy assets
COPY
assets/wrapper /usr/local/bin/
COPY
assets/gitlab.rb /etc/gitlab/
# Wrapper to handle signal, trigger runit and reconfigure GitLab
CMD
["/usr/local/bin/wrapper"]
docker/single/assets/gitlab.rb
0 → 100644
View file @
f5f0ed55
# External URL should be your Docker instance.
# By default, GitLab will use the Docker container hostname.
# Always use port 80 here to force the internal nginx to bind port 80,
# even if you intend to use another port in Docker.
# external_url "http://192.168.59.103/"
# Prevent Postgres from trying to allocate 25% of total memory
postgresql
[
'shared_buffers'
]
=
'1MB'
# Configure GitLab to redirect PostgreSQL logs to the data volume
postgresql
[
'log_directory'
]
=
'/var/log/gitlab/postgresql'
# Some configuration of GitLab
# You can find more at https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration
gitlab_rails
[
'gitlab_email_from'
]
=
'gitlab@example.com'
gitlab_rails
[
'gitlab_support_email'
]
=
'support@example.com'
gitlab_rails
[
'time_zone'
]
=
'Europe/Paris'
# SMTP settings
# You must use an external server, the Docker container does not install an SMTP server
gitlab_rails
[
'smtp_enable'
]
=
true
gitlab_rails
[
'smtp_address'
]
=
"smtp.example.com"
gitlab_rails
[
'smtp_port'
]
=
587
gitlab_rails
[
'smtp_user_name'
]
=
"user"
gitlab_rails
[
'smtp_password'
]
=
"password"
gitlab_rails
[
'smtp_domain'
]
=
"example.com"
gitlab_rails
[
'smtp_authentication'
]
=
"plain"
gitlab_rails
[
'smtp_enable_starttls_auto'
]
=
true
# Enable LDAP authentication
# gitlab_rails['ldap_enabled'] = true
# gitlab_rails['ldap_host'] = 'ldap.example.com'
# gitlab_rails['ldap_port'] = 389
# gitlab_rails['ldap_method'] = 'plain' # 'ssl' or 'plain'
# gitlab_rails['ldap_allow_username_or_email_login'] = false
# gitlab_rails['ldap_uid'] = 'uid'
# gitlab_rails['ldap_base'] = 'ou=users,dc=example,dc=com'
lib/gitlab/search_results.rb
View file @
f5f0ed55
...
...
@@ -51,11 +51,23 @@ module Gitlab
end
def
issues
Issue
.
where
(
project_id:
limit_project_ids
).
full_search
(
query
).
order
(
'updated_at DESC'
)
issues
=
Issue
.
where
(
project_id:
limit_project_ids
)
if
query
=~
/#(\d+)\z/
issues
=
issues
.
where
(
iid:
$1
)
else
issues
=
issues
.
full_search
(
query
)
end
issues
.
order
(
'updated_at DESC'
)
end
def
merge_requests
MergeRequest
.
in_projects
(
limit_project_ids
).
full_search
(
query
).
order
(
'updated_at DESC'
)
merge_requests
=
MergeRequest
.
in_projects
(
limit_project_ids
)
if
query
=~
/[#!](\d+)\z/
merge_requests
=
merge_requests
.
where
(
iid:
$1
)
else
merge_requests
=
merge_requests
.
full_search
(
query
)
end
merge_requests
.
order
(
'updated_at DESC'
)
end
def
default_scope
...
...
spec/services/issues/close_service_spec.rb
View file @
f5f0ed55
require
'spec_helper'
describe
Issues
::
CloseService
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
assignee:
user2
)
}
let
(
:project
)
{
issue
.
project
}
before
do
project
.
team
<<
[
user
,
:master
]
...
...
spec/services/issues/update_service_spec.rb
View file @
f5f0ed55
require
'spec_helper'
describe
Issues
::
UpdateService
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:label
)
{
create
(
:label
)
}
let
(
:project
)
{
issue
.
project
}
before
do
project
.
team
<<
[
user
,
:master
]
...
...
spec/services/notification_service_spec.rb
View file @
f5f0ed55
...
...
@@ -31,7 +31,8 @@ describe NotificationService do
describe
'Notes'
do
context
'issue note'
do
let
(
:issue
)
{
create
(
:issue
,
assignee:
create
(
:user
))
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee:
create
(
:user
))
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignee:
issue
.
assignee
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@mention referenced'
)
}
...
...
@@ -101,7 +102,8 @@ describe NotificationService do
end
context
'issue note mention'
do
let
(
:issue
)
{
create
(
:issue
,
assignee:
create
(
:user
))
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee:
create
(
:user
))
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignee:
issue
.
assignee
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@all mentioned'
)
}
...
...
@@ -145,7 +147,8 @@ describe NotificationService do
end
context
'commit note'
do
let
(
:note
)
{
create
(
:note_on_commit
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
before
do
build_team
(
note
.
project
)
...
...
@@ -192,7 +195,8 @@ describe NotificationService do
end
describe
'Issues'
do
let
(
:issue
)
{
create
:issue
,
assignee:
create
(
:user
),
description:
'cc @participant'
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:issue
)
{
create
:issue
,
project:
project
,
assignee:
create
(
:user
),
description:
'cc @participant'
}
before
do
build_team
(
issue
.
project
)
...
...
@@ -295,7 +299,8 @@ describe NotificationService do
end
describe
'Merge Requests'
do
let
(
:merge_request
)
{
create
:merge_request
,
assignee:
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:merge_request
)
{
create
:merge_request
,
source_project:
project
,
assignee:
create
(
:user
)
}
before
do
build_team
(
merge_request
.
target_project
)
...
...
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