mattermost-plugin-gitlab icon indicating copy to clipboard operation
mattermost-plugin-gitlab copied to clipboard

Add per-subscription setting to collapse all posts

Open tivvit opened this issue 5 years ago • 16 comments

Hi, is it possible to format notifications? When I create new gitlab issue everything (title, link, content) is posted to the subscribed channel. Is it possible to customize those messages - I would like to omit content.

tivvit avatar May 22 '20 13:05 tivvit

I can see that it is not (https://github.com/mattermost/mattermost-plugin-gitlab/blob/91c3584082df871fa6a34858e7d1cb9da9f2b803/server/webhook/issue.go#L71), do you have any plans to support this feature?

tivvit avatar May 22 '20 13:05 tivvit

@tivvit What kind of customization do you have in mind? What is your use case?

hanzei avatar May 26 '20 11:05 hanzei

It would be great to be able to specify custom formatting string for each subscription.

For our team for example it would be sufficient to have something like this fmt.Sprintf("new issue %s %s %s\n", issue.Title, repo.PathWithNamespace, issue.URL) and we would probably track only issue creation and close (not tagging).

The use case is: we have company GitLab instance and Mattermost instance and we are using this plugin. We have a Mattermost team channel which is subscribed to several repositories for issues. We are quite happy about the notifications about new issues or issue changes, it simplifies team communication and it helps with our response time for issues created by other teams. But the information is very thorough - imagine an issue with long description (several paragraphs) and somebody adds a label to that issue which results in posting the whole issue text to the channel (again).

I am willing to help with the implementation but I would need some guidance with how to store per subscription settings and how to incorporate this (IMHO quite big) change into the codebase.

tivvit avatar May 26 '20 21:05 tivvit

I have redacted an example:

Screenshot from 2020-05-26 23-46-14

This happened a few minutes after the issue creation (which leads to reposting). It adds only very little information and in this example it is almost the whole screen.

And to be honest the text issue labeled ... is huge.

tivvit avatar May 26 '20 21:05 tivvit

We would very much like to use this also for merge requests, but the issue would be the same.

tivvit avatar May 26 '20 21:05 tivvit

@tivvit Would a plugin setting to disable issue/PR bodies solve your use case?

hanzei avatar May 27 '20 11:05 hanzei

It will definitely help. It is worth trying. Are you planning it per subscription?

tivvit avatar May 28 '20 11:05 tivvit

I was thinking about a global setting for all subscriptions

hanzei avatar May 28 '20 11:05 hanzei

We are a part of quite big deployment and I suppose there will be use-cases for both (with and without body)

tivvit avatar May 28 '20 11:05 tivvit

I see. The github plugin has the concept of flags which are passed on a subscription creation. E.g. a --short could be used. https://github.com/mattermost/mattermost-plugin-github/blob/d4bf39aef12c932bdf9c9bd3292ee67ecf9f6769/server/command.go#L30-L32

hanzei avatar May 28 '20 12:05 hanzei

flags for subscriptions sounds great

tivvit avatar May 28 '20 12:05 tivvit

hi guys, any progress on this?

tivvit avatar Aug 25 '20 22:08 tivvit

@tivvit Given you interested in this feature I'm wondering if you are interested in implementing it?

hanzei avatar Aug 28 '20 12:08 hanzei

@hanzei I am interested but I will not have time for this soon.

Can you please point to places in the code where it should be Implemented and describe briefly what has to be done for this feature because I am not familiar with this project.

After that, it will be simpler to do this effectively so someone may solve it i.e. for hacktoberfest. I am going to find time for this ASAP.

tivvit avatar Aug 28 '20 20:08 tivvit

@tivvit All events are handled in the webhook package in https://github.com/mattermost/mattermost-plugin-gitlab/tree/master/server/webhook. For the flag you should look into the Implementation in the GitHub plugin: https://github.com/mattermost/mattermost-plugin-github/commit/23f77f082659e78f1d519eb3aacb0ceb94a3cc21

hanzei avatar Sep 11 '20 13:09 hanzei

I propose we implement this as a --collapsed flag, as the issue in the GitHub plugin repo describes:

https://github.com/mattermost/mattermost-plugin-github/issues/484

mickmister avatar Jan 26 '22 21:01 mickmister