Fix bridge/slack build breakage from slack-go/slack v0.23.1 API changes - #4
Merged
Conversation
Several fields the Slack bridge relied on moved or were renamed in the slack-go/slack dependency (introduced via a dependabot bump), breaking compilation: - slack.Msg field casing changed: TimeStamp -> Timestamp, ThreadTimeStamp -> ThreadTimestamp. - slackevents.MessageEvent no longer carries its own top-level Attachments/Files fields. MessageEvent's custom UnmarshalJSON now always populates .Message (synthesized from the top-level JSON for regular messages, or the real nested object for message_changed), so all attachment/file handling now reads from ev.Message instead. This also makes the old top-level "legacy/RTM attachments blocks" callback-ID check in skipMessageEvent redundant with the existing ev.Message.Attachments check, so it's removed rather than duplicated. - filesCached/fileCached/handleDownloadFile now take slack.File instead of slackevents.File, since file data now only exists as slack.Msg.Files ([]slack.File); the two File types are structurally different and not interchangeable. - slack.FileUploadParameters was renamed to UploadFileParameters as part of the files.upload -> files.upload.v2 migration, and now takes a single Channel string (not Channels []string) and requires FileSize. The returned FileSummary no longer carries Shares, so uploadFile now does a follow-up GetFileInfo call to resolve the message id/thread timestamp of the uploaded file's share. Verified: bridge/slack, bridge/config and bridge/irc all build clean, go vet clean, existing bridge/slack tests pass, and a full binary build (previously failing) now succeeds.
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.
Summary
Several fields the Slack bridge relied on moved or were renamed in the
slack-go/slackdependency (pulled in via the recent dependabot bump), breaking compilation:slack.Msgfield casing changed:TimeStamp->Timestamp,ThreadTimeStamp->ThreadTimestamp.slackevents.MessageEventno longer carries its own top-levelAttachments/Filesfields.MessageEvent's customUnmarshalJSONnow always populates.Message(synthesized from the top-level JSON for regular messages, or the real nested object formessage_changed), so all attachment/file handling now reads fromev.Messageinstead. This also makes the old top-level "legacy/RTM attachments blocks" callback-ID check inskipMessageEventredundant with the existingev.Message.Attachmentscheck, so it's removed rather than duplicated.filesCached/fileCached/handleDownloadFilenow takeslack.Fileinstead ofslackevents.File, since file data now only exists asslack.Msg.Files([]slack.File); the twoFiletypes are structurally different and not interchangeable.slack.FileUploadParameterswas renamed toUploadFileParametersas part of thefiles.upload->files.upload.v2migration, and now takes a singleChannel string(notChannels []string) and requiresFileSize. The returnedFileSummaryno longer carriesShares, souploadFilenow does a follow-upGetFileInfocall to resolve the message id/thread timestamp of the uploaded file's share.Test plan
bridge/slack,bridge/config,bridge/ircall build cleango vetcleanbridge/slacktests pass