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
c5c79378
Commit
c5c79378
authored
Nov 30, 2020
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address reviewer feedback
- Remove unneeded FOSS placeholder - Place model in boards namespace
parent
a780fe59
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
42 deletions
+36
-42
db/migrate/20201119003042_add_epic_board_positions.rb
db/migrate/20201119003042_add_epic_board_positions.rb
+5
-5
ee/app/models/boards/epic_board_position.rb
ee/app/models/boards/epic_board_position.rb
+29
-0
ee/app/models/ee/epic_board_position.rb
ee/app/models/ee/epic_board_position.rb
+0
-35
ee/spec/factories/epic_board_positions.rb
ee/spec/factories/epic_board_positions.rb
+1
-1
ee/spec/models/boards/epic_board_position_spec.rb
ee/spec/models/boards/epic_board_position_spec.rb
+1
-1
No files found.
db/migrate/20201119003042_add_epic_board_positions.rb
View file @
c5c79378
...
...
@@ -5,23 +5,23 @@ class AddEpicBoardPositions < ActiveRecord::Migration[6.0]
DOWNTIME
=
false
disable_ddl_transaction!
def
up
with_lock_retries
do
create_table
:epic_board_positions
do
|
t
|
create_table
:
boards_
epic_board_positions
do
|
t
|
t
.
references
:board
,
foreign_key:
{
on_delete: :cascade
},
null:
false
,
index:
false
t
.
references
:epic
,
foreign_key:
{
on_delete: :cascade
},
null:
false
,
index:
true
t
.
integer
:relative_position
t
.
timestamps_with_timezone
null:
false
t
.
index
[
:board_id
,
:epic_id
],
unique:
true
,
name: :index_epic_board_positions_on_board_id_and_epic_id
t
.
index
[
:board_id
,
:epic_id
],
unique:
true
,
name: :index_
boards_
epic_board_positions_on_board_id_and_epic_id
end
end
end
def
down
drop_table
:epic_board_positions
with_lock_retries
do
drop_table
:boards_epic_board_positions
end
end
end
ee/app/models/boards/epic_board_position.rb
0 → 100644
View file @
c5c79378
# frozen_string_literal: true
module
Boards
class
EpicBoardPosition
<
ApplicationRecord
include
RelativePositioning
self
.
table_name
=
'boards_epic_board_positions'
belongs_to
:board
belongs_to
:epic
validates
:board
,
presence:
true
validates
:epic
,
presence:
true
,
uniqueness:
{
scope: :board_id
}
alias_attribute
:parent
,
:board
scope
:order_relative_position
,
->
do
reorder
(
'relative_position ASC'
,
'id DESC'
)
end
def
self
.
relative_positioning_query_base
(
position
)
where
(
board_id:
position
.
board_id
)
end
def
self
.
relative_positioning_parent_column
:board_id
end
end
end
ee/app/models/ee/epic_board_position.rb
deleted
100644 → 0
View file @
a780fe59
# frozen_string_literal: true
module
EE
module
EpicBoardPosition
extend
ActiveSupport
::
Concern
prepended
do
include
RelativePositioning
belongs_to
:board
belongs_to
:epic
validates
:board
,
presence:
true
validates
:epic
,
presence:
true
,
uniqueness:
{
scope: :board_id
}
alias_attribute
:parent
,
:board
scope
:order_relative_position
,
->
do
reorder
(
'relative_position ASC'
,
'id DESC'
)
end
end
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
def
relative_positioning_query_base
(
position
)
where
(
board_id:
position
.
board_id
)
end
def
relative_positioning_parent_column
:board_id
end
end
end
end
ee/spec/factories/epic_board_positions.rb
View file @
c5c79378
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:epic_board_position
do
factory
:epic_board_position
,
class:
'Boards::EpicBoardPosition'
do
epic
board
relative_position
{
RelativePositioning
::
START_POSITION
}
...
...
ee/spec/models/epic_board_position_spec.rb
→
ee/spec/models/
boards/
epic_board_position_spec.rb
View file @
c5c79378
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
EpicBoardPosition
do
RSpec
.
describe
Boards
::
EpicBoardPosition
do
let_it_be
(
:epic
)
{
create
(
:epic
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:board
)
{
create
(
:board
,
group:
group
)
}
...
...
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