-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOP-4356 reverse slack modal sort #990
Conversation
Your feature branch infrastructure has been deployed! Your webhook URL is: https://165kcc42d5.execute-api.us-east-2.amazonaws.com/prod/webhook/githubEndpoint/trigger/build For more information on how to use this endpoint, follow these instructions. |
src/services/slack.ts
Outdated
@@ -191,13 +191,23 @@ export class SlackConnector implements ISlackConnector { | |||
}; | |||
reposToShow.push(opt); | |||
}); | |||
|
|||
// THis is the limitation enforced by slack as no more 100 items are allowd in the dropdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't write this line, but lol can you pls fix the extra capitalization? <3
//'[ERROR] no more than 100 items allowed [json-pointer:/view/blocks/0/element/options]' | ||
|
||
if (reposToShow.length > 100) { | ||
reposToShow = reposToShow.splice(0, 100); | ||
reposToShow = reposToShow.sort().reverse().splice(0, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally using a sort method without a compare function makes me sweat but simply because Github enforces rules on owner names and repo names in respect to symbols, this is safe to me. I'm 99.99% sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm ok, do you think I should add a sort function of some ~sort?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be the very rare time when I say you don't have to 😆
tests/unit/api/slack.test.ts
Outdated
@@ -53,6 +53,7 @@ jest.mock('../../../src/repositories/docsetsRepository', () => ({ | |||
jest.mock('config'); | |||
|
|||
describe('Slack API Controller Tests', () => { | |||
console.log('hello'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOps.. Thanks for catching.. sorry..
Context
DOP-4356
This is a quick fix for content writers who are having issues deploying some branches due to having too many entitlements for slack's limit of 100 things per dropdown
With sorting, inactive branches will now be sorted to the bottom of the slack modal and therefore will be the first to be truncated if a deployer has >100 entitlements. I've also taken the opportunity to correctly sort the versions in the modal such that 4.1 < 4.2 < 4.11
Changes were tested in preprd, and screenshots below are from preprd test-deploy slack modal