Skip to content

Commit

Permalink
add Publishing.Googlechat.ExtraLink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Nov 15, 2024
1 parent 0e5dc2c commit fc44519
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 17 additions & 3 deletions voctopublish/api_client/googlechat_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,23 @@ def send_chat_message(ticket, config):
}
)

if not buttons:
LOG.warning("GoogleChat: No buttons for videos, not sending message")
return
if ticket.googlechat_webhook_extralink:
if '|' not in ticket.googlechat_webhook_extralink:
link_url = ticket.googlechat_webhook_extralink
link_text = 'Link'
else:
link_text, link_url = ticket.googlechat_webhook_extralink.split('|', 1)

buttons.append(
{
"text": link_text,
"onClick": {
"openLink": {
"url": link_url,
},
},
}
)

if ticket.url:
buttons.append(
Expand Down
3 changes: 3 additions & 0 deletions voctopublish/model/ticket_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ def __init__(self, ticket, ticket_id, config):
self.googlechat_webhook_url = self._get_str(
"Publishing.Googlechat.Webhook", optional=True, try_default=True
)
self.googlechat_webhook_extralink = self._get_str(
"Publishing.Googlechat.ExtraLink", optional=True, try_default=True
)


class TicketException(Exception):
Expand Down

0 comments on commit fc44519

Please sign in to comment.