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
Tatuya Kamada
gitlab-ce
Commits
33c9f05c
Commit
33c9f05c
authored
Oct 09, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append in place for strings and arrays
parent
ac158424
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
41 additions
and
37 deletions
+41
-37
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+3
-3
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+1
-1
app/helpers/graph_helper.rb
app/helpers/graph_helper.rb
+2
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/helpers/tags_helper.rb
app/helpers/tags_helper.rb
+1
-1
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+6
-3
app/models/ability.rb
app/models/ability.rb
+13
-13
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-1
app/models/network/graph.rb
app/models/network/graph.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/models/project_team.rb
app/models/project_team.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-2
config/application.rb
config/application.rb
+6
-6
No files found.
app/controllers/projects/refs_controller.rb
View file @
33c9f05c
...
@@ -41,9 +41,9 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -41,9 +41,9 @@ class Projects::RefsController < Projects::ApplicationController
@path
=
params
[
:path
]
@path
=
params
[
:path
]
contents
=
[]
contents
=
[]
contents
+=
tree
.
trees
contents
.
push
(
*
tree
.
trees
)
contents
+=
tree
.
blobs
contents
.
push
(
*
tree
.
blobs
)
contents
+=
tree
.
submodules
contents
.
push
(
*
tree
.
submodules
)
@logs
=
contents
[
@offset
,
@limit
].
to_a
.
map
do
|
content
|
@logs
=
contents
[
@offset
,
@limit
].
to_a
.
map
do
|
content
|
file
=
@path
?
File
.
join
(
@path
,
content
.
name
)
:
content
.
name
file
=
@path
?
File
.
join
(
@path
,
content
.
name
)
:
content
.
name
...
...
app/helpers/commits_helper.rb
View file @
33c9f05c
...
@@ -44,7 +44,7 @@ module CommitsHelper
...
@@ -44,7 +44,7 @@ module CommitsHelper
parts
=
@path
.
split
(
'/'
)
parts
=
@path
.
split
(
'/'
)
parts
.
each_with_index
do
|
part
,
i
|
parts
.
each_with_index
do
|
part
,
i
|
crumbs
+=
content_tag
(
:li
)
do
crumbs
<<
content_tag
(
:li
)
do
# The text is just the individual part, but the link needs all the parts before it
# The text is just the individual part, but the link needs all the parts before it
link_to
part
,
project_commits_path
(
@project
,
tree_join
(
@ref
,
parts
[
0
..
i
].
join
(
'/'
)))
link_to
part
,
project_commits_path
(
@project
,
tree_join
(
@ref
,
parts
[
0
..
i
].
join
(
'/'
)))
end
end
...
...
app/helpers/graph_helper.rb
View file @
33c9f05c
module
GraphHelper
module
GraphHelper
def
get_refs
(
repo
,
commit
)
def
get_refs
(
repo
,
commit
)
refs
=
""
refs
=
""
refs
+=
commit
.
ref_names
(
repo
).
join
(
" "
)
refs
<<
commit
.
ref_names
(
repo
).
join
(
' '
)
# append note count
# append note count
refs
+=
"[
#{
@graph
.
notes
[
commit
.
id
]
}
]"
if
@graph
.
notes
[
commit
.
id
]
>
0
refs
<<
"[
#{
@graph
.
notes
[
commit
.
id
]
}
]"
if
@graph
.
notes
[
commit
.
id
]
>
0
refs
refs
end
end
...
...
app/helpers/projects_helper.rb
View file @
33c9f05c
...
@@ -86,7 +86,7 @@ module ProjectsHelper
...
@@ -86,7 +86,7 @@ module ProjectsHelper
def
link_to_toggle_star
(
title
,
starred
,
signed_in
)
def
link_to_toggle_star
(
title
,
starred
,
signed_in
)
cls
=
'star-btn'
cls
=
'star-btn'
cls
+=
' disabled'
unless
signed_in
cls
<<
' disabled'
unless
signed_in
toggle_html
=
content_tag
(
'span'
,
class:
'toggle'
)
do
toggle_html
=
content_tag
(
'span'
,
class:
'toggle'
)
do
toggle_text
=
if
starred
toggle_text
=
if
starred
...
...
app/helpers/tags_helper.rb
View file @
33c9f05c
...
@@ -6,7 +6,7 @@ module TagsHelper
...
@@ -6,7 +6,7 @@ module TagsHelper
def
tag_list
(
project
)
def
tag_list
(
project
)
html
=
''
html
=
''
project
.
tag_list
.
each
do
|
tag
|
project
.
tag_list
.
each
do
|
tag
|
html
+=
link_to
tag
,
tag_path
(
tag
)
html
<<
link_to
(
tag
,
tag_path
(
tag
)
)
end
end
html
.
html_safe
html
.
html_safe
...
...
app/helpers/tree_helper.rb
View file @
33c9f05c
...
@@ -10,13 +10,16 @@ module TreeHelper
...
@@ -10,13 +10,16 @@ module TreeHelper
tree
=
""
tree
=
""
# Render folders if we have any
# Render folders if we have any
tree
+=
render
partial:
'projects/tree/tree_item'
,
collection:
folders
,
locals:
{
type:
'folder'
}
if
folders
.
present?
tree
<<
render
(
partial:
'projects/tree/tree_item'
,
collection:
folders
,
locals:
{
type:
'folder'
})
if
folders
.
present?
# Render files if we have any
# Render files if we have any
tree
+=
render
partial:
'projects/tree/blob_item'
,
collection:
files
,
locals:
{
type:
'file'
}
if
files
.
present?
tree
<<
render
(
partial:
'projects/tree/blob_item'
,
collection:
files
,
locals:
{
type:
'file'
})
if
files
.
present?
# Render submodules if we have any
# Render submodules if we have any
tree
+=
render
partial:
'projects/tree/submodule_item'
,
collection:
submodules
if
submodules
.
present?
tree
<<
render
(
partial:
'projects/tree/submodule_item'
,
collection:
submodules
)
if
submodules
.
present?
tree
.
html_safe
tree
.
html_safe
end
end
...
...
app/models/ability.rb
View file @
33c9f05c
...
@@ -73,28 +73,28 @@ class Ability
...
@@ -73,28 +73,28 @@ class Ability
# Rules based on role in project
# Rules based on role in project
if
team
.
master?
(
user
)
if
team
.
master?
(
user
)
rules
+=
project_master_rules
rules
.
push
(
*
project_master_rules
)
elsif
team
.
developer?
(
user
)
elsif
team
.
developer?
(
user
)
rules
+=
project_dev_rules
rules
.
push
(
*
project_dev_rules
)
elsif
team
.
reporter?
(
user
)
elsif
team
.
reporter?
(
user
)
rules
+=
project_report_rules
rules
.
push
(
*
project_report_rules
)
elsif
team
.
guest?
(
user
)
elsif
team
.
guest?
(
user
)
rules
+=
project_guest_rules
rules
.
push
(
*
project_guest_rules
)
end
end
if
project
.
public?
||
project
.
internal?
if
project
.
public?
||
project
.
internal?
rules
+=
public_project_rules
rules
.
push
(
*
public_project_rules
)
end
end
if
project
.
owner
==
user
||
user
.
admin?
if
project
.
owner
==
user
||
user
.
admin?
rules
+=
project_admin_rules
rules
.
push
(
*
project_admin_rules
)
end
end
if
project
.
group
&&
project
.
group
.
has_owner?
(
user
)
if
project
.
group
&&
project
.
group
.
has_owner?
(
user
)
rules
+=
project_admin_rules
rules
.
push
(
*
project_admin_rules
)
end
end
if
project
.
archived?
if
project
.
archived?
...
@@ -193,17 +193,17 @@ class Ability
...
@@ -193,17 +193,17 @@ class Ability
# Only group masters and group owners can create new projects in group
# Only group masters and group owners can create new projects in group
if
group
.
has_master?
(
user
)
||
group
.
has_owner?
(
user
)
||
user
.
admin?
if
group
.
has_master?
(
user
)
||
group
.
has_owner?
(
user
)
||
user
.
admin?
rules
+=
[
rules
.
push
(
*
[
:create_projects
,
:create_projects
,
]
]
)
end
end
# Only group owner and administrators can manage group
# Only group owner and administrators can manage group
if
group
.
has_owner?
(
user
)
||
user
.
admin?
if
group
.
has_owner?
(
user
)
||
user
.
admin?
rules
+=
[
rules
.
push
(
*
[
:manage_group
,
:manage_group
,
:manage_namespace
:manage_namespace
]
]
)
end
end
rules
.
flatten
rules
.
flatten
...
@@ -214,10 +214,10 @@ class Ability
...
@@ -214,10 +214,10 @@ class Ability
# Only namespace owner and administrators can manage it
# Only namespace owner and administrators can manage it
if
namespace
.
owner
==
user
||
user
.
admin?
if
namespace
.
owner
==
user
||
user
.
admin?
rules
+=
[
rules
.
push
(
*
[
:create_projects
,
:create_projects
,
:manage_namespace
:manage_namespace
]
]
)
end
end
rules
.
flatten
rules
.
flatten
...
...
app/models/concerns/mentionable.rb
View file @
33c9f05c
...
@@ -50,7 +50,7 @@ module Mentionable
...
@@ -50,7 +50,7 @@ module Mentionable
matches
.
each
do
|
match
|
matches
.
each
do
|
match
|
identifier
=
match
.
delete
"@"
identifier
=
match
.
delete
"@"
if
identifier
==
"all"
if
identifier
==
"all"
users
+=
project
.
team
.
members
.
flatten
users
.
push
(
*
project
.
team
.
members
.
flatten
)
else
else
id
=
User
.
find_by
(
username:
identifier
).
try
(
:id
)
id
=
User
.
find_by
(
username:
identifier
).
try
(
:id
)
users
<<
User
.
find
(
id
)
unless
id
.
blank?
users
<<
User
.
find
(
id
)
unless
id
.
blank?
...
...
app/models/merge_request.rb
View file @
33c9f05c
...
@@ -248,7 +248,8 @@ class MergeRequest < ActiveRecord::Base
...
@@ -248,7 +248,8 @@ class MergeRequest < ActiveRecord::Base
def
closes_issues
def
closes_issues
if
target_branch
==
project
.
default_branch
if
target_branch
==
project
.
default_branch
issues
=
commits
.
flat_map
{
|
c
|
c
.
closes_issues
(
project
)
}
issues
=
commits
.
flat_map
{
|
c
|
c
.
closes_issues
(
project
)
}
issues
+=
Gitlab
::
ClosingIssueExtractor
.
closed_by_message_in_project
(
description
,
project
)
issues
.
push
(
*
Gitlab
::
ClosingIssueExtractor
.
closed_by_message_in_project
(
description
,
project
))
issues
.
uniq
.
sort_by
(
&
:id
)
issues
.
uniq
.
sort_by
(
&
:id
)
else
else
[]
[]
...
...
app/models/network/graph.rb
View file @
33c9f05c
...
@@ -226,7 +226,7 @@ module Network
...
@@ -226,7 +226,7 @@ module Network
reserved
=
[]
reserved
=
[]
for
day
in
time_range
for
day
in
time_range
reserved
+=
@reserved
[
day
]
reserved
.
push
(
*
@reserved
[
day
])
end
end
reserved
.
uniq!
reserved
.
uniq!
...
...
app/models/project.rb
View file @
33c9f05c
...
@@ -170,7 +170,7 @@ class Project < ActiveRecord::Base
...
@@ -170,7 +170,7 @@ class Project < ActiveRecord::Base
def
publicish
(
user
)
def
publicish
(
user
)
visibility_levels
=
[
Project
::
PUBLIC
]
visibility_levels
=
[
Project
::
PUBLIC
]
visibility_levels
+=
[
Project
::
INTERNAL
]
if
user
visibility_levels
<<
Project
::
INTERNAL
if
user
where
(
visibility_level:
visibility_levels
)
where
(
visibility_level:
visibility_levels
)
end
end
...
...
app/models/project_team.rb
View file @
33c9f05c
...
@@ -160,7 +160,7 @@ class ProjectTeam
...
@@ -160,7 +160,7 @@ class ProjectTeam
end
end
user_ids
=
project_members
.
pluck
(
:user_id
)
user_ids
=
project_members
.
pluck
(
:user_id
)
user_ids
+=
group_members
.
pluck
(
:user_id
)
if
group
user_ids
.
push
(
*
group_members
.
pluck
(
:user_id
)
)
if
group
User
.
where
(
id:
user_ids
)
User
.
where
(
id:
user_ids
)
end
end
...
...
app/models/user.rb
View file @
33c9f05c
...
@@ -297,8 +297,8 @@ class User < ActiveRecord::Base
...
@@ -297,8 +297,8 @@ class User < ActiveRecord::Base
def
authorized_projects
def
authorized_projects
@authorized_projects
||=
begin
@authorized_projects
||=
begin
project_ids
=
personal_projects
.
pluck
(
:id
)
project_ids
=
personal_projects
.
pluck
(
:id
)
project_ids
+=
groups_projects
.
pluck
(
:id
)
project_ids
.
push
(
*
groups_projects
.
pluck
(
:id
)
)
project_ids
+=
projects
.
pluck
(
:id
).
uniq
project_ids
.
push
(
*
projects
.
pluck
(
:id
).
uniq
)
Project
.
where
(
id:
project_ids
).
joins
(
:namespace
).
order
(
'namespaces.name ASC'
)
Project
.
where
(
id:
project_ids
).
joins
(
:namespace
).
order
(
'namespaces.name ASC'
)
end
end
end
end
...
...
config/application.rb
View file @
33c9f05c
...
@@ -12,11 +12,11 @@ module Gitlab
...
@@ -12,11 +12,11 @@ module Gitlab
# -- all .rb files in that directory are automatically loaded.
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# Custom directories with classes and modules you want to be autoloadable.
config
.
autoload_paths
+=
%W(
#{
config
.
root
}
/lib
config
.
autoload_paths
.
push
(
*
%W(
#{
config
.
root
}
/lib
#{
config
.
root
}
/app/models/hooks
#{
config
.
root
}
/app/models/hooks
#{
config
.
root
}
/app/models/concerns
#{
config
.
root
}
/app/models/concerns
#{
config
.
root
}
/app/models/project_services
#{
config
.
root
}
/app/models/project_services
#{
config
.
root
}
/app/models/members
)
#{
config
.
root
}
/app/models/members)
)
# Only load the plugins named here, in the order given (default is alphabetical).
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# :all can be used as a placeholder for all plugins not explicitly named.
...
@@ -31,7 +31,7 @@ module Gitlab
...
@@ -31,7 +31,7 @@ module Gitlab
config
.
encoding
=
"utf-8"
config
.
encoding
=
"utf-8"
# Configure sensitive parameters which will be filtered from the log file.
# Configure sensitive parameters which will be filtered from the log file.
config
.
filter_parameters
+=
[
:password
]
config
.
filter_parameters
.
push
(
*
[
:password
])
# Enable escaping HTML in JSON.
# Enable escaping HTML in JSON.
config
.
active_support
.
escape_html_entities_in_json
=
true
config
.
active_support
.
escape_html_entities_in_json
=
true
...
...
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