From 81498bd131b54bdec59755fe0e0ec1f6682e3211 Mon Sep 17 00:00:00 2001
From: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Date: Thu, 15 Apr 2021 10:58:39 +0200
Subject: [PATCH] DEV: updates to onebox 2.2.14 (#12713)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit also updates github’s body onebox styles in Discourse core:
- full width
- prevents show-more btn to trigger vertical scrolling
- makes text standout less and slightly bigger
---
 Gemfile.lock                                        |  2 +-
 .../discourse/app/initializers/onebox-decorators.js |  2 +-
 app/assets/stylesheets/common/base/onebox.scss      | 13 ++++---------
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index a30f2007882..654c401207d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -268,7 +268,7 @@ GEM
     omniauth-twitter (1.4.0)
       omniauth-oauth (~> 1.1)
       rack
-    onebox (2.2.13)
+    onebox (2.2.14)
       addressable (~> 2.7.0)
       htmlentities (~> 4.3)
       multi_json (~> 1.11)
diff --git a/app/assets/javascripts/discourse/app/initializers/onebox-decorators.js b/app/assets/javascripts/discourse/app/initializers/onebox-decorators.js
index f80fc6c6d6a..5b157b2e03e 100644
--- a/app/assets/javascripts/discourse/app/initializers/onebox-decorators.js
+++ b/app/assets/javascripts/discourse/app/initializers/onebox-decorators.js
@@ -4,7 +4,7 @@ let _showMoreClickPostsElements = [];
 
 function decorateGithubOneboxBody(element) {
   const containers = element.querySelectorAll(
-    ".onebox.githubpullrequest .show-more-container, .onebox.githubissue .show-more-container"
+    ".onebox.githubcommit .show-more-container, .onebox.githubpullrequest .show-more-container, .onebox.githubissue .show-more-container"
   );
 
   if (containers.length) {
diff --git a/app/assets/stylesheets/common/base/onebox.scss b/app/assets/stylesheets/common/base/onebox.scss
index e88206f062e..ddbc7e63323 100644
--- a/app/assets/stylesheets/common/base/onebox.scss
+++ b/app/assets/stylesheets/common/base/onebox.scss
@@ -161,26 +161,21 @@ aside.onebox {
       }
     }
 
-    .github-info + .github-body-container {
-      margin-top: 1em;
-    }
-
     .github-body-container {
-      margin: 0 0 0.5em 0;
-      padding: 0.5em;
+      margin: 1em 0 0 0;
       color: var(--primary-very-high);
-      background: var(--hljs-bg);
       max-height: 400px;
       white-space: pre-wrap;
       overflow-y: auto;
       word-break: break-word;
       font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono",
         "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace;
-      font-size: $font-down-1;
+      flex: 1 0 100%;
+      box-sizing: border-box;
 
       .show-more {
         // padding on right for larger hitzone
-        padding: 0.5em 1.5em 0.5em 0.25em;
+        padding: 0.5em 1.5em 0em 0.25em;
       }
     }