DEV: Update linting (#267)

This commit is contained in:
Jarek Radosz 2023-12-01 16:47:54 +01:00 committed by GitHub
parent 840caa3987
commit e067df0b43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 1181 additions and 958 deletions

View File

@ -1,3 +0,0 @@
{
"extends": "eslint-config-discourse"
}

1
.eslintrc.cjs Normal file
View File

@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint");

View File

@ -1 +0,0 @@
{}

1
.prettierrc.cjs Normal file
View File

@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");

1
.template-lintrc.cjs Normal file
View File

@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");

View File

@ -1,4 +0,0 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};

View File

@ -2,35 +2,45 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.2) ast (2.4.2)
json (2.6.2) json (2.6.3)
parallel (1.22.1) language_server-protocol (3.17.0.3)
parser (3.1.2.1) parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1) ast (~> 2.4.1)
prettier_print (1.2.0) racc
prettier_print (1.2.1)
racc (1.7.3)
rainbow (3.1.1) rainbow (3.1.1)
regexp_parser (2.6.0) regexp_parser (2.8.2)
rexml (3.2.5) rexml (3.2.6)
rubocop (1.36.0) rubocop (1.57.2)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.1.2.1) parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0) rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0) rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.21.0) rubocop-ast (1.30.0)
parser (>= 3.1.1.0) parser (>= 3.2.1.0)
rubocop-discourse (3.0) rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-discourse (3.4.1)
rubocop (>= 1.1.0) rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0) rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.13.2) rubocop-factory_bot (2.24.0)
rubocop (~> 1.33) rubocop (~> 1.33)
ruby-progressbar (1.11.0) rubocop-rspec (2.25.0)
syntax_tree (5.1.0) rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0) prettier_print (>= 1.2.0)
unicode-display_width (2.3.0) unicode-display_width (2.5.0)
PLATFORMS PLATFORMS
arm64-darwin-20 arm64-darwin-20

View File

@ -10,13 +10,13 @@ module ::DiscourseDataExplorer
validates :name, presence: true validates :name, presence: true
scope :for_group, scope :for_group,
->(group) { ->(group) do
where(hidden: false).joins( where(hidden: false).joins(
"INNER JOIN data_explorer_query_groups "INNER JOIN data_explorer_query_groups
ON data_explorer_query_groups.query_id = data_explorer_queries.id ON data_explorer_query_groups.query_id = data_explorer_queries.id
AND data_explorer_query_groups.group_id = #{group.id}", AND data_explorer_query_groups.group_id = #{group.id}",
) )
} end
def params def params
@params ||= Parameter.create_from_sql(sql) @params ||= Parameter.create_from_sql(sql)

View File

@ -1,8 +1,8 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import loadScript from "discourse/lib/load-script";
import themeColor from "../lib/themeColor";
import { bind } from "discourse-common/utils/decorators";
import { action } from "@ember/object"; import { action } from "@ember/object";
import loadScript from "discourse/lib/load-script";
import { bind } from "discourse-common/utils/decorators";
import themeColor from "../lib/themeColor";
export default class DataExplorerBarChart extends Component { export default class DataExplorerBarChart extends Component {
chart; chart;
@ -86,6 +86,7 @@ export default class DataExplorerBarChart extends Component {
} }
willDestroy() { willDestroy() {
super.willDestroy(...arguments);
this.chart.destroy(); this.chart.destroy();
} }
} }

View File

