Skip to content
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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lf-
Copy link
Contributor

@lf- lf- commented Feb 25, 2025

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:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

lf- added 3 commits February 24, 2025 16:12
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.
Copy link

linear bot commented Feb 25, 2025

@@ -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
Copy link
Member

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

Comment on lines +278 to +280
= AppHome
| AppHomeMessages
| AppHomeOther Text
Copy link
Member

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 and Architecture::Unknown("i386") the same, or are they different? In practice, this becomes tricky very quickly.

https://sunshowers.io/posts/open-closed-universes/

Copy link
Member

@9999years 9999years left a 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.
Copy link
Member

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.

Comment on lines +127 to +131
type Api =
"views.publish"
:> AuthProtect "token"
:> ReqBody '[FormUrlEncoded] PublishReq
:> Post '[JSON] (ResponseJSON PublishResp)
Copy link
Member

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants