youtrack-discord-webhook icon indicating copy to clipboard operation
youtrack-discord-webhook copied to clipboard

main.js is a mess

Open TomDotBat opened this issue 3 years ago • 3 comments

The entire file needs a refactor at some point. It definitely works as intended but it's slightly embarrassing.

TomDotBat avatar May 08 '21 21:05 TomDotBat

this is about the lmao i can't code line isn't it

gregory112 avatar Aug 02 '21 09:08 gregory112

this is about the lmao i can't code line isn't it

Partially, but overall that file is rather badly structured and only really does the bare minimum.

TomDotBat avatar Aug 02 '21 12:08 TomDotBat

Alright. Well for the start, I think the file structure need to change too, if you want to follow how YouTrack works that is. If you see YouTrack example Scrum workflow, you can see there are these rules:

assign-on-move
fix-parent-on-subtasks-resolve
no-ideal-days-for-epics
no-story-points-for-tasks
open-parent-on-subtask-open

each of this rule is a single js file. Each of the rule of course do a single functionality. Now for this case, if you want, main.js can be split into rules like notify-on-done, notify-on-assigned, notify-on-comment, etc., and people can just remove rules or even add more in their own YouTracks. Even better, the config can be placed on each of these rules, so people can configure different WebHook URL per notification type, well, for the cost of having to configure each one of them.

Or we can just follow Slack Notification Simple workflow, which contains only a single file send-to-slack. IMHO, those that do not understand JS cannot easily edit that file, and so cannot just add/remove tasks at will this way.

gregory112 avatar Aug 06 '21 08:08 gregory112