Skip to content
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

Add ability to disable Note event by noteable_type #51

Open
mutezero opened this issue Oct 10, 2019 · 1 comment
Open

Add ability to disable Note event by noteable_type #51

mutezero opened this issue Oct 10, 2019 · 1 comment

Comments

@mutezero
Copy link

mutezero commented Oct 10, 2019

Currently, only all comments can be disabled.
Adding noteable_type field check around /lib/Web.js#L52 should do the trick.

Use case:
Having only issues and their comments in channel A (for the public), but rest of repository events in channel B (for developers and project managers).

@mutezero
Copy link
Author

mutezero commented Nov 2, 2021

I've decided to investigate the issue once again, and it seems to still being a problem here

YappyGitLab/lib/Web.js

Lines 65 to 66 in 95d65fc

const action = get(data, 'object_attributes.action');
const actionText = action ? `/${action}` : '';
!filter[conf.get('eventsType')](conf.get('eventsList'))(eventName + actionText) ||

The issue is that it only credits action field, but not noteable_type, unlike the event handler (Discord message picker/formatter)
const action = data.object_attributes ? data.object_attributes.action : '';
const noteableType = data.object_attributes && data.object_attributes.noteable_type ? data.object_attributes.noteable_type.toLowerCase() : '';
eventName = eventName.replace(` Hook`, '').replace(/ /g, '_').toLowerCase();
let event = action || noteableType ? `${eventName}-${action || noteableType}` : eventName;
try {
event = this.eventsList.get(event) || this.eventsList.get('Unknown');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants