Skip to content

[Notifier] [Bridge] Fix missed messageId for SendMessage object in slack notifier #40955

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

Conversation

WaylandAce
Copy link
Contributor

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? -
Tickets -
License MIT
Doc PR symfony/symfony-docs#...

There are missed messageId property for SendMessage object in slack notifier.
Regarding slack's documentation: https://api.slack.com/messaging/sending#publishing

One very important piece of information in this response is the ts value, which is essentially the ID of the message,

@WaylandAce WaylandAce requested a review from OskarStark as a code owner April 27, 2021 10:30
@carsonbot carsonbot added this to the 5.2 milestone Apr 27, 2021
@WaylandAce WaylandAce changed the title [Notifier] [Bridge] Store message id for slack transport's SendMessage [Notifier] [Bridge] Fix missed messageId for SendMessage object in slack notifier Apr 27, 2021
@WaylandAce WaylandAce force-pushed the feature/slack_bridge_notifier_message_id branch from 3fae769 to 374788d Compare April 27, 2021 10:39
@@ -91,6 +91,9 @@ protected function doSend(MessageInterface $message): SentMessage
throw new TransportException(sprintf('Unable to post the Slack message: "%s".', $result['error']), $response);
}

return new SentMessage($message, (string) $this);
$sentMessage = new SentMessage($message, (string) $this);
$sentMessage->setMessageId($result['ts']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we check if the key exists in the array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already check for "ok" status. I had looked to another transports/bridges, they did not have even this checks.

Which behavior do you expect, if by some unknown reason slack return response with ok status, but with no messageid specified?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but ok let's keep it

@OskarStark
Copy link
Contributor

I would consider this a feature, it is working without the ID and must wait for 5.4.

cc @nicolas-grekas

@WaylandAce WaylandAce force-pushed the feature/slack_bridge_notifier_message_id branch from 374788d to 838f36b Compare April 27, 2021 17:17
@WaylandAce
Copy link
Contributor Author

I would consider this a feature, it is working without the ID and must wait for 5.4.

cc @nicolas-grekas

I though to put this change as usual to 5.x branch, but checked "Maintenance" page (https://symfony.com/doc/current/contributing/code/maintenance.html) and it's sounds like it matches the rules.
Also 1 point to include this featurefix to nearest release, is the fact, that we cant fetch message id to reply/start thread in slack and this can be seen as problem.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine merging it in 5.2.

@nicolas-grekas
Copy link
Member

Thank you @WaylandAce.

@nicolas-grekas nicolas-grekas merged commit d76bfb5 into symfony:5.2 May 7, 2021
This was referenced May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants