0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-12 05:37:26 +08:00
discourse/plugins/chat/spec/models/chat
Régis Hanol f3680621bc
FEATURE: GitHub PR live status icon (#36313)
I wanted a better way to show a live/up-to-date status of a PR than what
the https://github.com/discourse/github-status-theme provided.

First, I wanted it to work on any PR, including ones in private
repositories.

Second, I wanted to include the approved status, which requires a 2nd
call to GitHub's API.

Third, I wanted something that was less "intrusive" than the
"shield-like" status, so I opted out to use the icons & color that
GitHub uses (but maybe that's a bad idea).

After a first PoC that was a dump proxy to handle authentication for private repositories, the idea to use org webhooks was raised and turned out to be much lighter and easier than figuring out a proper caching strategy.

So this adds support for receiving `pull_request` and `pull_request_review` webhooks events to schedule a background job that will rebake posts and chat messages that have a link to the mentioned PR.

The GitHub PR onebox has been updated to query and parse the review state so we can have a better icon.

This also adds the `Chat::MessageLink` model (that is the #chat version of `TopicLink`) to help better keep track of links posted in chat.

**BEFORE**

<img width="1525" height="1356" alt="BEFORE"
src="https://github.com/user-attachments/assets/02f66137-9f4f-4a91-b321-73816161e204"
/>


**AFTER**

<img width="1525" height="1356" alt="AFTER"
src="https://github.com/user-attachments/assets/2164b7ef-8cd0-4cec-aea8-936a76a94fb2"
/>


Internal ref - t/17138
2025-12-04 21:42:44 +01:00
..
category_channel_spec.rb FIX: Error when leaving group DM channel (#31537) 2025-02-27 14:26:07 +10:00
channel_archive_spec.rb DEV: add maxlength to additional chat text columns (#23505) 2023-09-12 14:52:50 +08:00
channel_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
direct_message_channel_spec.rb FEATURE: disable chat DM threads by default (#34840) 2025-09-17 16:52:13 +04:00
direct_message_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
draft_spec.rb
incoming_webhook_spec.rb DEV: add maxlength to additional chat text columns (#23505) 2023-09-12 14:52:50 +08:00
message_link_spec.rb FEATURE: GitHub PR live status icon (#36313) 2025-12-04 21:42:44 +01:00
message_reaction_spec.rb DEV: add maxlength to additional chat text columns (#23505) 2023-09-12 14:52:50 +08:00
message_revision_spec.rb DEV: add maxlength limits to chat messages and revisions (#23530) 2023-09-12 18:02:04 +08:00
message_spec.rb A11Y: add aria-label to automatically generated heading anchor links in posts (#36232) 2025-11-25 18:29:20 -05:00
null_message_spec.rb FIX: build chat message excerpt for thread preview (#26765) 2024-04-26 14:29:35 +08:00
null_user_spec.rb DEV: Remove unnecessary rails_helper requiring (#26364) 2024-03-26 11:32:01 +01:00
reviewable_chat_message_spec.rb FIX: Make the 'Keep Message Deleted' reviewable option work (#32345) 2025-04-17 07:35:08 +03:00
thread_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_chat_thread_membership_spec.rb DEV: Create UserChatThreadMembership table and model (#21481) 2023-05-10 17:19:48 +02:00