Skip to content

Commit 2fad2dd

Browse files
committed
fix(board): show PRs linked to issues, if they are in separate columns
Closes #245
1 parent a0b24ff commit 2fad2dd

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

packages/board/src/Taskboard.svelte

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
44
import Dragula from '@bpmn-io/draggle';
55
6-
76
import BoardFilter from './BoardFilter.svelte';
87
98
import Avatar from './components/Avatar.svelte';
@@ -98,7 +97,7 @@
9897
9998
const columnItems = items[column];
10099
101-
shownItems[column] = columnItems.filter(item => !isClosingPull(item));
100+
shownItems[column] = columnItems.filter(isShown);
102101
103102
return shownItems;
104103
}, {})
@@ -729,9 +728,39 @@
729728
};
730729
}
731730
732-
function isClosingPull(item) {
733-
return isPull(item) && isOpenOrMerged(item) && item.links.some(link => {
734-
return isClosingLink(link) && itemsById[link.target.id];
731+
/**
732+
* Test whether the item should be shown on the board, because they are not
733+
*
734+
* * pull requests
735+
* * linked to an issue via <Closes #ISSUE_NR>
736+
* * in the same column as the issue
737+
*
738+
* @param {any} item
739+
*
740+
* @return {boolean}
741+
*/
742+
function isShown(item) {
743+
744+
if (!isPull(item)) {
745+
return true;
746+
}
747+
748+
if (!isOpenOrMerged(item)) {
749+
return true;
750+
}
751+
752+
if (!isAttachedInSameColumn(item)) {
753+
return true;
754+
}
755+
756+
return false;
757+
}
758+
759+
function isAttachedInSameColumn(item) {
760+
return item.links.some(link => {
761+
const closedItem = isClosingLink(link) && itemsById[link.target.id];
762+
763+
return closedItem && closedItem.column === item.column;
735764
});
736765
}
737766

0 commit comments

Comments
 (0)