Skip to content

A platform for community discussion. Free, open, simple.

DEV: upgrade to fontawesome 7 (#36286)

Kelv5228729e5f68
diff --git a/frontend/discourse/app/lib/icon-library.js b/frontend/discourse/app/lib/icon-library.js
index b3fd37b5023..f600bce5e71 100644
--- a/frontend/discourse/app/lib/icon-library.js
+++ b/frontend/discourse/app/lib/icon-library.js
@@ -126,7 +126,7 @@ function iconClasses(icon, params) {
? icon.replacementId
: icon.id;
- let classNames = `fa d-icon d-icon-${dClass} svg-icon`;
+ let classNames = `fa d-icon d-icon-${dClass} svg-icon fa-width-auto`;
if (params && params["class"]) {
classNames += " " + params["class"];
diff --git a/frontend/discourse/tests/integration/components/prosemirror-editor/hashtag-test.js b/frontend/discourse/tests/integration/components/prosemirror-editor/hashtag-test.js
index 34aba2b2f24..8793a4584de 100644
--- a/frontend/discourse/tests/integration/components/prosemirror-editor/hashtag-test.js
+++ b/frontend/discourse/tests/integration/components/prosemirror-editor/hashtag-test.js
@@ -56,17 +56,17 @@ module(
const testCases = {
hashtag: [
"#product",
- '<p><a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class=\"hashtag-category-square hashtag-color--category-2\"></span>product</a></p>',
+ '<p><a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class="hashtag-category-square hashtag-color--category-2"></span>product</a></p>',
"#product",
],
"text with hashtag": [
"Hello #product",
- '<p>Hello <a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class=\"hashtag-category-square hashtag-color--category-2\"></span>product</a></p>',
+ '<p>Hello <a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class="hashtag-category-square hashtag-color--category-2"></span>product</a></p>',
"Hello #product",
],
"hashtag after heading": [
"## Hello\n\n#product",
- '<h2>Hello</h2><p><a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class=\"hashtag-category-square hashtag-color--category-2\"></span>product</a></p>',
+ '<h2>Hello</h2><p><a class="hashtag-cooked" data-name="product" data-processed="true" contenteditable="false" draggable="true"><span class="hashtag-category-square hashtag-color--category-2"></span>product</a></p>',
"## Hello\n\n#product",
],
"invalid hashtag": [
@@ -76,7 +76,7 @@ module(
],
"with regular tags": [
"Hello #dev",
- '<p>Hello <a class="hashtag-cooked" data-name="dev" data-processed="true" contenteditable="false" draggable="true"><svg class=\"fa d-icon d-icon-tag svg-icon hashtag-color--tag-1 svg-string\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#tag\"></use></svg>dev</a></p>',
+ '<p>Hello <a class="hashtag-cooked" data-name="dev" data-processed="true" contenteditable="false" draggable="true"><svg class="fa d-icon d-icon-tag svg-icon fa-width-auto hashtag-color--tag-1 svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#tag"></use></svg>dev</a></p>',
"Hello #dev",
],
"hashtag with emoji": [
@@ -86,7 +86,7 @@ module(
],
"hashtag with icon": [
"Lets #discuss",
- '<p>Lets <a class="hashtag-cooked" data-name="discuss" data-processed="true" contenteditable="false" draggable="true"><span class=\"hashtag-category-icon hashtag-color--category-4\"><svg class=\"fa d-icon d-icon-comment svg-icon svg-string\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#comment\"></use></svg></span>discuss</a></p>',
+ '<p>Lets <a class="hashtag-cooked" data-name="discuss" data-processed="true" contenteditable="false" draggable="true"><span class="hashtag-category-icon hashtag-color--category-4"><svg class="fa d-icon d-icon-comment svg-icon fa-width-auto svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#comment"></use></svg></span>discuss</a></p>',
"Lets #discuss",
],
"hashtag with emoji in text": [
diff --git a/frontend/discourse/tests/integration/helpers/d-icon-test.gjs b/frontend/discourse/tests/integration/helpers/d-icon-test.gjs
index 456e9976899..67b1b4316de 100644
--- a/frontend/discourse/tests/integration/helpers/d-icon-test.gjs
+++ b/frontend/discourse/tests/integration/helpers/d-icon-test.gjs
@@ -16,7 +16,7 @@ module("Integration | Helper | d-icon", function (hooks) {
assert
.dom(".test")
.hasHtml(
- '<svg class="fa d-icon d-icon-bars svg-icon svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#bars"></use></svg>'
+ '<svg class="fa d-icon d-icon-bars svg-icon fa-width-auto svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#bars"></use></svg>'
);
});
@@ -30,7 +30,7 @@ module("Integration | Helper | d-icon", function (hooks) {
assert
.dom(".test")
.hasHtml(
- '<svg class="fa d-icon d-icon-d-watching svg-icon svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#discourse-bell-exclamation"></use></svg>'
+ '<svg class="fa d-icon d-icon-d-watching svg-icon fa-width-auto svg-string" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><use href="#discourse-bell-exclamation"></use></svg>'
);
});
});
diff --git a/frontend/discourse/tests/unit/lib/icon-library-test.js b/frontend/discourse/tests/unit/lib/icon-library-test.js
index 6addfaac0ad..685b61dd444 100644
--- a/frontend/discourse/tests/unit/lib/icon-library-test.js
+++ b/frontend/discourse/tests/unit/lib/icon-library-test.js
@@ -14,7 +14,7 @@ module("Unit | Utility | icon-library", function (hooks) {
assert.strictEqual(icon.tagName, "svg");
assert.strictEqual(
icon.className.baseVal,
- "fa d-icon d-icon-bars svg-icon svg-node"
+ "fa d-icon d-icon-bars svg-icon fa-width-auto svg-node"
);
});
diff --git a/package.json b/package.json
index b545503081a..8d223475a4b 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"@babel/plugin-proposal-decorators": "^7.28.0",
"@discourse/lint-configs": "^2.36.0",
"@discourse/moment-timezone-names-translations": "^1.0.0",
- "@fortawesome/fontawesome-free": "6.7.2",
+ "@fortawesome/fontawesome-free": "7.1.0",
"@glint/ember-tsc": "^1.0.8",
"@glint/tsserver-plugin": "^2.0.8",
"@rdil/parallel-prettier": "^3.0.0",
diff --git a/plugins/checklist/assets/javascripts/lib/discourse-markdown/checklist.js b/plugins/checklist/assets/javascripts/lib/discourse-markdown/checklist.js
index 8bf89771f2c..a2428d390da 100644
--- a/plugins/checklist/assets/javascripts/lib/discourse-markdown/checklist.js
+++ b/plugins/checklist/assets/javascripts/lib/discourse-markdown/checklist.js
@@ -3,11 +3,11 @@ const REGEX = /\[( |x)?\]/gi;
function getClasses(str) {
switch (str) {
case "x":
- return "checked fa fa-square-check-o fa-fw";
+ return "checked fa fa-square-check-o";
case "X":
- return "checked permanent fa fa-square-check fa-fw";
+ return "checked permanent fa fa-square-check";
default:
- return "fa fa-square-o fa-fw";
+ return "fa fa-square-o";
}
}
@@ -93,9 +93,9 @@ export function setup(helper) {
helper.allowList([
"span.chcklst-stroked",
- "span.chcklst-box fa fa-square-o fa-fw",
- "span.chcklst-box checked fa fa-square-check-o fa-fw",
- "span.chcklst-box checked permanent fa fa-square-check fa-fw",
+ "span.chcklst-box fa fa-square-o",
+ "span.chcklst-box checked fa fa-square-check-o",
+ "span.chcklst-box checked permanent fa fa-square-check",
]);
helper.registerPlugin((md) =>
diff --git a/plugins/checklist/assets/javascripts/lib/rich-editor-extension.js b/plugins/checklist/assets/javascripts/lib/rich-editor-extension.js
index d2d4009857d..adb8a232007 100644
--- a/plugins/checklist/assets/javascripts/lib/rich-editor-extension.js
+++ b/plugins/checklist/assets/javascripts/lib/rich-editor-extension.js
@@ -15,8 +15,8 @@ const extension = {
"span",
{
class: node.attrs.checked
- ? "chcklst-box checked fa fa-square-check-o fa-fw"
- : "chcklst-box fa fa-square-o fa-fw",
+ ? "chcklst-box checked fa fa-square-check-o"
+ : "chcklst-box fa fa-square-o",
},
];
},
diff --git a/plugins/checklist/spec/pretty_text_spec.rb b/plugins/checklist/spec/pretty_text_spec.rb
index c1f4e3a577f..e90ab1f7f63 100644
--- a/plugins/checklist/spec/pretty_text_spec.rb
+++ b/plugins/checklist/spec/pretty_text_spec.rb
@@ -9,8 +9,8 @@ describe PrettyText do
MD
html = <<~HTML
- <p><span class="chcklst-box fa fa-square-o fa-fw"></span>,<span class="chcklst-box fa fa-square-o fa-fw"></span>,<span class="chcklst-box checked fa fa-square-check-o fa-fw"></span>,<span class="chcklst-box checked permanent fa fa-square-check fa-fw"></span> are all checkboxes<br>
- <code>[ ]</code> <a>x</a> <em>[ ]</em> <strong>[ ]</strong> <em>[ ]</em> <strong>[ ]</strong> <s>[ ]</s> are not checkboxes</p>
+ <p><span class="chcklst-box fa fa-square-o"></span>,<span class="chcklst-box fa fa-square-o"></span>,<span class="chcklst-box checked fa fa-square-check-o"></span>,<span class="chcklst-box checked permanent fa fa-square-check"></span> are all checkboxes<br>
+ <code>[ ]</code> <a>x</a> <em>[ ]</em> <strong>[ ]</strong> <em>[ ]</em> <strong>[ ]</strong> <s>[ ]</s> are not checkboxes</p>
HTML
cooked = PrettyText.cook(md)
expect(cooked).to eq(html.strip)
@@ -33,7 +33,7 @@ describe PrettyText do
expect(cooked).to include("[x] both brackets escaped")
expect(cooked).to include("[ ] escaped empty checkbox")
expect(cooked).to include(
- '<span class="chcklst-box checked fa fa-square-check-o fa-fw"></span> real checkbox',
+ '<span class="chcklst-box checked fa fa-square-check-o"></span> real checkbox',
)
end
@@ -47,7 +47,7 @@ describe PrettyText do
expect(cooked.scan("chcklst-box").count).to eq(1)
expect(cooked).to include("[x] hello")
expect(cooked).to include(
- '<span class="chcklst-box checked fa fa-square-check-o fa-fw"></span> world',
+ '<span class="chcklst-box checked fa fa-square-check-o"></span> world',
)
end
end
diff --git a/plugins/checklist/test/javascripts/integration/rich-editor-extension-test.js b/plugins/checklist/test/javascripts/integration/rich-editor-extension-test.js
index 76b09cef9bf..505316932fd 100644
--- a/plugins/checklist/test/javascripts/integration/rich-editor-extension-test.js
+++ b/plugins/checklist/test/javascripts/integration/rich-editor-extension-test.js
@@ -21,9 +21,9 @@ module(
});
const checked =
- '<span class="chcklst-box checked fa fa-square-check-o fa-fw" contenteditable="false" draggable="true"></span>';
+ '<span class="chcklst-box checked fa fa-square-check-o" contenteditable="false" draggable="true"></span>';
const unchecked =
- '<span class="chcklst-box fa fa-square-o fa-fw" contenteditable="false" draggable="true"></span>';
+ '<span class="chcklst-box fa fa-square-o" contenteditable="false" draggable="true"></span>';
Object.entries({
"renders unchecked checkbox correctly": [
diff --git a/plugins/discourse-local-dates/test/javascripts/unit/local-date-builder-test.js b/plugins/discourse-local-dates/test/javascripts/unit/local-date-builder-test.js
index 471c8cf0ac5..920f44d4e85 100644
--- a/plugins/discourse-local-dates/test/javascripts/unit/local-date-builder-test.js
+++ b/plugins/discourse-local-dates/test/javascripts/unit/local-date-builder-test.js
@@ -467,7 +467,7 @@ module("Unit | Library | local-date-builder", function () {
{
current: true,
formatted:
- "Sunday, March 22, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 12:00 AM → 1:30 AM",
+ "Sunday, March 22, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 12:00 AM → 1:30 AM",
timezone: "Paris",
},
],
@@ -499,7 +499,7 @@ module("Unit | Library | local-date-builder", function () {
{
current: true,
formatted:
- "Sunday, March 22, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 11:34 AM",
+ "Sunday, March 22, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 11:34 AM",
timezone: "Paris",
},
],
@@ -555,22 +555,22 @@ module("Unit | Library | local-date-builder", function () {
{
current: true,
formatted:
- "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 2:54 PM",
+ "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 2:54 PM",
timezone: "Paris",
},
{
formatted:
- "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 1:54 PM",
+ "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 1:54 PM",
timezone: "London",
},
{
formatted:
- "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 1:54 PM",
+ "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 1:54 PM",
timezone: "Lagos",
},
{
formatted:
- "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 10:54 PM",
+ "Tuesday, April 7, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 10:54 PM",
timezone: "Sydney",
},
],
@@ -590,12 +590,12 @@ module("Unit | Library | local-date-builder", function () {
{
current: true,
formatted:
- "Wednesday, May 13, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 11:00 AM",
+ "Wednesday, May 13, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 11:00 AM",
timezone: "Los Angeles",
},
{
formatted:
- "Wednesday, May 13, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 6:00 PM",
+ "Wednesday, May 13, 2020 <br /><svg class='fa d-icon d-icon-clock svg-icon fa-width-auto svg-string' aria-hidden='true' xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#clock\" /></svg> 6:00 PM",
timezone: "UTC",
},
],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c7d7dd2e72b..e08dd0622d0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -41,8 +41,8 @@ importers:
specifier: ^1.0.0
version: 1.0.0
'@fortawesome/fontawesome-free':
- specifier: 6.7.2
- version: 6.7.2
+ specifier: 7.1.0
+ version: 7.1.0
'@glint/ember-tsc':
specifier: ^1.0.8
version: 1.0.8([email protected])
@@ -2230,8 +2230,8 @@ packages:
'@floating-ui/[email protected]':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
- '@fortawesome/[email protected]':
- resolution: {integrity: sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==}
+ '@fortawesome/[email protected]':
+ resolution: {integrity: sha512-+WxNld5ZCJHvPQCr/GnzCTVREyStrAJjisUPtUxG5ngDA8TMlPnKp6dddlTpai4+1GNmltAeuk1hJEkBohwZYA==}
engines: {node: '>=6'}
'@fullcalendar/[email protected]':
@@ -10851,7 +10851,7 @@ snapshots:
'@floating-ui/[email protected]': {}
- '@fortawesome/[email protected]': {}
+ '@fortawesome/[email protected]': {}
'@fullcalendar/[email protected]':
dependencies: