-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] [Slack] Add button block element and emoji
/verbatim
options to section block
#54737
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
[Notifier] [Slack] Add button block element and emoji
/verbatim
options to section block
#54737
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after my comment
if ($markdown) { | ||
$this->options['text']['verbatim'] = $verbatim; | ||
} else { | ||
$this->options['text']['emoji'] = $emoji; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's 3 correlated options, that makes it hard to reason about them.
Would it make sense to add only one option, either verbatim or emoji and send the appropriate setting to slack automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well in term of behavior on Slack, verbatim == !emoji)
(except verbatim is for auto-URL parsing, emoji for emoji escaping).
So maybe we can keep only verbatim
option then having the following code if it's what you have in mind ? :)
if ($markdown) {
$this->options['text']['verbatim'] = $verbatim;
} else {
$this->options['text']['emoji'] = !$verbatim
}
But what about SlackContextBlock
already having these two options and same condition ?
Removing emoji
would be a BC (or we need to deprecate it ?), but keeping only emoji
has less sense that verbatim
in the meaning of the option in Slack :/
…tions to section block
5d4302b
to
e9b7954
Compare
Thank you @cvergne. |
…k element and emoji/verbatim options (cvergne) This PR was merged into the 7.2 branch. Discussion ---------- [Notifier] [Slack] Add README examples about button block element and emoji/verbatim options | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix symfony/symfony-docs#19929 | License | MIT This PR is just a followup of my previously merged PR #54737. Following the merge, [an issue was created about documentation](symfony/symfony-docs#19929), but each Notifier Bridge documentation is directly in README of each bridge so here it is :) Commits ------- 1a52e87 [Notifier] [Slack] Add README examples about button block element and emoji/verbatim options to section block
…k element and emoji/verbatim options (cvergne) This PR was merged into the 7.2 branch. Discussion ---------- [Notifier] [Slack] Add README examples about button block element and emoji/verbatim options | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix symfony/symfony-docs#19929 | License | MIT This PR is just a followup of my previously merged PR symfony/symfony#54737. Following the merge, [an issue was created about documentation](symfony/symfony-docs#19929), but each Notifier Bridge documentation is directly in README of each bridge so here it is :) Commits ------- 1a52e8717f [Notifier] [Slack] Add README examples about button block element and emoji/verbatim options to section block
Hi,
When using the Slack Notifier bridge, I've noticed it wasn't possible to add a button as accessory to a section because button is only managed in the SlackActionsBlock, which is not allowed as an accessory in a Section block.
So the first purpose of this PR is add a SlackButtonBlockElement we can use as
accessory
into a section block (and use that block into SlackActionsBlock as it follows the same structure).Then, I noticed
verbatim
(for markdown) andemoji
(for plain text) options were not available in SectionBlock (but available in ContextBlock), so I've added them.Note that originally, I was going to add them as optional arguments (
?bool $verbatim = null
) to avoid adding them if not explicitly given and keep the Slack default value, but the ContextBlock adds a default value (the same as Slack) for them, so I kept the same argument signature.You can see an example of both use of button as accessory and verbatim param with the following link on Slack Block Kit Builder (must be logged in to a Slack Account).
These minor additions are in the same PR, but tell me if I should split them into two PRs.
Thanks :)