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
Co-authored-by: SimonLiuRoblox <84740141+SimonLiuRoblox@users.noreply.github.com>
@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.

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.

None yet

8 participants