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

Add support for Rich Text Lists #1155

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

daniel-pieper-personio
Copy link
Contributor

@daniel-pieper-personio daniel-pieper-personio commented Jan 4, 2023

This PR adds support for rich text lists.
For example:

{
    "token": "...",
    "team_id": "...",
    "api_app_id": "...",
    "event": {
        "client_msg_id": "...",
        "type": "message",
        "text": "test message with list\n1. first point\n2. second point\n• first bullet\n• second bullet\n",
        "user": "...",
        "ts": "1672827783.092039",
        "blocks": [
            {
                "type": "rich_text",
                "block_id": "...",
                "elements": [
                    {
                        "type": "rich_text_section",
                        "elements": [
                            {
                                "type": "text",
                                "text": "test message with list\n"
                            }
                        ]
                    },
                    {
                        "type": "rich_text_list",
                        "elements": [
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "first point"
                                    }
                                ]
                            },
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "second point"
                                    }
                                ]
                            }
                        ],
                        "style": "ordered",
                        "indent": 0,
                        "border": 0
                    },
                    {
                        "type": "rich_text_list",
                        "elements": [
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "first bullet"
                                    }
                                ]
                            },
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "second bullet"
                                    }
                                ]
                            }
                        ],
                        "style": "bullet",
                        "indent": 0,
                        "border": 0
                    },
                    {
                        "type": "rich_text_section",
                        "elements": []
                    }
                ]
            }
        ],
        "team": "...",
        "channel": "...",
        "event_ts": "1672827783.092039",
        "channel_type": "im"
    },
    "type": "event_callback",
    "event_id": "...",
    "event_time": 1672827783,
    "authorizations": [
        {
            "enterprise_id": null,
            "team_id": "...",
            "user_id": "...",
            "is_bot": true,
            "is_enterprise_install": false
        }
    ],
    "is_ext_shared_channel": false,
    "event_context": "..."
}

Reference: https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less

Copy link

@PierekEast PierekEast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I produced almost identical code and then realised that there is an existing PR already. Good job! 🚀

block_rich_text.go Show resolved Hide resolved
block_rich_text.go Outdated Show resolved Hide resolved
block_rich_text.go Show resolved Hide resolved
block_rich_text.go Show resolved Hide resolved
block_rich_text_test.go Show resolved Hide resolved
@daniel-pieper-personio
Copy link
Contributor Author

@PierekEast would you mind triggering the workflow? I've updated the PR so it hopefully passes the linter :)

@PierekEast
Copy link

@PierekEast would you mind triggering the workflow? I've updated the PR so it hopefully passes the linter :)

Not sure I can do that 🤔

@david4shure
Copy link

Any updates here? Are there workarounds to using RichText lists?

@parsley42 parsley42 closed this Jan 17, 2024
@parsley42 parsley42 reopened this Jan 17, 2024
@parsley42
Copy link
Member

@david4shure Right now slack-go/slack is essentially unmaintained. I can add new maintainers, and have done some maintaining work in the past, but really what's needed is a current/daily Go developer with some open source experience, and ideally someone familiar with the programming patterns in this library. I haven't the expertise nor the time to stay on top of PR reviews and discussions.

I did, however, close + reopen so the tests would run, and apparently the linting test failed.

@chase-allen-tech
Copy link

Hi team. Could you please make this mergeable? My work is waiting for this to be completed.

@PierekEast
Copy link

Hey guys, I did fixed the linting problem locally, but I cannot push to the @daniel-pieper-personio branch.

Ideally, @daniel-pieper-personio - you could quickly change that and the linter should pass and then everybody will be happy :D

There was some whitespace that the go linter did not like:
image

If anyone knows how I could apply these changes to this repo, apart from taking everything from this branch and creating a separate PR, then I would appreciate being enlightened.

But in the end, I could do the above and mention that PR as a duplicate.

Cheers!

@rusq
Copy link
Contributor

rusq commented Feb 9, 2024

@nlopes I summon you. Only you can save the world!

Copy link
Member

@parsley42 parsley42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks harmless / useful. Approving.

