42wim/matterircd

Support for matterpoll

axinojolais opened this issue · 2 comments

Hi,

On the mattermost I use, the matterpoll plugin has just been installed. When someone creates or reacts to a poll, I now get weird "edited" messages from a "matterpoll" user. I don't think I can see the poll question or options, and I can't cast my vote on the poll.

Would it be possible to better handle this ? Even if it's just read-only for now - ie just display the poll options and what people vote for.

Thanks !

FWIW, an example matterpoll post looks like this:

{
    "id": "mjpohg3kcbgbjx59wt4jwhfy9c",
    "create_at": 1615452127420,
    "update_at": 1615452127420,
    "edit_at": 0,
    "delete_at": 0,
    "is_pinned": false,
    "user_id": "kj1g...",
    "channel_id": "pkn6xmxn37rix85w4uurjpkoqo",
    "root_id": "",
    "parent_id": "",
    "original_id": "",
    "message": "",
    "type": "custom_matterpoll",
    "props": {
        "attachments": [
            {
                "id": 0,
                "fallback": "",
                "color": "",
                "pretext": "",
                "author_name": "Some User",
                "author_link": "",
                "author_icon": "",
                "title": "Question?",
                "title_link": "",
                "text": "---\\n**Total votes**: 0",
                "fields": null,
                "image_url": "",
                "thumb_url": "",
                "footer": "",
                "footer_icon": "",
                "ts": null,
                "actions": [
                    {
                        "id": "vote0",
                        "type": "button",
                        "name": "Answer 1"
                    },
                    {
                        "id": "vote1",
                        "type": "button",
                        "name": "Answer 2"
                    },
                    {
                        "id": "addOption",
                        "type": "button",
                        "name": "Add Option"
                    },
                    {
                        "id": "deletePoll",
                        "type": "custom_matterpoll_admin_button",
                        "name": "Delete Poll"
                    },
                    {
                        "id": "endPoll",
                        "type": "custom_matterpoll_admin_button",
                        "name": "End Poll"
                    }
                ]
            }
        ],
        "from_bot": "true",
        "poll_id": "t7uii3t66pd4tfgjtbutkshtfr"
    },
    "hashtags": "",
    "pending_post_id": "",
    "reply_count": 0,
    "last_reply_at": 0,
    "participants": null,
    "metadata": {
        "embeds": [
            {
                "type": "message_attachment"
            }
        ]
    }
}

With debug/trace enabled:

DEBU[2021-03-11T19:42:08+11:00] handleWsActionPost() receiving userid kj1goox8m7no78n791cdfnnxfh
DEBU[2021-03-11T19:42:08+11:00] handleWsActionPost() user matterpoll sent
DEBU[2021-03-11T19:42:08+11:00] &model.Post{...}
DEBU[2021-03-11T19:42:08+11:00] in handleWsMessage1
42wim commented

Fixed in master