-
Notifications
You must be signed in to change notification settings - Fork 18
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
[DUX-3058]: implement support for App Home tab #138
base: master
Are you sure you want to change the base?
Conversation
These events are sent when app home is enabled.
This is useful for if downstream users have to add new block types, or if we are decoding arbitrary input from Slack.
This also implements the bits necessary to add more of the views endpoints in the future, json-wise.
@@ -108,6 +110,15 @@ snakeCaseOptions = | |||
, constructorTagModifier = camelTo2 '_' | |||
} | |||
|
|||
-- | 'snakeCaseOptions' that eats trailing underscores. This is so that you can | |||
-- have a field called "type_". | |||
snakeCaseOptionsEatTrailing :: Options |
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.
The name is really long, but maybe it should be longer? snakeCaseOptionsEatTrailingUnderscores
= AppHome | ||
| AppHomeMessages | ||
| AppHomeOther Text |
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.
Should this be a newtype around Text
with constants for AppHomeTabHome = AppHomeTab "home"
and similar?
One pattern I’ve seen is to use another variant that represents an unknown value. The problem with this approach is that it becomes very hard to define equality and comparisons on these types. Are
Architecture::I386
andArchitecture::Unknown("i386")
the same, or are they different? In practice, this becomes tricky very quickly.
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.
Left a couple non-blocking nits
data ModalView = ModalView | ||
{ type_ :: Expected "modal" | ||
, title :: SlackPlainTextOnly | ||
-- ^ Title of the modal on the top left. Maximum length of 24 characters. |
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.
We could use one of our length-limited text types here, but I doubt it's worth it.
type Api = | ||
"views.publish" | ||
:> AuthProtect "token" | ||
:> ReqBody '[FormUrlEncoded] PublishReq | ||
:> Post '[JSON] (ResponseJSON PublishResp) |
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.
Non-blocking: I looked at the docs for :>
and I'm still not sure I understand it.
I trust that this is correct, but might be worth a comment? Is like... each part here an element of a URL path? But ReqBody
and Post
are other parts of the HTTP request...
This is so that Slacklinker can use it (and maybe we can also rip out some related code in the Mercury backend).
Before submitting your PR, check that you've:
@since
declarations to the HaddockAfter submitting your PR:
(unreleased)
on the Changelog