mattermost / mattermost-plugin-jira

JIRA plugin for Mattermost 🔌
https://mattermost.gitbook.io/plugin-jira/
Apache License 2.0
98 stars 127 forks source link

Jira subscriptions active after channel archived. #571

Open jfrerich opened 4 years ago

jfrerich commented 4 years ago

Summary

Anyone an idea for me how to remove a Jira subscription from an archived channel? It's not visible in the settings.

From Twitter https://twitter.com/cwaidner/status/1219730250030026753

Is the only way to unarchive the channel via the CLI, then remove subscription, then archive again?

Issue created from a message in Mattermost.

Original Jira Ticket

https://mattermost.atlassian.net/browse/MM-21955


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Plugin: Jira" community channel.

New contributors please see our Developer's Guide and our Plugins Guide.

mustafayildirim commented 4 years ago

Hi @jfrerich I'm interested with this issue. But I haven't decided the solution. Should we stop sending message to archived channels? or Remove Jira Subscription when channels were archived? And how is the plugin been notified when a channel is been archived?

jfrerich commented 4 years ago

Hi @mustafayildirim! I'm sorry to just now be getting back to you regarding this issue. There was some discussion on this idea in this [channel post](https://community.mattermost.com/core/pl/g4bojkmnepf1xqbtmfzfx6cfew

It seems the consensus is to disable subscriptions when a channel is archived. In this sense, you would just ignore sending notifications to subscribed channels, if they are archived.

You can check if a channel is archived by model.Channel.DeleteAt > 0

I would look at this function as a point of entry into the code. This function might be a little too aggressive, because the callers might actually want All channels, including archived. https://github.com/mattermost/mattermost-plugin-jira/blob/master/server/subscribe.go#L172

The other location might be to just filter out channelIDs that are archived when parsing the webhook. This could be accomplished in the following code block. https://github.com/mattermost/mattermost-plugin-jira/blob/master/server/webhook_worker.go#L67

I hope this helps and I hope you are still interested! If you have any further questions, please feel free to ping me here, or ask any Jira related questions in the Mattermost Plugin: Jira channel