Skip to content

Commit

Permalink
fixup! Sort PR with in progress last
Browse files Browse the repository at this point in the history
  • Loading branch information
aceol committed May 10, 2021
1 parent f7bd8ee commit 5d30e12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions common/services/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@ function createResponseForSlack(data, label) {
pretext: '',
fields:[ {value: message, short: false},],
};
});
}).sort((a, _) => {
// slack will display in the inverse order
const field = a.fields[0].value;
return field.indexOf(':construction:')?-1:1
})

const response = {
response_type: 'in_channel',
text: 'PRs à review pour ' + label,
attachments: attachments.sort((a, b) => {
const field = a.fields[0].value;
return field.indexOf(':construction:')?-1:1
})
attachments
};

return response;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/build/services/github_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ describe('#getPullRequests', function() {
response_type: 'in_channel',
text: 'PRs à review pour team-certif',
attachments: [
{ color: '#B7CEF5', pretext: '', fields: [{ value: '[❌x1]:construction: :idea:<http://test2.fr|PR2>', short: false }] },
{ color: '#B7CEF5', pretext: '', fields: [{ value: '[💬x1|✅x1]<http://test1.fr|PR1>', short: false }] }
{ color: '#B7CEF5', pretext: '', fields: [{ value: '❌x1 | :construction: :idea: | <http://test2.fr|PR2>', short: false }] },
{ color: '#B7CEF5', pretext: '', fields: [{ value: '💬x1 ✅x1 | <http://test1.fr|PR1>', short: false }] }
]
};

Expand Down

0 comments on commit 5d30e12

Please sign in to comment.