Improve support for old browsers (#9515)

Improve support for old browsers (#9515)

  • FEATURE: Improve crawler view

  • FIX: Make lazyYT crawler-friendly

  • DEV: Rename discourse-internet-explorer to discourse-unsupported-browser

  • DEV: Detect more unsupported browsers

Follow-up to 4eebbd221239eaa3fc7e6f1bd6a9dcf0239b8444.

  • FIX: Hide browser update notice in print view
diff --git a/.gitignore b/.gitignore
index bc22f48..97d1a6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,7 +54,7 @@ bootsnap-compile-cache/
 !/plugins/discourse-narrative-bot
 !/plugins/discourse-presence
 !/plugins/discourse-local-dates
-!/plugins/discourse-internet-explorer
+!/plugins/discourse-unsupported-browser
 /plugins/*/auto_generated/
 
 /spec/fixtures/plugins/my_plugin/auto_generated
diff --git a/app/assets/javascripts/browser-detect.js b/app/assets/javascripts/browser-detect.js
index bdbbc27..c13298d 100644
--- a/app/assets/javascripts/browser-detect.js
+++ b/app/assets/javascripts/browser-detect.js
@@ -1,3 +1,12 @@
 if (!window.WeakMap || !window.Promise) {
   window.unsupportedBrowser = true;
+} else {
+  // Some implementations of `WeakMap.prototype.has` do not accept false
+  // values and Ember's `isClassicDecorator` sometimes does that (it only
+  // checks for `null` and `undefined`).
+  try {
+    new WeakMap().has(0);
+  } catch (err) {
+    window.unsupportedBrowser = true;
+  }
 }
diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scss
index 5b9cff0..01fc70a 100644
--- a/app/assets/stylesheets/common/base/_topic-list.scss
+++ b/app/assets/stylesheets/common/base/_topic-list.scss
@@ -142,6 +142,12 @@
     }
   }
 
+  .link-bottom-line {
+    .category-name {
+      margin-right: 12px;
+    }
+  }
+
   .unread-indicator {
     &.read {
       display: none;
diff --git a/app/assets/stylesheets/common/base/crawler_layout.scss b/app/assets/stylesheets/common/base/crawler_layout.scss
index 8f42f9a..c0ca931 100644
--- a/app/assets/stylesheets/common/base/crawler_layout.scss
+++ b/app/assets/stylesheets/common/base/crawler_layout.scss
@@ -21,12 +21,6 @@ body.crawler {
     }
   }
 
-  .raw-topic-link {
-    display: block;
-    font-weight: bold;
-    margin-bottom: 0.25em;
-  }
-
   .topic-list {
     margin-bottom: 1em;
   }
@@ -34,6 +28,14 @@ body.crawler {
   footer {
     margin-top: 4em;
   }
+
+  .category-title {
+    color: $primary;
+  }
+
+  .discourse-tags {
+    color: $primary-medium;
+  }
 }
 
 .noscript-footer-nav {
@@ -47,10 +49,7 @@ body.crawler {
 
 #noscript-footer {
   padding: 0 10px;
-}
-
-.crawler-topic-title {
-  margin-top: 0.5em;
+  text-align: center;
 }
 
 .crawler-post {
@@ -86,27 +85,6 @@ body.crawler {
   }
 }
 
-#breadcrumbs {
-  margin-bottom: 0.5em;
-  font-size: $font-up-1;
-  > div {
-    margin-bottom: 0.15em;
-  }
-  .badge-category-bg {
-    background-color: $secondary-high;
-  }
-  .category-title {
-    color: $primary;
-  }
-}
-
-.crawler-tags-list {
-  span {
-    display: block;
-    margin-bottom: 0.15em;
-  }
-}
-
 .crawler-linkback-list {
   margin-top: 1em;
   a {
diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb
index 4f4a56b..0020423 100644
--- a/app/helpers/topics_helper.rb
+++ b/app/helpers/topics_helper.rb
@@ -12,9 +12,9 @@ module TopicsHelper
     category = topic.category
 
     if category && !category.uncategorized?
-      breadcrumb.push(url: category.url, name: category.name)
+      breadcrumb.push(url: category.url, name: category.name, color: category.color)
       while category = category.parent_category
-        breadcrumb.prepend(url: category.url, name: category.name)
+        breadcrumb.prepend(url: category.url, name: category.name, color: category.color)
       end
     end
 
diff --git a/app/views/layouts/crawler.html.erb b/app/views/layouts/crawler.html.erb
index e8fc43c..b5a8345 100644
--- a/app/views/layouts/crawler.html.erb
+++ b/app/views/layouts/crawler.html.erb
@@ -34,13 +34,13 @@
       <%= yield %>
     </div>
     <footer class="container wrap">
-      <nav class='crawler-nav' itemscope itemtype='http://schema.org/SiteNavigationElement'>
+      <nav class='crawler-nav'>
         <ul>
-        <li itemprop="name"><a href='<%= path "/" %>' itemprop="url"><%= t 'home_title' %> </a></li>
-        <li itemprop="name"><a href='<%= path "/categories" %>' itemprop="url"><%= t 'js.filters.categories.title' %> </a></li>
-        <li itemprop="name"><a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a></li>
-        <li itemprop="name"><a href='<%= path "/tos" %>' itemprop="url"><%= t 'tos_topic.title' %> </a></li>
-        <li itemprop="name"><a href='<%= path "/privacy" %>' itemprop="url"><%= t 'privacy_topic.title' %> </a></li>
+        <li itemscope itemtype='http://schema.org/SiteNavigationElement' itemprop="name"><a href='<%= path "/" %>' itemprop="url"><%= t 'home_title' %> </a></li>
+        <li itemscope itemtype='http://schema.org/SiteNavigationElement' itemprop="name"><a href='<%= path "/categories" %>' itemprop="url"><%= t 'js.filters.categories.title' %> </a></li>
+        <li itemscope itemtype='http://schema.org/SiteNavigationElement' itemprop="name"><a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a></li>
+        <li itemscope itemtype='http://schema.org/SiteNavigationElement' itemprop="name"><a href='<%= path "/tos" %>' itemprop="url"><%= t 'tos_topic.title' %> </a></li>
+        <li itemscope itemtype='http://schema.org/SiteNavigationElement' itemprop="name"><a href='<%= path "/privacy" %>' itemprop="url"><%= t 'privacy_topic.title' %> </a></li>
         </ul>
       </nav>
       <p class='powered-by-link'><%= t 'powered_by_html' %></p>
diff --git a/app/views/list/list.erb b/app/views/list/list.erb
index af99862..77bb68d 100644
--- a/app/views/list/list.erb
+++ b/app/views/list/list.erb
@@ -44,7 +44,9 @@
     <thead>
       <tr>
         <th><%= t 'js.topic.title' %></th>
+        <th></th>
         <th><%= t 'js.replies' %></th>
+        <th><%= t 'js.views' %></th>
         <th><%= t 'js.activity' %></th>
       </tr>
     </thead>
@@ -52,25 +54,53 @@
     <tbody>
       <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
       <% @list.topics.each_with_index do |t,i| %>
-        <tr>
-          <td itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
-            <meta itemprop='position' content='<%= i %>'>
-            <meta itemprop='url' content='<%= t.url %>'>
+        <tr class="topic-list-item">
+          <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
             <meta itemprop='name' content='<%= t.title %>'>
-            <a href='<%= t.url %>' class='title raw-link raw-topic-link'>
-              <span><%= t.title %></span>
-            </a>
-            <% if (!@category || @category.has_children?) && t.category %>
-              <div>
-                <a href='<%= t.category.url %>'><span class='category-name'><%= t.category.name %></span></a>
-              </div>
+            <meta itemprop='url' content='<%= t.url %>'>
+            <% if t.image_url.present? %>
+              <meta itemprop='image' content='<%= t.image_url %>'>
             <% end %>
+            <meta itemprop='position' content='<%= i + 1 %>'>
+            <span class="link-top-line">
+              <a href='<%= t.url %>' class='title raw-link raw-topic-link'><%= t.title %></a>
+            </span>
+            <div class="link-bottom-line">
+              <% if (!@category || @category.has_children?) && t.category %>
+                <a href='<%= t.category.url %>' class='badge-wrapper bullet'>
+                  <span class='badge-category-bg' style='background-color: #<%= t.category.color %>'></span>
+                  <span class='category-title'><%= t.category.name %></span>
+                </a>
+              <% end %>
+              <% if t.tags %>
+                <div class="discourse-tags">
+                  <% t.tags.each_with_index do |tag, index| %>
+                    <a href='<%= tag.full_url %>' class='discourse-tag'><%= tag.name %></a>
+                    <% if index < t.tags.size - 1 %>,&nbsp;<% end %>
+                  <% end %>
+                </div>

[... diff too long, it was truncated ...]

GitHub sha: c85018cd

This commit appears in #9515 which was approved by davidtaylorhq. It was merged by udan11.

I’m not sure if it’s this patch or not, but very recently I started getting this error using discourse_deploy to build:

I, [2020-04-29T19:58:30.263438 #1] INFO – : > cd /var/www/discourse && gem update bundler I, [2020-04-29T19:58:38.127285 #1] INFO – : Updating installed gems Nothing to update

I, [2020-04-29T19:58:38.133811 #1] INFO – : > cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} + chown: cannot dereference ‘/var/www/discourse/public/plugins/discourse-internet-explorer’: No such file or directory``

1 Like

We are aware of the issue and will be pushing a fix soon. Thanks for the report!

Same here

Broken after the fix as well

Pups::ExecError: cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} + failed with return #<Process::Status: pid 337 exit 1> Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn’ exec failed with the params {“cd”=>"$home", “hook”=>“web”, “cmd”=>[“gem update bundler”, “find $home ! -user discourse -exec chown discourse {} \+”]}

1 Like

Can you please update discourse_docker (run cd /var/discourse && git pull) and retry?