-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'slack-go:master' into richtext-list
- Loading branch information
Showing
36 changed files
with
1,331 additions
and
194 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Close stale issues and PRs' | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 1' # every Monday 0:00 UTC | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 | ||
with: | ||
any-of-labels: 'feedback given' | ||
days-before-stale: 45 | ||
days-before-pr-close: 10 | ||
stale-issue-message: 'This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' | ||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' | ||
close-issue-message: 'This issue was closed because it has been stalled for 10 days with no activity.' | ||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' | ||
operations-per-run: 120 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package slack | ||
|
||
// VideoBlock defines data required to display a video as a block element | ||
// | ||
// More Information: https://api.slack.com/reference/block-kit/blocks#video | ||
type VideoBlock struct { | ||
Type MessageBlockType `json:"type"` | ||
VideoURL string `json:"video_url"` | ||
ThumbnailURL string `json:"thumbnail_url"` | ||
AltText string `json:"alt_text"` | ||
Title *TextBlockObject `json:"title"` | ||
BlockID string `json:"block_id,omitempty"` | ||
TitleURL string `json:"title_url,omitempty"` | ||
AuthorName string `json:"author_name,omitempty"` | ||
ProviderName string `json:"provider_name,omitempty"` | ||
ProviderIconURL string `json:"provider_icon_url,omitempty"` | ||
Description *TextBlockObject `json:"description,omitempty"` | ||
} | ||
|
||
// BlockType returns the type of the block | ||
func (s VideoBlock) BlockType() MessageBlockType { | ||
return s.Type | ||
} | ||
|
||
// NewVideoBlock returns an instance of a new Video Block type | ||
func NewVideoBlock(videoURL, thumbnailURL, altText, blockID string, title *TextBlockObject) *VideoBlock { | ||
return &VideoBlock{ | ||
Type: MBTVideo, | ||
VideoURL: videoURL, | ||
ThumbnailURL: thumbnailURL, | ||
AltText: altText, | ||
BlockID: blockID, | ||
Title: title, | ||
} | ||
} | ||
|
||
// WithAuthorName sets the author name for the VideoBlock | ||
func (s *VideoBlock) WithAuthorName(authorName string) *VideoBlock { | ||
s.AuthorName = authorName | ||
return s | ||
} | ||
|
||
// WithTitleURL sets the title URL for the VideoBlock | ||
func (s *VideoBlock) WithTitleURL(titleURL string) *VideoBlock { | ||
s.TitleURL = titleURL | ||
return s | ||
} | ||
|
||
// WithDescription sets the description for the VideoBlock | ||
func (s *VideoBlock) WithDescription(description *TextBlockObject) *VideoBlock { | ||
s.Description = description | ||
return s | ||
} | ||
|
||
// WithProviderIconURL sets the provider icon URL for the VideoBlock | ||
func (s *VideoBlock) WithProviderIconURL(providerIconURL string) *VideoBlock { | ||
s.ProviderIconURL = providerIconURL | ||
return s | ||
} | ||
|
||
// WithProviderName sets the provider name for the VideoBlock | ||
func (s *VideoBlock) WithProviderName(providerName string) *VideoBlock { | ||
s.ProviderName = providerName | ||
return s | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package slack | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewVideoBlock(t *testing.T) { | ||
|
||
videoTitle := NewTextBlockObject("plain_text", "VideoTitle", false, false) | ||
videoBlock := NewVideoBlock( | ||
"https://example.com/example.mp4", | ||
"https://example.com/thumbnail.png", | ||
"alternative text", "blockID", videoTitle) | ||
|
||
assert.Equal(t, string(videoBlock.Type), "video") | ||
assert.Equal(t, videoBlock.Title.Type, "plain_text") | ||
assert.Equal(t, videoBlock.BlockID, "blockID") | ||
assert.Contains(t, videoBlock.Title.Text, "VideoTitle") | ||
assert.Contains(t, videoBlock.VideoURL, "example.mp4") | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.