feat(update-dialog): Slack sign-in button with background polling - #130
Merged
Conversation
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
block-kitchen | 949f8c5 | Commit Preview URL Branch Preview URL |
Jul 01 2026, 07:27 PM |
StephenTangCook
force-pushed
the
claude/slack-signin-poll
branch
from
July 1, 2026 18:22
8b818ce to
37e9d53
Compare
Under the "Connect your Slack account to edit your own messages" prompt, surface a real "Sign in with Slack" button (user-token path only). It opens the OAuth URL in a new tab and background-polls loadSendAsUserStatus every 2.5s so the dialog unlocks itself the moment sign-in completes, instead of relying solely on the window-focus refresh. Shows a spinner while polling, disables the button meanwhile, and caps at 24 polls (~1 min). The interval is cleared on success, dialog close, and unmount. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tton Both SendDialog and UpdateDialog duplicated the same user-token plumbing (status state, ref-to-latest loader, refresh, window-focus refresh). Pull it into a single useSlackSignIn hook alongside a SlackSignInButton component in slack-sign-in.tsx, and consume it from both dialogs. Also gives SendDialog the same background OAuth polling + spinner that UpdateDialog had: its "Sign in with Slack" affordance is now the shared button that opens the OAuth tab and polls until the token appears (capped ~1 min). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restructure each recent-message row into the Slack message layout: a small square avatar (message iconUrl when it's a safe image, else an initial square), the author name with the You/Bot badge beside it, then the date with the (timestamp) in parens, then the message snippet in regular foreground text. The snippet prefers the host's `label`, falling back to the first header/section text or a block count. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Clicking a recent-message preview now selects it (highlighted, aria-pressed) instead of loading immediately; the footer "Load message" button performs the load. Selection and the pasted link are mutually exclusive — typing a link clears the selection and vice versa — and the button enables when either is present. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the two-block sampleBlocks() with a realistic multi-block message (header, byline context, formatted body with image accessory, code snippet, action row, footer) and give each seed a descriptive title, so the editor and previews have something substantial to render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
StephenTangCook
force-pushed
the
claude/slack-signin-poll
branch
from
July 1, 2026 18:34
37e9d53 to
5f962d8
Compare
Point the demo's mock oauthUrl at a new public/mock-oauth.html page that sets a localStorage flag, and have loadSendAsUserStatus poll that flag. Now the full loop works end to end: uncheck "User can edit their own messages", open the Send or Edit dialog, click "Sign in with Slack" (the mock page opens and "completes" sign-in), and the dialog's background poll unlocks it. Clearing the flag on mount and when the box is re-unchecked keeps the flow repeatable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The "Open as a new message instead" button only makes sense when the not-editable verdict carries blocks to carry over. A no-match verdict has none, so there is nothing to open. Gate the button on blocks being present, so a "No message matched that link." result shows only its reason. Also trim the demo's no-match reason to just that sentence. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The selected recent-message row used a non-inset ring, which the list's overflow-y-auto clipped at the corners. Switch the selected state (and the focus ring) to inset rings and pair a primary border with a 1px inset ring for a clean, uniform outline that renders fully inside the scroll area. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reframe the edit-mode entry as "find an existing message": the dialog title becomes "Find an existing message", the footer confirm button and the toolbar entry button (loadButtonLabel default) become "Find message". Updates the docs, story, tests, and demo copy to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Let the not-editable LoadResult verdict carry an optional oauthUrl. When the host returns it (e.g. the user pasted their own message but has no user token), the find dialog renders the shared "Sign in with Slack" button: it opens the OAuth tab and re-checks the load on an interval (capped ~1 min), advancing into edit mode once the host reports the message editable. The demo's onLoadMessage now gates the user's own messages up front — returning that verdict with the mock oauthUrl when there's no token — so pasting a self-message link offers the sign-in link instead of loading a message that can't be updated without re-auth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Float a copy button in the top-right corner of the Block Kit JSON code pane. Clicking it writes the current JSON to the clipboard and swaps the icon to a checkmark for ~2s. Clipboard failures (insecure context / denied) are a no-op. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Under the "Connect your Slack account to edit your own messages" prompt in the update dialog (user-token path only), surface a real Sign in with Slack button.
window.open, guarded by the existingisSafeHref).loadSendAsUserStatusevery 2.5s so the dialog unlocks itself the moment sign-in completes, rather than relying solely on the existing window-focus refresh.Tests
Added
test/update-dialog-signin.test.tsx:Full suite: 361 passing. Typecheck + biome clean.
Notes
send-dialog.tsxhas the same "Sign in with Slack" link but still relies on focus-refresh — can mirror this there if wanted.🤖 Generated with Claude Code