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
5dbf1f48
Commit
5dbf1f48
authored
Sep 21, 2016
by
Andre Guedes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `Module#prepend` instead of `alias_method_chain`
parent
f80e7683
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
30 deletions
+35
-30
CHANGELOG
CHANGELOG
+1
-0
config/initializers/attr_encrypted_no_db_connection.rb
config/initializers/attr_encrypted_no_db_connection.rb
+13
-12
config/initializers/postgresql_limit_fix.rb
config/initializers/postgresql_limit_fix.rb
+14
-13
lib/banzai/filter/task_list_filter.rb
lib/banzai/filter/task_list_filter.rb
+7
-5
No files found.
CHANGELOG
View file @
5dbf1f48
...
@@ -97,6 +97,7 @@ v 8.12.0
...
@@ -97,6 +97,7 @@ v 8.12.0
- Fix issue with search filter labels not displaying
- Fix issue with search filter labels not displaying
- Reduce contributions calendar data payload (ClemMakesApps)
- Reduce contributions calendar data payload (ClemMakesApps)
- Show all pipelines for merge requests even from discarded commits !6414
- Show all pipelines for merge requests even from discarded commits !6414
- Replace `alias_method_chain` with `Module#prepend`
- Replace contributions calendar timezone payload with dates (ClemMakesApps)
- Replace contributions calendar timezone payload with dates (ClemMakesApps)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
- Enable pipeline events by default !6278
- Enable pipeline events by default !6278
...
...
config/initializers/attr_encrypted_no_db_connection.rb
View file @
5dbf1f48
module
AttrEncrypted
module
AttrEncrypted
module
Adapters
module
Adapters
module
ActiveRecord
module
ActiveRecord
def
attribute_instance_methods_as_symbols_with_no_db_connection
module
DBConnectionQuerier
# Use with_connection so the connection doesn't stay pinned to the thread.
def
attribute_instance_methods_as_symbols
connected
=
::
ActiveRecord
::
Base
.
connection_pool
.
with_connection
(
&
:active?
)
rescue
false
# Use with_connection so the connection doesn't stay pinned to the thread.
connected
=
::
ActiveRecord
::
Base
.
connection_pool
.
with_connection
(
&
:active?
)
rescue
false
if
connected
# Call version from AttrEncrypted::Adapters::ActiveRecord
if
connected
attribute_instance_methods_as_symbols_without_no_db_connection
# Call version from AttrEncrypted::Adapters::ActiveRecord
else
super
# Call version from AttrEncrypted, i.e., `super` with regards to AttrEncrypted::Adapters::ActiveRecord
else
AttrEncrypted
.
instance_method
(
:attribute_instance_methods_as_symbols
).
bind
(
self
).
call
# Call version from AttrEncrypted, i.e., `super` with regards to AttrEncrypted::Adapters::ActiveRecord
AttrEncrypted
.
instance_method
(
:attribute_instance_methods_as_symbols
).
bind
(
self
).
call
end
end
end
end
end
prepend
DBConnectionQuerier
alias_method_chain
:attribute_instance_methods_as_symbols
,
:no_db_connection
end
end
end
end
end
end
config/initializers/postgresql_limit_fix.rb
View file @
5dbf1f48
if
defined?
(
ActiveRecord
::
ConnectionAdapters
::
PostgreSQLAdapter
)
if
defined?
(
ActiveRecord
::
ConnectionAdapters
::
PostgreSQLAdapter
)
class
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
class
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
module
LimitFilter
def
add_column
(
table_name
,
column_name
,
type
,
options
=
{})
options
.
delete
(
:limit
)
if
type
==
:text
super
(
table_name
,
column_name
,
type
,
options
)
end
def
change_column
(
table_name
,
column_name
,
type
,
options
=
{})
options
.
delete
(
:limit
)
if
type
==
:text
super
(
table_name
,
column_name
,
type
,
options
)
end
end
prepend
ActiveRecord
::
ConnectionAdapters
::
PostgreSQLAdapter
::
LimitFilter
class
TableDefinition
class
TableDefinition
def
text
(
*
args
)
def
text
(
*
args
)
options
=
args
.
extract_options!
options
=
args
.
extract_options!
...
@@ -9,18 +23,5 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
...
@@ -9,18 +23,5 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
column_names
.
each
{
|
name
|
column
(
name
,
type
,
options
)
}
column_names
.
each
{
|
name
|
column
(
name
,
type
,
options
)
}
end
end
end
end
def
add_column_with_limit_filter
(
table_name
,
column_name
,
type
,
options
=
{})
options
.
delete
(
:limit
)
if
type
==
:text
add_column_without_limit_filter
(
table_name
,
column_name
,
type
,
options
)
end
def
change_column_with_limit_filter
(
table_name
,
column_name
,
type
,
options
=
{})
options
.
delete
(
:limit
)
if
type
==
:text
change_column_without_limit_filter
(
table_name
,
column_name
,
type
,
options
)
end
alias_method_chain
:add_column
,
:limit_filter
alias_method_chain
:change_column
,
:limit_filter
end
end
end
end
lib/banzai/filter/task_list_filter.rb
View file @
5dbf1f48
...
@@ -10,19 +10,21 @@ module Banzai
...
@@ -10,19 +10,21 @@ module Banzai
# task_list gem.
# task_list gem.
#
#
# See https://github.com/github/task_list/pull/60
# See https://github.com/github/task_list/pull/60
class
TaskListFilter
<
TaskList
::
Filter
module
ClassNames
Filter
def
add_css_class
_with_fix
(
node
,
*
new_class_names
)
def
add_css_class
(
node
,
*
new_class_names
)
if
new_class_names
.
include?
(
'task-list'
)
if
new_class_names
.
include?
(
'task-list'
)
# Don't add class to all lists
# Don't add class to all lists
return
return
elsif
new_class_names
.
include?
(
'task-list-item'
)
elsif
new_class_names
.
include?
(
'task-list-item'
)
add_css_class_without_fix
(
node
.
parent
,
'task-list'
)
super
(
node
.
parent
,
'task-list'
)
end
end
add_css_class_without_fix
(
node
,
*
new_class_names
)
super
(
node
,
*
new_class_names
)
end
end
end
alias_method_chain
:add_css_class
,
:fix
class
TaskListFilter
<
TaskList
::
Filter
prepend
ClassNamesFilter
end
end
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