tolgee-platform icon indicating copy to clipboard operation
tolgee-platform copied to clipboard

Slack integration

Open JanCizmar opened this issue 1 year ago • 2 comments

Basics

Users will be able to subscribe to a Tolgee project from a Slack channel, and when permitted, they will be able to modify translated values directly from Slack.

  • [x] Users are able to subscribe to a project in a private or public channel /tolgee subscribe <projectId>
    • [x] By default, it subscribes to all languages in the project, and the messages are only visible to the subscribing user.
    • [x] The user won't see controlling elements for a global subscription. Since they can have MANAGE permission to project and can technically modify all the language translations, they probably don't want to touch them, though.
    • [x] The user will be able to change the visibility using an argument. /tolgee subscribe <projectId> --visibility all-in-channel. In that case, even users who are not logged into the platform will see the changes.
  • [x] User will be able to subscribe to specific language /tolgee subscribe <projectId> <languageTag>. Then, the user will get notified when
    • [x] A new key is created
    • [x] Base value is changed
    • [x] The value in the language is changed

The default settings would notify users a lot, especially in bigger projects. To avoid this, we need to introduce some configuration parameter so users can define, what events they would like to listen to.

  • [x] Add configuration parameter --on <event name> Event names:
    • [x] new-key - new key is created
    • [x] base-changed - base value for an language is changed
    • [x] translation-changed - the translation in the selected language is modified. e.g. If user executes /toglee subscribe 1 fr --on translation-changed, they will be notified when french value is modified, but not when new key is created nor base language value changed.

Data modification

With Tolgee Slack integration, users can update or review the translation texts directly from the Slack integration.

  • [x] Users can set translated value when they have the permission to
  • [ ] User can review a value provided by another user
  • [x] When translated value or state changes in a defined period of time (2 hours), the original message is updated
  • [x] The database is cleaned, so we don't store data which we don't need anymore
  • [x] Only users with permissions to each operation will see the inputs and buttons to modify the data.

Message merging

When there are multiple subscriptions in a single channel, the messages are merged, so a single event is not displayed multiple times. For example, the user executes /tolgee subscribe 1 and then executes /tolgee subscribe en. For the first command, they wouldn't see the controlling elements (as described above) since it was a global subscription. For the second command, the elements will be sent in message.

  • [ ] Messages are merged

Larger data modification

Users can modify many keys at once for imports (via import endpoint or key import endpoints). In this case, we don't want to send that many messages to the Slack channel. Instead, we send one message with a link to the Tolgee Platform so they can edit it there

  • [ ] Larger data modifications are sent as one message with a link to tolgee for events with 10+ messages

The message UI and controlling elements

The message should contain:

  • [x] Key name
  • [x] Key namespace
  • [x] The base language translation value
  • [x] The value in the subscribed language (or the modified one)
  • [x] The state as the attachment bar color
  • [ ] Link to Tolgee platform to modify the string

Non-functional requirements

  • [ ] Check how many SQL queries are executed for the operations
  • [ ] Try not to load unnecessary data (use DTOs instead of entities for reading)
  • [ ] Write tests for the Webhook endpoint
  • [ ] Write tests for the communication with Slack SDK by mocking it

Organization and Workspace pairing & UI

  • [x] For better security, we need to pair workspace and organization first
  • [x] Endpoint returning whether organization is paired
  • [x] Endpoint returning all the subscriptions in organization showing
    • [x] The workspace name
    • [x] The author of subscription
    • [x] The channel name
  • [x] Endpoint removing the workspace & organization pairing removing all the subscriptions

JanCizmar avatar Sep 30 '22 08:09 JanCizmar

@JanCizmar If you need some help I can take this

ludovicobesana avatar Oct 08 '22 16:10 ludovicobesana

I've updated the issue with new spec. @huglx is done with PFC, now we just need to do all of the serious work. 🚀

JanCizmar avatar Feb 12 '24 11:02 JanCizmar