From 79d3b25d97db6c3fe7cbd9a526b4697fab0636a9 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 17 Jun 2022 13:45:05 +0200 Subject: [PATCH] DEV: Fix various frontend warnings (#17122) 3 computed property overrides and a tippy warning --- .../discourse/app/components/d-popover.js | 16 +++++++++++----- .../app/templates/components/emoji-uploader.hbs | 2 +- .../discourse/tests/helpers/create-pretender.js | 2 +- .../integration/components/d-navigation-test.js | 4 +--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/d-popover.js b/app/assets/javascripts/discourse/app/components/d-popover.js index 1a3b0ea9b0e..930f16348f2 100644 --- a/app/assets/javascripts/discourse/app/components/d-popover.js +++ b/app/assets/javascripts/discourse/app/components/d-popover.js @@ -80,12 +80,18 @@ export default class DiscoursePopover extends Component { }, }; + const target = document + .getElementById(this.componentId) + .querySelector( + ':scope > .d-popover-trigger, :scope > .btn, :scope > [role="button"]' + ); + + if (!target) { + return null; + } + const instance = tippy( - document - .getElementById(this.componentId) - .querySelector( - ':scope > .d-popover-trigger, :scope > .btn, :scope > [role="button"]' - ), + target, Object.assign({}, baseOptions, this.options || {}) ); diff --git a/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs b/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs index 32c118bc3f7..519f95e4e29 100644 --- a/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs @@ -40,7 +40,7 @@ type="file" multiple="true" accept=".png,.gif"> - {{d-button class="btn-primary" computedLabel=buttonLabel icon="plus" action=(action "chooseFiles") disabled=uploading}} + {{d-button class="btn-primary" translatedLabel=buttonLabel icon="plus" action=(action "chooseFiles") disabled=uploading}} diff --git a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js index 7c57057ebda..dbabe18be01 100644 --- a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js +++ b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js @@ -269,7 +269,7 @@ export function applyDefaultHandlers(pretender) { return response(fixturesByUrl["/search.json"]); } else if (request.queryParams.q === "discourse visited") { const obj = JSON.parse(JSON.stringify(fixturesByUrl["/search.json"])); - obj.topics.firstObject.visited = true; + obj.topics.firstObject.last_read_post_number = 1; return response(obj); } else if ( request.queryParams.q === "discourse in:personal" || diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js index 43664281968..54eedc875bf 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js @@ -19,9 +19,7 @@ discourseModule("Integration | Component | d-navigation", function (hooks) { const categories = this.site.categoriesList .filter((category) => !category.parent_category_id) .slice(0, 4); - this.site.setProperties({ - categoriesList: categories, - }); + this.site.setProperties({ categories }); this.currentUser.set( "indirectly_muted_category_ids", categories.slice(0, 3).map((category) => category.id)