@parsley42 parsley42 merged commit f6b09b8 into slack-go:master Feb 9, 2024
4 checks passed
@parsley42
Copy link
Member

Note that this library needs more maintainers. I'll occasionally review/merge, but don't consider myself qualified since I'm down to <100 lines of Go / year at this point. The only good thing about me is I occasionally respond.

ymotongpoo referenced this pull request in ymotongpoo/opentelemetry-collector-extra Jun 4, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/slack-go/slack](https://togithub.com/slack-go/slack) |
`v0.12.3` -> `v0.13.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fslack-go%2fslack/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fslack-go%2fslack/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fslack-go%2fslack/v0.12.3/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fslack-go%2fslack/v0.12.3/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>slack-go/slack (github.com/slack-go/slack)</summary>

###
[`v0.13.0`](https://togithub.com/slack-go/slack/releases/tag/v0.13.0)

[Compare
Source](https://togithub.com/slack-go/slack/compare/v0.12.5...v0.13.0)

> \[!WARNING]\
> This release includes a breaking change since the last release

#### What's Changed

##### Breaking changes

- Expose `team_id` parameter for use with org-wide app by
[@&#8203;candiduslynx](https://togithub.com/candiduslynx) in
[https://github.com/slack-go/slack/pull/1283](https://togithub.com/slack-go/slack/pull/1283):
    Changed interface:
    | Old | New |
    | --- | --- |
| `Client.GetBotInfo(bot string) (*Bot, error)` |
`Client.GetBotInfo(parameters GetBotInfoParameters) (*Bot, error)` |
| `Client.GetBotInfoContext(ctx context.Context, bot string)` |
`Client.GetBotInfoContext(ctx context.Context, parameters
GetBotInfoParameters)` |
| `Client.GetTeamProfile() (*TeamProfile, error)` |
`GetTeamProfile(teamID ...string) (*TeamProfile, error)` |
| `GetTeamProfileContext(ctx context.Context) (*TeamProfile, error)` |
`GetTeamProfileContext(ctx context.Context, teamID ...string)
(*TeamProfile, error)` |
| `Client.GetBillableInfo(user string) (map[string]BillingActive,
error)` | `Client.GetBillableInfo(params GetBillableInfoParams)
(map[string]BillingActive, error)` |
| `Client.GetBillableInfoContext(ctx context.Context, user string)
(map[string]BillingActive, error)` | `Client.GetBillableInfoContext(ctx
context.Context, params GetBillableInfoParams)
(map[string]BillingActive, error)` |
| `Client.GetBillableInfoForTeam() (map[string]BillingActive, error)` |
dropped, use `Client.GetBillableInfo` with empty params |
| `Client.GetBillableInfoForTeamContext(ctx context.Context)
(map[string]BillingActive, error)` | dropped, use
`Client.GetBillableInfoContext` with empty params |

##### Bug fixes

- Block Object: Validate text min and max length by
[@&#8203;Chagui-](https://togithub.com/Chagui-) in
[https://github.com/slack-go/slack/pull/1273](https://togithub.com/slack-go/slack/pull/1273)
- fix some typos by [@&#8203;yutasb](https://togithub.com/yutasb) in
[https://github.com/slack-go/slack/pull/1281](https://togithub.com/slack-go/slack/pull/1281)

##### Enhancements

- Add missing message option for link_names by
[@&#8203;robbydyer](https://togithub.com/robbydyer) in
[https://github.com/slack-go/slack/pull/1278](https://togithub.com/slack-go/slack/pull/1278)
- Expose `team_id` parameter for use with org-wide app by
[@&#8203;candiduslynx](https://togithub.com/candiduslynx) in
[https://github.com/slack-go/slack/pull/1283](https://togithub.com/slack-go/slack/pull/1283)

#### New Contributors

- [@&#8203;Chagui-](https://togithub.com/Chagui-) made their first
contribution in
[https://github.com/slack-go/slack/pull/1273](https://togithub.com/slack-go/slack/pull/1273)
- [@&#8203;robbydyer](https://togithub.com/robbydyer) made their first
contribution in
[https://github.com/slack-go/slack/pull/1278](https://togithub.com/slack-go/slack/pull/1278)
- [@&#8203;yutasb](https://togithub.com/yutasb) made their first
contribution in
[https://github.com/slack-go/slack/pull/1281](https://togithub.com/slack-go/slack/pull/1281)
- [@&#8203;candiduslynx](https://togithub.com/candiduslynx) made their
first contribution in
[https://github.com/slack-go/slack/pull/1283](https://togithub.com/slack-go/slack/pull/1283)

**Full Changelog**:
slack-go/slack@v0.12.5...v0.13.0

###
[`v0.12.5`](https://togithub.com/slack-go/slack/releases/tag/v0.12.5)

[Compare
Source](https://togithub.com/slack-go/slack/compare/v0.12.4...v0.12.5)

#### What's Changed

BUGFIX - deal with "true", true, "false", false.

- Parse string or boolean for SlashCommand.IsEnterpriseInstall by
[@&#8203;kpaulisse](https://togithub.com/kpaulisse) in
[https://github.com/slack-go/slack/pull/1266](https://togithub.com/slack-go/slack/pull/1266)

**Full Changelog**:
slack-go/slack@v0.12.4...v0.12.5

###
[`v0.12.4`](https://togithub.com/slack-go/slack/releases/tag/v0.12.4):
Non-breaking updates roll-up

[Compare
Source](https://togithub.com/slack-go/slack/compare/v0.12.3...v0.12.4)

#### What's Changed

- chore: unnecessary use of fmt.Sprintf by
[@&#8203;testwill](https://togithub.com/testwill) in
[https://github.com/slack-go/slack/pull/1212](https://togithub.com/slack-go/slack/pull/1212)
- Add Video Block by [@&#8203;walkure](https://togithub.com/walkure) in
[https://github.com/slack-go/slack/pull/1210](https://togithub.com/slack-go/slack/pull/1210)
- Add connected_team_ids optional field to Conversation by
[@&#8203;zFlabmonsta](https://togithub.com/zFlabmonsta) in
[https://github.com/slack-go/slack/pull/1253](https://togithub.com/slack-go/slack/pull/1253)
- Add blocks in slackevents.MessageEvent by
[@&#8203;invzhi](https://togithub.com/invzhi) in
[https://github.com/slack-go/slack/pull/1227](https://togithub.com/slack-go/slack/pull/1227)
- Add support for Rich Text Lists by
[@&#8203;daniel-pieper-personio](https://togithub.com/daniel-pieper-personio)
in
[https://github.com/slack-go/slack/pull/1155](https://togithub.com/slack-go/slack/pull/1155)
- Add support for Rich Text Input by
[@&#8203;peimanja](https://togithub.com/peimanja) in
[https://github.com/slack-go/slack/pull/1240](https://togithub.com/slack-go/slack/pull/1240)
- Fix: always add context to errors during block serde by
[@&#8203;yunginnanet](https://togithub.com/yunginnanet) in
[https://github.com/slack-go/slack/pull/1259](https://togithub.com/slack-go/slack/pull/1259)
- Edited field in the app mention event by
[@&#8203;IbirbyZh](https://togithub.com/IbirbyZh) in
[https://github.com/slack-go/slack/pull/1256](https://togithub.com/slack-go/slack/pull/1256)
- Expose is_enterprise_install field by
[@&#8203;7ail](https://togithub.com/7ail) in
[https://github.com/slack-go/slack/pull/1255](https://togithub.com/slack-go/slack/pull/1255)
- feat: Add the ability to set `URL` on `NewButtonBlockElement` via
`.WithURL()` by [@&#8203;joshbranham](https://togithub.com/joshbranham)
in
[https://github.com/slack-go/slack/pull/1250](https://togithub.com/slack-go/slack/pull/1250)
- Add block element type FileInput by
[@&#8203;elct9620](https://togithub.com/elct9620) in
[https://github.com/slack-go/slack/pull/1249](https://togithub.com/slack-go/slack/pull/1249)
- Openid connect by
[@&#8203;danielmichaels](https://togithub.com/danielmichaels) in
[https://github.com/slack-go/slack/pull/1242](https://togithub.com/slack-go/slack/pull/1242)
- Add is_enterprise_install flag for org wide installation support by
[@&#8203;hussachai](https://togithub.com/hussachai) in
[https://github.com/slack-go/slack/pull/1225](https://togithub.com/slack-go/slack/pull/1225)
- Add an example of updating modal by
[@&#8203;KouWakai](https://togithub.com/KouWakai) in
[https://github.com/slack-go/slack/pull/1142](https://togithub.com/slack-go/slack/pull/1142)
- add deleted timestamp for deleted msg events by
[@&#8203;zFlabmonsta](https://togithub.com/zFlabmonsta) in
[https://github.com/slack-go/slack/pull/1261](https://togithub.com/slack-go/slack/pull/1261)
- Add slack connect events & tests by
[@&#8203;Birtato](https://togithub.com/Birtato) in
[https://github.com/slack-go/slack/pull/1262](https://togithub.com/slack-go/slack/pull/1262)
- Add rich_text_quote and rich_text_preformatted by
[@&#8203;rusq](https://togithub.com/rusq) in
[https://github.com/slack-go/slack/pull/1260](https://togithub.com/slack-go/slack/pull/1260)

#### New Contributors

- [@&#8203;testwill](https://togithub.com/testwill) made their first
contribution in
[https://github.com/slack-go/slack/pull/1212](https://togithub.com/slack-go/slack/pull/1212)
- [@&#8203;walkure](https://togithub.com/walkure) made their first
contribution in
[https://github.com/slack-go/slack/pull/1210](https://togithub.com/slack-go/slack/pull/1210)
- [@&#8203;zFlabmonsta](https://togithub.com/zFlabmonsta) made their
first contribution in
[https://github.com/slack-go/slack/pull/1253](https://togithub.com/slack-go/slack/pull/1253)
- [@&#8203;invzhi](https://togithub.com/invzhi) made their first
contribution in
[https://github.com/slack-go/slack/pull/1227](https://togithub.com/slack-go/slack/pull/1227)
-
[@&#8203;daniel-pieper-personio](https://togithub.com/daniel-pieper-personio)
made their first contribution in
[https://github.com/slack-go/slack/pull/1155](https://togithub.com/slack-go/slack/pull/1155)
- [@&#8203;peimanja](https://togithub.com/peimanja) made their first
contribution in
[https://github.com/slack-go/slack/pull/1240](https://togithub.com/slack-go/slack/pull/1240)
- [@&#8203;yunginnanet](https://togithub.com/yunginnanet) made their
first contribution in
[https://github.com/slack-go/slack/pull/1259](https://togithub.com/slack-go/slack/pull/1259)
- [@&#8203;IbirbyZh](https://togithub.com/IbirbyZh) made their first
contribution in
[https://github.com/slack-go/slack/pull/1256](https://togithub.com/slack-go/slack/pull/1256)
- [@&#8203;joshbranham](https://togithub.com/joshbranham) made their
first contribution in
[https://github.com/slack-go/slack/pull/1250](https://togithub.com/slack-go/slack/pull/1250)
- [@&#8203;elct9620](https://togithub.com/elct9620) made their first
contribution in
[https://github.com/slack-go/slack/pull/1249](https://togithub.com/slack-go/slack/pull/1249)
- [@&#8203;danielmichaels](https://togithub.com/danielmichaels) made
their first contribution in
[https://github.com/slack-go/slack/pull/1242](https://togithub.com/slack-go/slack/pull/1242)
- [@&#8203;KouWakai](https://togithub.com/KouWakai) made their first
contribution in
[https://github.com/slack-go/slack/pull/1142](https://togithub.com/slack-go/slack/pull/1142)
- [@&#8203;Birtato](https://togithub.com/Birtato) made their first
contribution in
[https://github.com/slack-go/slack/pull/1262](https://togithub.com/slack-go/slack/pull/1262)

**Full Changelog**:
slack-go/slack@v0.12.3...v0.12.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ymotongpoo/opentelemetry-collector-extra).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants