FIX: Use 1 column instead of 4 for permalink destination (#9260)

FIX: Use 1 column instead of 4 for permalink destination (#9260)

diff --git a/app/assets/javascripts/admin/models/permalink.js b/app/assets/javascripts/admin/models/permalink.js
index b86e931..b13dcd6 100644
--- a/app/assets/javascripts/admin/models/permalink.js
+++ b/app/assets/javascripts/admin/models/permalink.js
@@ -1,4 +1,7 @@
 import { ajax } from "discourse/lib/ajax";
+import discourseComputed from "discourse-common/utils/decorators";
+import DiscourseURL from "discourse/lib/url";
+import Category from "discourse/models/category";
 import EmberObject from "@ember/object";
 
 const Permalink = EmberObject.extend({
@@ -13,6 +16,16 @@ const Permalink = EmberObject.extend({
     });
   },
 
+  @discourseComputed("category_id")
+  category: function(category_id) {
+    return Category.findById(category_id);
+  },
+
+  @discourseComputed("external_url")
+  linkIsExternal: function(external_url) {
+    return !DiscourseURL.isInternal(external_url);
+  },
+
   destroy: function() {
     return ajax("/admin/permalinks/" + this.id + ".json", {
       type: "DELETE"
diff --git a/app/assets/javascripts/admin/templates/permalinks.hbs b/app/assets/javascripts/admin/templates/permalinks.hbs
index 7c7ac2d..a9f1067 100644
--- a/app/assets/javascripts/admin/templates/permalinks.hbs
+++ b/app/assets/javascripts/admin/templates/permalinks.hbs
@@ -15,33 +15,27 @@
     <table class='admin-logs-table permalinks grid'>
       <thead class="heading-container">
         <th class="col heading first url">{{i18n 'admin.permalink.url'}}</th>
-        <th class="col heading topic">{{i18n 'admin.permalink.topic_title'}}</th>
-        <th class="col heading post">{{i18n 'admin.permalink.post_title'}}</th>
-        <th class="col heading category">{{i18n 'admin.permalink.category_title'}}</th>
-        <th class="col heading external_url">{{i18n 'admin.permalink.external_url'}}</th>
+        <th class="col heading destination">{{i18n 'admin.permalink.destination'}}</th>
         <th class="col heading actions"></th>
       </thead>
       <tbody>
         {{#each model as |pl|}}
           <tr class="admin-list-item">
             <td class="col first url">{{pl.url}}</td>
-            <td class="col topic">
+            <td class="col destination">
               {{#if pl.topic_id}}
                 <a href={{pl.topic_url}}>{{pl.topic_title}}</a>
               {{/if}}
-            </td>
-            <td class="col post">
               {{#if pl.post_id}}
-                <a href={{pl.post_url}}>#{{pl.post_number}} {{pl.post_topic_title}}</a>
+                <a href={{pl.post_url}}>{{pl.post_topic_title}} #{{pl.post_number}}</a>
               {{/if}}
-            </td>
-            <td class="col category">
               {{#if pl.category_id}}
-                <a href={{pl.category_url}}>{{pl.category_name}}</a>
+                {{category-link pl.category}}
               {{/if}}
-            </td>
-            <td class="col external_url">
               {{#if pl.external_url}}
+                {{#if pl.linkIsExternal}}
+                  {{d-icon "external-link-alt"}}
+                {{/if}}
                 <a href={{pl.external_url}}>{{pl.external_url}}</a>
               {{/if}}
             </td>
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index a793ae9..50f5134 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4593,6 +4593,7 @@ en:
         category_id: "Category ID"
         category_title: "Category"
         external_url: "External URL"
+        destination: "Destination"
         delete_confirm: Are you sure you want to delete this permalink?
         form:
           label: "New:"

GitHub sha: 6a1fe9ff

This commit appears in #9260 which was approved by eviltrout. It was merged by riking.