From f91631b625f18a67a6add210929802443746f542 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Mon, 20 Feb 2023 06:20:47 +0300 Subject: [PATCH] DEV: Update javascript:update_constants rake task following template colocation (#20365) As of https://github.com/discourse/discourse/commit/ba3f62f576068035bc8fbda615e595960cd4520c, handlebars templates are colocated with js files so the path to hbs templates referenced by this rake task is no longer valid. This commit fixes the path to hbs templates and updates a couple of files that are generated by the rake task. --- .../tests/fixtures/concerns/notification-types.js | 6 ++++++ app/assets/javascripts/pretty-text/addon/emoji/data.js | 4 ++-- app/models/emoji.rb | 1 - lib/emoji/db.json | 7 +++++-- lib/emoji/groups.json | 2 +- lib/tasks/javascript.rake | 2 +- spec/lib/pretty_text_spec.rb | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js b/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js index a75d7721a16..512f63e00c8 100644 --- a/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js +++ b/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js @@ -38,4 +38,10 @@ export const NOTIFICATION_TYPES = { chat_quoted: 33, assigned: 34, question_answer_user_commented: 35, + watching_category_or_tag: 36, + new_features: 37, + following: 800, + following_created_topic: 801, + following_replied: 802, + circles_activity: 900, }; diff --git a/app/assets/javascripts/pretty-text/addon/emoji/data.js b/app/assets/javascripts/pretty-text/addon/emoji/data.js index e24f72e4459..1a28d7beef6 100644 --- a/app/assets/javascripts/pretty-text/addon/emoji/data.js +++ b/app/assets/javascripts/pretty-text/addon/emoji/data.js @@ -16,7 +16,6 @@ export const emojis = [ "blush", "slightly_smiling_face", "upside_down_face", - "relaxed", "yum", "relieved", "heart_eyes", @@ -2341,6 +2340,7 @@ export const aliases = { face_vomiting: ["puke"], smile: ["grinning_face_with_smiling_eyes"], frowning_with_open_mouth: ["frowning_face_with_open_mouth"], + smiling_face: ["relaxed"], }; export const searchAliases = { sad: [ @@ -6376,7 +6376,7 @@ export const replacements = { "😊": "blush", "🙂": "slightly_smiling_face", "🙃": "upside_down_face", - "☺": "relaxed", + "☺": "smiling_face", "😋": "yum", "😌": "relieved", "😍": "heart_eyes", diff --git a/app/models/emoji.rb b/app/models/emoji.rb index 84a0f718dcc..cddd9042c0e 100644 --- a/app/models/emoji.rb +++ b/app/models/emoji.rb @@ -232,7 +232,6 @@ class Emoji replacements["\u{263B}"] = "slight_smile" replacements["\u{2661}"] = "heart" replacements["\u{2665}"] = "heart" - replacements["\u{263A}"] = "relaxed" replacements end diff --git a/lib/emoji/db.json b/lib/emoji/db.json index 8b3f530c5d9..0cbab5704b8 100644 --- a/lib/emoji/db.json +++ b/lib/emoji/db.json @@ -58,7 +58,7 @@ }, { "code": "263a", - "name": "relaxed" + "name": "smiling_face" }, { "code": "1f60b", @@ -8310,6 +8310,9 @@ ], "frowning_with_open_mouth": [ "frowning_face_with_open_mouth" + ], + "smiling_face": [ + "relaxed" ] }, "searchAliases": { @@ -17285,4 +17288,4 @@ ":$": "blush", ":-$": "blush" } -} \ No newline at end of file +} diff --git a/lib/emoji/groups.json b/lib/emoji/groups.json index 04395ce4d32..fdb56fd6285 100644 --- a/lib/emoji/groups.json +++ b/lib/emoji/groups.json @@ -7449,4 +7449,4 @@ } ] } -] \ No newline at end of file +] diff --git a/lib/tasks/javascript.rake b/lib/tasks/javascript.rake index cf43fd72bab..bf02c4a6ad5 100644 --- a/lib/tasks/javascript.rake +++ b/lib/tasks/javascript.rake @@ -196,7 +196,7 @@ task "javascript:update_constants" => :environment do emoji_sections = groups_json.map { |group| html_for_section(group) } - components_dir = "discourse/app/templates/components" + components_dir = "discourse/app/components" write_hbs_template("#{components_dir}/emoji-group-buttons.hbs", task_name, emoji_buttons.join) write_hbs_template("#{components_dir}/emoji-group-sections.hbs", task_name, emoji_sections.join) end diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rb index 737ce0f198d..ac11ef85e21 100644 --- a/spec/lib/pretty_text_spec.rb +++ b/spec/lib/pretty_text_spec.rb @@ -1461,7 +1461,7 @@ RSpec.describe PrettyText do it "replaces some glyphs that are not in the emoji range" do expect(PrettyText.cook("☹")).to match(/\:frowning\:/) - expect(PrettyText.cook("☺")).to match(/\:relaxed\:/) + expect(PrettyText.cook("☺")).to match(/\:smiling_face\:/) expect(PrettyText.cook("☻")).to match(/\:slight_smile\:/) expect(PrettyText.cook("♡")).to match(/\:heart\:/) expect(PrettyText.cook("❤")).to match(/\:heart\:/)