@ -1,8 +1,8 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { debounce } from "discourse-common/utils/decorators";
import { isBlank, isEmpty } from "@ember/utils";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { isBlank, isEmpty } from "@ember/utils";
import { debounce } from "discourse-common/utils/decorators";
export default class ExplorerSchema extends Component { export default class ExplorerSchema extends Component {
@tracked filter; @tracked filter;

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { bind } from "discourse-common/utils/decorators";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { bind } from "discourse-common/utils/decorators";
export default class OneTable extends Component { export default class OneTable extends Component {
@tracked open = this.args.table.open; @tracked open = this.args.table.open;

View File

@ -40,7 +40,7 @@
{{else if (eq this.type "user_id")}} {{else if (eq this.type "user_id")}}
<EmailGroupUserChooser <EmailGroupUserChooser
@value={{this.value}} @value={{this.value}}
@options={{(hash maximum=1)}} @options={{hash maximum=1}}
@onChange={{this.updateValue}} @onChange={{this.updateValue}}
name={{@info.identifier}} name={{@info.identifier}}
/> />

View File

@ -1,11 +1,11 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import I18n from "I18n"; import { tracked } from "@glimmer/tracking";
import Category from "discourse/models/category"; import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { dasherize } from "@ember/string"; import { dasherize } from "@ember/string";
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { action } from "@ember/object"; import Category from "discourse/models/category";
import { tracked } from "@glimmer/tracking"; import I18n from "I18n";
import { inject as service } from "@ember/service";
const layoutMap = { const layoutMap = {
int: "int", int: "int",

View File

@ -1,24 +1,24 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import I18n from "I18n";
import { ajax } from "discourse/lib/ajax";
import getURL from "discourse-common/lib/get-url";
import Badge from "discourse/models/badge";
import { capitalize } from "@ember/string";
import { schedule } from "@ember/runloop";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import TopicViewComponent from "./result-types/topic"; import { capitalize } from "@ember/string";
import TextViewComponent from "./result-types/text"; import { ajax } from "discourse/lib/ajax";
import PostViewComponent from "./result-types/post"; import Badge from "discourse/models/badge";
import ReltimeViewComponent from "./result-types/reltime"; import getURL from "discourse-common/lib/get-url";
import I18n from "I18n";
import BadgeViewComponent from "./result-types/badge"; import BadgeViewComponent from "./result-types/badge";
import UrlViewComponent from "./result-types/url"; import CategoryViewComponent from "./result-types/category";
import UserViewComponent from "./result-types/user";
import GroupViewComponent from "./result-types/group"; import GroupViewComponent from "./result-types/group";
import HtmlViewComponent from "./result-types/html"; import HtmlViewComponent from "./result-types/html";
import JsonViewComponent from "./result-types/json"; import JsonViewComponent from "./result-types/json";
import CategoryViewComponent from "./result-types/category"; import PostViewComponent from "./result-types/post";
import ReltimeViewComponent from "./result-types/reltime";
import TextViewComponent from "./result-types/text";
import TopicViewComponent from "./result-types/topic";
import UrlViewComponent from "./result-types/url";
import UserViewComponent from "./result-types/user";
const VIEW_COMPONENTS = { const VIEW_COMPONENTS = {
topic: TopicViewComponent, topic: TopicViewComponent,

View File

@ -1,8 +1,8 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import getURL from "discourse-common/lib/get-url"; import { cached } from "@glimmer/tracking";
import { capitalize } from "@ember/string"; import { capitalize } from "@ember/string";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
import { cached } from "@glimmer/tracking"; import getURL from "discourse-common/lib/get-url";
import TextViewComponent from "./result-types/text"; import TextViewComponent from "./result-types/text";
export default class QueryRowContent extends Component { export default class QueryRowContent extends Component {

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { isEmpty } from "@ember/utils";
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library"; import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library";
export default class Badge extends Component { export default class Badge extends Component {

View File

@ -1,8 +1,8 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import FullscreenCodeModal from "discourse/components/modal/fullscreen-code";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { cached } from "@glimmer/tracking"; import { cached } from "@glimmer/tracking";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import FullscreenCodeModal from "discourse/components/modal/fullscreen-code";
export default class Json extends Component { export default class Json extends Component {
@service dialog; @service dialog;

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
export default class Reltime extends Component { export default class Reltime extends Component {
get boundDateReplacement() { get boundDateReplacement() {

View File

@ -1,8 +1,8 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import getURL from "discourse-common/lib/get-url"; import getURL from "discourse-common/lib/get-url";
import { bind } from "discourse-common/utils/decorators"; import { bind } from "discourse-common/utils/decorators";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
export default class ShareReport extends Component { export default class ShareReport extends Component {
@tracked visible = false; @tracked visible = false;

View File

@ -1,18 +1,19 @@
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import showModal from "discourse/lib/show-modal"; import { action } from "@ember/object";
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query"; import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import showModal from "discourse/lib/show-modal";
import { bind } from "discourse-common/utils/decorators"; import { bind } from "discourse-common/utils/decorators";
import I18n from "I18n"; import I18n from "I18n";
import { Promise } from "rsvp"; import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
const NoQuery = Query.create({ name: "No queries", fake: true, group_ids: [] }); const NoQuery = Query.create({ name: "No queries", fake: true, group_ids: [] });
export default class PluginsExplorerController extends Controller { export default class PluginsExplorerController extends Controller {
@service("router") router;
@service dialog; @service dialog;
@service appEvents; @service appEvents;
@ -264,7 +265,7 @@ export default class PluginsExplorerController extends Controller {
sortByProperty: "last_run_at", sortByProperty: "last_run_at",
sortDescending: true, sortDescending: true,
}); });
this.transitionToRoute({ queryParams: { id: null, params: null } }); this.router.transitionTo({ queryParams: { id: null, params: null } });
} }
@action @action

View File

@ -1,16 +1,16 @@
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import BookmarkModal from "discourse/components/modal/bookmark"; import BookmarkModal from "discourse/components/modal/bookmark";
import { BookmarkFormData } from "discourse/lib/bookmark";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { BookmarkFormData } from "discourse/lib/bookmark";
import { import {
NO_REMINDER_ICON, NO_REMINDER_ICON,
WITH_REMINDER_ICON, WITH_REMINDER_ICON,
} from "discourse/models/bookmark"; } from "discourse/models/bookmark";
import { action } from "@ember/object";
import { bind } from "discourse-common/utils/decorators"; import { bind } from "discourse-common/utils/decorators";
import { tracked } from "@glimmer/tracking";
import { inject as service } from "@ember/service";
export default class GroupReportsShowController extends Controller { export default class GroupReportsShowController extends Controller {
@service currentUser; @service currentUser;

View File

@ -1,5 +1,5 @@
import getURL from "discourse-common/lib/get-url";
import RestModel from "discourse/models/rest"; import RestModel from "discourse/models/rest";
import getURL from "discourse-common/lib/get-url";
export default class Query extends RestModel { export default class Query extends RestModel {
static updatePropertyNames = [ static updatePropertyNames = [

View File

@ -74,7 +74,7 @@
<div class="desc"> <div class="desc">
<DTextarea <DTextarea
@value={{this.selectedItem.description}} @value={{this.selectedItem.description}}
@placeholder={{(i18n "explorer.description_placeholder")}} @placeholder={{i18n "explorer.description_placeholder"}}
@input={{this.setDirty}} @input={{this.setDirty}}
/> />
</div> </div>
@ -296,7 +296,7 @@
@field="name" @field="name"
@labelKey="explorer.query_user" @labelKey="explorer.query_user"
@order={{this.order}} @order={{this.order}}
@asc={{(not this.sortDescending)}} @asc={{not this.sortDescending}}
@automatic="true" @automatic="true"
/> />
</div> </div>
@ -311,7 +311,7 @@
@field="username" @field="username"
@labelKey="explorer.query_user" @labelKey="explorer.query_user"
@order={{this.order}} @order={{this.order}}
@asc={{(not this.sortDescending)}} @asc={{not this.sortDescending}}
@automatic="true" @automatic="true"
/> />
</div> </div>
@ -331,7 +331,7 @@
@field="last_run_at" @field="last_run_at"
@labelKey="explorer.query_time" @labelKey="explorer.query_time"
@order={{this.order}} @order={{this.order}}
@asc={{(not this.sortDescending)}} @asc={{not this.sortDescending}}
@automatic="true" @automatic="true"
/> />
</div> </div>

View File

@ -16,7 +16,7 @@
<tr> <tr>
<td> <td>
<LinkTo <LinkTo
@route={{"group.reports.show"}} @route="group.reports.show"
@models={{array group.name query.id}} @models={{array group.name query.id}}
> >
{{query.name}} {{query.name}}

View File

@ -5,6 +5,9 @@
"author": "Discourse", "author": "Discourse",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"eslint-config-discourse": "^3.4.0" "@discourse/lint-configs": "^1.2.0",
"ember-template-lint": "^5.13.0",
"eslint": "^8.54.0",
"prettier": "^2.8.8"
} }
} }

View File

@ -6,7 +6,6 @@
# version: 0.3 # version: 0.3
# authors: Riking # authors: Riking
# url: https://github.com/discourse/discourse-data-explorer # url: https://github.com/discourse/discourse-data-explorer
# transpile_js: true
enabled_site_setting :data_explorer_enabled enabled_site_setting :data_explorer_enabled

View File

@ -64,7 +64,7 @@ describe Jobs::DeleteHiddenQueries do
updated_at: 5.days.ago, updated_at: 5.days.ago,
) )
subject.execute(nil) described_class.new.execute(nil)
expect(DiscourseDataExplorer::Query.all.length).to eq(4) expect(DiscourseDataExplorer::Query.all.length).to eq(4)
end end
end end

View File

@ -3,6 +3,10 @@
require "rails_helper" require "rails_helper"
describe DiscourseDataExplorer::QueryGroupBookmarkable do describe DiscourseDataExplorer::QueryGroupBookmarkable do
subject(:registered_bookmarkable) do
RegisteredBookmarkable.new(DiscourseDataExplorer::QueryGroupBookmarkable)
end
fab!(:admin_user) { Fabricate(:admin) } fab!(:admin_user) { Fabricate(:admin) }
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:guardian) { Guardian.new(user) } fab!(:guardian) { Guardian.new(user) }
@ -80,24 +84,24 @@ describe DiscourseDataExplorer::QueryGroupBookmarkable do
Fabricate(:bookmark, user: user, bookmarkable: query_group4, name: "something i gotta do also") Fabricate(:bookmark, user: user, bookmarkable: query_group4, name: "something i gotta do also")
end end
subject { RegisteredBookmarkable.new(DiscourseDataExplorer::QueryGroupBookmarkable) }
describe "#perform_list_query" do describe "#perform_list_query" do
it "returns all the user's bookmarks" do it "returns all the user's bookmarks" do
expect(subject.perform_list_query(user, guardian).map(&:id)).to match_array( expect(registered_bookmarkable.perform_list_query(user, guardian).map(&:id)).to match_array(
[bookmark1.id, bookmark2.id, bookmark3.id], [bookmark1.id, bookmark2.id, bookmark3.id],
) )
end end
it "does not return bookmarks made from groups that the user is no longer a member of" do it "does not return bookmarks made from groups that the user is no longer a member of" do
expect(subject.perform_list_query(user, guardian).map(&:id)).not_to include(bookmark4.id) expect(registered_bookmarkable.perform_list_query(user, guardian).map(&:id)).not_to include(
bookmark4.id,
)
# remove user from the other groups from which they bookmarked a query # remove user from the other groups from which they bookmarked a query
group_user1.delete group_user1.delete
group_user2.delete group_user2.delete
# bookmarks is now empty, because user is not a member of any Groups with permission to see the query # bookmarks is now empty, because user is not a member of any Groups with permission to see the query
expect(subject.perform_list_query(user, guardian)).to be_empty expect(registered_bookmarkable.perform_list_query(user, guardian)).to be_empty
end end
end end
@ -107,8 +111,8 @@ describe DiscourseDataExplorer::QueryGroupBookmarkable do
it "returns bookmarks that match by name" do it "returns bookmarks that match by name" do
ts_query = Search.ts_query(term: "gotta", ts_config: "simple") ts_query = Search.ts_query(term: "gotta", ts_config: "simple")
expect( expect(
subject.perform_search_query( registered_bookmarkable.perform_search_query(
subject.perform_list_query(user, guardian), registered_bookmarkable.perform_list_query(user, guardian),
"%gotta%", "%gotta%",
ts_query, ts_query,
).map(&:id), ).map(&:id),
@ -118,8 +122,8 @@ describe DiscourseDataExplorer::QueryGroupBookmarkable do
it "returns bookmarks that match by Query name" do it "returns bookmarks that match by Query name" do
ts_query = Search.ts_query(term: "First", ts_config: "simple") ts_query = Search.ts_query(term: "First", ts_config: "simple")
expect( expect(
subject.perform_search_query( registered_bookmarkable.perform_search_query(
subject.perform_list_query(user, guardian), registered_bookmarkable.perform_list_query(user, guardian),
"%First%", "%First%",
ts_query, ts_query,
).map(&:id), ).map(&:id),
@ -129,21 +133,21 @@ describe DiscourseDataExplorer::QueryGroupBookmarkable do
describe "#can_send_reminder?" do describe "#can_send_reminder?" do
it "cannot send the reminder if the group is revoked access to the query" do it "cannot send the reminder if the group is revoked access to the query" do
expect(subject.can_send_reminder?(bookmark1)).to eq(true) expect(registered_bookmarkable.can_send_reminder?(bookmark1)).to eq(true)
bookmark1.bookmarkable.delete bookmark1.bookmarkable.delete
bookmark1.reload bookmark1.reload
expect(subject.can_send_reminder?(bookmark1)).to eq(false) expect(registered_bookmarkable.can_send_reminder?(bookmark1)).to eq(false)
end end
end end
describe "#reminder_handler" do describe "#reminder_handler" do
it "creates a notification for the user with the correct details" do it "creates a notification for the user with the correct details" do
expect { subject.send_reminder_notification(bookmark1) }.to change { Notification.count }.by( expect { registered_bookmarkable.send_reminder_notification(bookmark1) }.to change {
1, Notification.count
) }.by(1)
notif = user.notifications.last notification = user.notifications.last
expect(notif.notification_type).to eq(Notification.types[:bookmark_reminder]) expect(notification.notification_type).to eq(Notification.types[:bookmark_reminder])
expect(notif.data).to eq( expect(notification.data).to eq(
{ {
title: bookmark1.bookmarkable.query.name, title: bookmark1.bookmarkable.query.name,
bookmarkable_url: bookmarkable_url:
@ -158,26 +162,26 @@ describe DiscourseDataExplorer::QueryGroupBookmarkable do
describe "#can_see?" do describe "#can_see?" do
it "returns false if the user is not a member of the group from which they created the bookmark" do it "returns false if the user is not a member of the group from which they created the bookmark" do
expect(subject.can_see?(guardian, bookmark1)).to eq(true) #Query 1, Group 0 expect(registered_bookmarkable.can_see?(guardian, bookmark1)).to eq(true) # Query 1, Group 0
expect(subject.can_see?(guardian, bookmark2)).to eq(true) #Query 1, Group 1 expect(registered_bookmarkable.can_see?(guardian, bookmark2)).to eq(true) # Query 1, Group 1
expect(subject.can_see?(guardian, bookmark3)).to eq(true) #Query 2, Group 1 expect(registered_bookmarkable.can_see?(guardian, bookmark3)).to eq(true) # Query 2, Group 1
expect(subject.can_see?(guardian, bookmark4)).to eq(false) #Query 1, Group 2 expect(registered_bookmarkable.can_see?(guardian, bookmark4)).to eq(false) # Query 1, Group 2
# remove from Groups 0 and 1 # remove from Groups 0 and 1
group_user1.delete # Group 0 group_user1.delete # Group 0
group_user2.delete # Group 1 group_user2.delete # Group 1
guardian.user.reload guardian.user.reload
expect(subject.can_see?(guardian, bookmark1)).to eq(false) expect(registered_bookmarkable.can_see?(guardian, bookmark1)).to eq(false)
expect(subject.can_see?(guardian, bookmark2)).to eq(false) expect(registered_bookmarkable.can_see?(guardian, bookmark2)).to eq(false)
expect(subject.can_see?(guardian, bookmark3)).to eq(false) expect(registered_bookmarkable.can_see?(guardian, bookmark3)).to eq(false)
expect(subject.can_see?(guardian, bookmark4)).to eq(false) expect(registered_bookmarkable.can_see?(guardian, bookmark4)).to eq(false)
# And adding the user back to the group, just to be sure. # And adding the user back to the group, just to be sure.
Fabricate(:group_user, user: user, group: group2) Fabricate(:group_user, user: user, group: group2)
guardian.user.reload guardian.user.reload
expect(subject.can_see?(guardian, bookmark4)).to eq(true) expect(registered_bookmarkable.can_see?(guardian, bookmark4)).to eq(true)
end end
end end
end end

View File

@ -1,13 +1,13 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { import {
acceptance, acceptance,
count, count,
exists, exists,
query, query,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import I18n from "I18n"; import I18n from "I18n";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Data Explorer Plugin | List Queries", function (needs) { acceptance("Data Explorer Plugin | List Queries", function (needs) {
needs.user(); needs.user();

View File

@ -1,7 +1,7 @@
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { click, currentURL, fillIn, visit } from "@ember/test-helpers"; import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit"; import { test } from "qunit";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Data Explorer Plugin | New Query", function (needs) { acceptance("Data Explorer Plugin | New Query", function (needs) {
needs.user(); needs.user();

View File

@ -1,10 +1,10 @@
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { import {
acceptance, acceptance,
exists, exists,
query, query,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
acceptance("Data Explorer Plugin | Param Input", function (needs) { acceptance("Data Explorer Plugin | Param Input", function (needs) {
needs.user(); needs.user();

View File

@ -1,13 +1,13 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { import {
acceptance, acceptance,
exists, exists,
query, query,
queryAll, queryAll,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import I18n from "I18n"; import I18n from "I18n";
import { test } from "qunit";
acceptance("Data Explorer Plugin | Run Query", function (needs) { acceptance("Data Explorer Plugin | Run Query", function (needs) {
needs.user(); needs.user();

View File

@ -1,8 +1,8 @@
import hbs from "htmlbars-inline-precompile";
import componentTest, { import componentTest, {
setupRenderingTest, setupRenderingTest,
} from "discourse/tests/helpers/component-test"; } from "discourse/tests/helpers/component-test";
import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers"; import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";
import hbs from "htmlbars-inline-precompile";
discourseModule( discourseModule(
"Data Explorer Plugin | Integration | Component | data-explorer-bar-chart", "Data Explorer Plugin | Integration | Component | data-explorer-bar-chart",

View File

@ -1,3 +1,5 @@
import { click } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import componentTest, { import componentTest, {
setupRenderingTest, setupRenderingTest,
} from "discourse/tests/helpers/component-test"; } from "discourse/tests/helpers/component-test";
@ -6,8 +8,6 @@ import {
exists, exists,
query, query,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { click } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import I18n from "I18n"; import I18n from "I18n";
discourseModule( discourseModule(

1878
yarn.lock

File diff suppressed because it is too large Load Diff