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
cb5f362b
Commit
cb5f362b
authored
Apr 28, 2020
by
Marvin Karegyeya
Committed by
Martin Wortschack
Apr 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove addissues function logic from list model
parent
62ac1467
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
42 deletions
+110
-42
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/models/list.js
+1
-42
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+44
-0
changelogs/unreleased/Remove-addIssue-function-logic-from-list-js.yml
...nreleased/Remove-addIssue-function-logic-from-list-js.yml
+5
-0
spec/frontend/boards/boards_store_spec.js
spec/frontend/boards/boards_store_spec.js
+60
-0
No files found.
app/assets/javascripts/boards/models/list.js
View file @
cb5f362b
...
...
@@ -164,48 +164,7 @@ class List {
}
addIssue
(
issue
,
listFrom
,
newIndex
)
{
let
moveBeforeId
=
null
;
let
moveAfterId
=
null
;
if
(
!
this
.
findIssue
(
issue
.
id
))
{
if
(
newIndex
!==
undefined
)
{
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
if
(
this
.
issues
[
newIndex
-
1
])
{
moveBeforeId
=
this
.
issues
[
newIndex
-
1
].
id
;
}
if
(
this
.
issues
[
newIndex
+
1
])
{
moveAfterId
=
this
.
issues
[
newIndex
+
1
].
id
;
}
}
else
{
this
.
issues
.
push
(
issue
);
}
if
(
this
.
label
)
{
issue
.
addLabel
(
this
.
label
);
}
if
(
this
.
assignee
)
{
if
(
listFrom
&&
listFrom
.
type
===
'
assignee
'
)
{
issue
.
removeAssignee
(
listFrom
.
assignee
);
}
issue
.
addAssignee
(
this
.
assignee
);
}
if
(
IS_EE
&&
this
.
milestone
)
{
if
(
listFrom
&&
listFrom
.
type
===
'
milestone
'
)
{
issue
.
removeMilestone
(
listFrom
.
milestone
);
}
issue
.
addMilestone
(
this
.
milestone
);
}
if
(
listFrom
)
{
this
.
issuesSize
+=
1
;
this
.
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeId
,
moveAfterId
);
}
}
boardsStore
.
addListIssue
(
this
,
issue
,
listFrom
,
newIndex
);
}
moveIssue
(
issue
,
oldIndex
,
newIndex
,
moveBeforeId
,
moveAfterId
)
{
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
cb5f362b
...
...
@@ -125,6 +125,50 @@ const boardsStore = {
path
:
''
,
});
},
addListIssue
(
list
,
issue
,
listFrom
,
newIndex
)
{
let
moveBeforeId
=
null
;
let
moveAfterId
=
null
;
if
(
!
list
.
findIssue
(
issue
.
id
))
{
if
(
newIndex
!==
undefined
)
{
list
.
issues
.
splice
(
newIndex
,
0
,
issue
);
if
(
list
.
issues
[
newIndex
-
1
])
{
moveBeforeId
=
list
.
issues
[
newIndex
-
1
].
id
;
}
if
(
list
.
issues
[
newIndex
+
1
])
{
moveAfterId
=
list
.
issues
[
newIndex
+
1
].
id
;
}
}
else
{
list
.
issues
.
push
(
issue
);
}
if
(
list
.
label
)
{
issue
.
addLabel
(
list
.
label
);
}
if
(
list
.
assignee
)
{
if
(
listFrom
&&
listFrom
.
type
===
'
assignee
'
)
{
issue
.
removeAssignee
(
listFrom
.
assignee
);
}
issue
.
addAssignee
(
list
.
assignee
);
}
if
(
IS_EE
&&
list
.
milestone
)
{
if
(
listFrom
&&
listFrom
.
type
===
'
milestone
'
)
{
issue
.
removeMilestone
(
listFrom
.
milestone
);
}
issue
.
addMilestone
(
list
.
milestone
);
}
if
(
listFrom
)
{
list
.
issuesSize
+=
1
;
list
.
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeId
,
moveAfterId
);
}
}
},
welcomeIsHidden
()
{
return
parseBoolean
(
Cookies
.
get
(
'
issue_board_welcome_hidden
'
));
},
...
...
changelogs/unreleased/Remove-addIssue-function-logic-from-list-js.yml
0 → 100644
View file @
cb5f362b
---
title
:
removes store logic from issue board models
merge_request
:
21408
author
:
nuwe1
type
:
other
spec/frontend/boards/boards_store_spec.js
View file @
cb5f362b
...
...
@@ -1041,6 +1041,66 @@ describe('boardsStore', () => {
});
});
describe
(
'
addListIssue
'
,
()
=>
{
let
list
;
const
issue1
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
2
,
iid
:
2
,
confidential
:
false
,
labels
:
[
{
color
:
'
#ff0000
'
,
description
:
'
testing;
'
,
id
:
5000
,
priority
:
undefined
,
textColor
:
'
white
'
,
title
:
'
Test
'
,
},
],
assignees
:
[],
});
const
issue2
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[
{
id
:
1
,
title
:
'
test
'
,
color
:
'
red
'
,
description
:
'
testing
'
,
},
],
assignees
:
[
{
id
:
1
,
name
:
'
name
'
,
username
:
'
username
'
,
avatar_url
:
'
http://avatar_url
'
,
},
],
real_path
:
'
path/to/issue
'
,
});
beforeEach
(()
=>
{
list
=
new
List
(
listObj
);
list
.
addIssue
(
issue1
);
setupDefaultResponses
();
});
it
(
'
adds issues that are not already on the list
'
,
()
=>
{
expect
(
list
.
findIssue
(
issue2
.
id
)).
toBe
(
undefined
);
expect
(
list
.
issues
).
toEqual
([
issue1
]);
boardsStore
.
addListIssue
(
list
,
issue2
);
expect
(
list
.
findIssue
(
issue2
.
id
)).
toBe
(
issue2
);
expect
(
list
.
issues
.
length
).
toBe
(
2
);
expect
(
list
.
issues
).
toEqual
([
issue1
,
issue2
]);
});
});
describe
(
'
updateIssue
'
,
()
=>
{
let
issue
;
let
patchSpy
;
...
...
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