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
920fd0e7
Commit
920fd0e7
authored
May 14, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
dea4af91
1ca42413
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
7 deletions
+23
-7
app/controllers/uploads_controller.rb
app/controllers/uploads_controller.rb
+1
-1
app/models/application_record.rb
app/models/application_record.rb
+4
-0
app/uploaders/attachment_uploader.rb
app/uploaders/attachment_uploader.rb
+1
-1
app/uploaders/avatar_uploader.rb
app/uploaders/avatar_uploader.rb
+1
-1
app/uploaders/personal_file_uploader.rb
app/uploaders/personal_file_uploader.rb
+1
-1
changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml
...eleased/make-autocomplete-faster-with-lots-of-results.yml
+5
-0
spec/controllers/concerns/send_file_upload_spec.rb
spec/controllers/concerns/send_file_upload_spec.rb
+2
-1
spec/factories/uploads.rb
spec/factories/uploads.rb
+1
-1
spec/models/application_record_spec.rb
spec/models/application_record_spec.rb
+6
-0
spec/uploaders/object_storage_spec.rb
spec/uploaders/object_storage_spec.rb
+1
-1
No files found.
app/controllers/uploads_controller.rb
View file @
920fd0e7
...
...
@@ -45,7 +45,7 @@ class UploadsController < ApplicationController
when
Appearance
true
else
permission
=
"read_
#{
model
.
class
.
to_s
.
underscore
}
"
.
to_sym
permission
=
"read_
#{
model
.
class
.
underscore
}
"
.
to_sym
can?
(
current_user
,
permission
,
model
)
end
...
...
app/models/application_record.rb
View file @
920fd0e7
...
...
@@ -41,4 +41,8 @@ class ApplicationRecord < ActiveRecord::Base
find_or_create_by
(
*
args
)
end
end
def
self
.
underscore
Gitlab
::
SafeRequestStore
.
fetch
(
"model:
#{
self
}
:underscore"
)
{
self
.
to_s
.
underscore
}
end
end
app/uploaders/attachment_uploader.rb
View file @
920fd0e7
...
...
@@ -9,6 +9,6 @@ class AttachmentUploader < GitlabUploader
private
def
dynamic_segment
File
.
join
(
model
.
class
.
to_s
.
underscore
,
mounted_as
.
to_s
,
model
.
id
.
to_s
)
File
.
join
(
model
.
class
.
underscore
,
mounted_as
.
to_s
,
model
.
id
.
to_s
)
end
end
app/uploaders/avatar_uploader.rb
View file @
920fd0e7
...
...
@@ -25,6 +25,6 @@ class AvatarUploader < GitlabUploader
private
def
dynamic_segment
File
.
join
(
model
.
class
.
to_s
.
underscore
,
mounted_as
.
to_s
,
model
.
id
.
to_s
)
File
.
join
(
model
.
class
.
underscore
,
mounted_as
.
to_s
,
model
.
id
.
to_s
)
end
end
app/uploaders/personal_file_uploader.rb
View file @
920fd0e7
...
...
@@ -20,7 +20,7 @@ class PersonalFileUploader < FileUploader
def
self
.
model_path_segment
(
model
)
return
'temp/'
unless
model
File
.
join
(
model
.
class
.
to_s
.
underscore
,
model
.
id
.
to_s
)
File
.
join
(
model
.
class
.
underscore
,
model
.
id
.
to_s
)
end
def
object_store
...
...
changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml
0 → 100644
View file @
920fd0e7
---
title
:
Improve performance of users autocomplete when there are lots of results
merge_request
:
author
:
type
:
performance
spec/controllers/concerns/send_file_upload_spec.rb
View file @
920fd0e7
# coding: utf-8
# frozen_string_literal: true
require
'spec_helper'
...
...
@@ -13,7 +14,7 @@ describe SendFileUpload do
# user/:id
def
dynamic_segment
File
.
join
(
model
.
class
.
to_s
.
underscore
,
model
.
id
.
to_s
)
File
.
join
(
model
.
class
.
underscore
,
model
.
id
.
to_s
)
end
end
end
...
...
spec/factories/uploads.rb
View file @
920fd0e7
...
...
@@ -13,7 +13,7 @@ FactoryBot.define do
end
# this needs to comply with RecordsUpload::Concern#upload_path
path
{
File
.
join
(
"uploads/-/system"
,
model
.
class
.
to_s
.
underscore
,
mount_point
.
to_s
,
'avatar.jpg'
)
}
path
{
File
.
join
(
"uploads/-/system"
,
model
.
class
.
underscore
,
mount_point
.
to_s
,
'avatar.jpg'
)
}
trait
:personal_snippet_upload
do
uploader
"PersonalFileUploader"
...
...
spec/models/application_record_spec.rb
View file @
920fd0e7
...
...
@@ -52,4 +52,10 @@ describe ApplicationRecord do
expect
{
Suggestion
.
find_or_create_by!
(
note:
nil
)
}.
to
raise_error
(
ActiveRecord
::
RecordInvalid
)
end
end
describe
'.underscore'
do
it
'returns the underscored value of the class as a string'
do
expect
(
MergeRequest
.
underscore
).
to
eq
(
'merge_request'
)
end
end
end
spec/uploaders/object_storage_spec.rb
View file @
920fd0e7
...
...
@@ -12,7 +12,7 @@ class Implementation < GitlabUploader
# user/:id
def
dynamic_segment
File
.
join
(
model
.
class
.
to_s
.
underscore
,
model
.
id
.
to_s
)
File
.
join
(
model
.
class
.
underscore
,
model
.
id
.
to_s
)
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