DEV: Bump dependencies and fix linting (#231)
This commit is contained in:
parent
2caa98208e
commit
ba733585c8
|
@ -1,6 +1,6 @@
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
import NavItem from "discourse/models/nav-item";
|
import NavItem from "discourse/models/nav-item";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "discourse-topic-voting",
|
name: "discourse-topic-voting",
|
||||||
|
@ -13,7 +13,7 @@ export default {
|
||||||
"controller:full-page-search"
|
"controller:full-page-search"
|
||||||
);
|
);
|
||||||
pageSearchController.sortOrders.pushObject({
|
pageSearchController.sortOrders.pushObject({
|
||||||
name: I18n.t("search.most_votes"),
|
name: i18n("search.most_votes"),
|
||||||
id: 5,
|
id: 5,
|
||||||
term: "order:votes",
|
term: "order:votes",
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
function initialize(api) {
|
function initialize(api) {
|
||||||
api.addPostClassesCallback((post) => {
|
api.addPostClassesCallback((post) => {
|
||||||
|
@ -18,7 +18,7 @@ function initialize(api) {
|
||||||
|
|
||||||
let title = "";
|
let title = "";
|
||||||
if (topic.user_voted) {
|
if (topic.user_voted) {
|
||||||
title = ` title='${I18n.t("topic_voting.voted")}'`;
|
title = ` title='${i18n("topic_voting.voted")}'`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let userVotedClass = topic.user_voted ? " voted" : "";
|
let userVotedClass = topic.user_voted ? " voted" : "";
|
||||||
|
@ -26,7 +26,7 @@ function initialize(api) {
|
||||||
`<a href='${topic.url}' class='list-vote-count vote-count-${topic.vote_count} discourse-tag simple${userVotedClass}'${title}>`
|
`<a href='${topic.url}' class='list-vote-count vote-count-${topic.vote_count} discourse-tag simple${userVotedClass}'${title}>`
|
||||||
);
|
);
|
||||||
|
|
||||||
buffer.push(I18n.t("topic_voting.votes", { count: topic.vote_count }));
|
buffer.push(i18n("topic_voting.votes", { count: topic.vote_count }));
|
||||||
buffer.push("</a>");
|
buffer.push("</a>");
|
||||||
|
|
||||||
if (buffer.length > 0) {
|
if (buffer.length > 0) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import UserAction from "discourse/models/user-action";
|
import UserAction from "discourse/models/user-action";
|
||||||
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export default class UserActivityVotes extends UserTopicListRoute {
|
export default class UserActivityVotes extends UserTopicListRoute {
|
||||||
userActionType = UserAction.TYPES.topics;
|
userActionType = UserAction.TYPES.topics;
|
||||||
|
@ -20,8 +20,8 @@ export default class UserActivityVotes extends UserTopicListRoute {
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
const title = this.isCurrentUser(user)
|
const title = this.isCurrentUser(user)
|
||||||
? I18n.t("topic_voting.no_votes_title_self")
|
? i18n("topic_voting.no_votes_title_self")
|
||||||
: I18n.t("topic_voting.no_votes_title_others", {
|
: i18n("topic_voting.no_votes_title_others", {
|
||||||
username: user.username,
|
username: user.username,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { iconNode } from "discourse/lib/icon-library";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import { iconNode } from "discourse-common/lib/icon-library";
|
import { i18n } from "discourse-i18n";
|
||||||
import I18n from "I18n";
|
|
||||||
|
|
||||||
export default createWidget("remove-vote", {
|
export default createWidget("remove-vote", {
|
||||||
tagName: "div.remove-vote",
|
tagName: "div.remove-vote",
|
||||||
|
@ -10,7 +10,7 @@ export default createWidget("remove-vote", {
|
||||||
},
|
},
|
||||||
|
|
||||||
html() {
|
html() {
|
||||||
return [iconNode("xmark"), I18n.t("topic_voting.remove_vote")];
|
return [iconNode("xmark"), i18n("topic_voting.remove_vote")];
|
||||||
},
|
},
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import RawHtml from "discourse/widgets/raw-html";
|
import RawHtml from "discourse/widgets/raw-html";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export default createWidget("vote-box", {
|
export default createWidget("vote-box", {
|
||||||
tagName: "div.voting-wrapper",
|
tagName: "div.voting-wrapper",
|
||||||
|
@ -27,7 +27,7 @@ export default createWidget("vote-box", {
|
||||||
if (state.votesAlert > 0) {
|
if (state.votesAlert > 0) {
|
||||||
const html =
|
const html =
|
||||||
"<div class='voting-popup-menu vote-options popup-menu'>" +
|
"<div class='voting-popup-menu vote-options popup-menu'>" +
|
||||||
I18n.t("topic_voting.votes_left", {
|
i18n("topic_voting.votes_left", {
|
||||||
count: state.votesAlert,
|
count: state.votesAlert,
|
||||||
path: this.currentUser.get("path") + "/activity/votes",
|
path: this.currentUser.get("path") + "/activity/votes",
|
||||||
}) +
|
}) +
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { h } from "virtual-dom";
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
import { applyBehaviorTransformer } from "discourse/lib/transformer";
|
import { applyBehaviorTransformer } from "discourse/lib/transformer";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export default createWidget("vote-button", {
|
export default createWidget("vote-button", {
|
||||||
tagName: "div",
|
tagName: "div",
|
||||||
|
@ -31,27 +31,27 @@ export default createWidget("vote-button", {
|
||||||
buildButtonTitle(attrs) {
|
buildButtonTitle(attrs) {
|
||||||
if (this.currentUser) {
|
if (this.currentUser) {
|
||||||
if (attrs.closed) {
|
if (attrs.closed) {
|
||||||
return I18n.t("topic_voting.voting_closed_title");
|
return i18n("topic_voting.voting_closed_title");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrs.user_voted) {
|
if (attrs.user_voted) {
|
||||||
return I18n.t("topic_voting.voted_title");
|
return i18n("topic_voting.voted_title");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentUser.votes_exceeded) {
|
if (this.currentUser.votes_exceeded) {
|
||||||
return I18n.t("topic_voting.voting_limit");
|
return i18n("topic_voting.voting_limit");
|
||||||
}
|
}
|
||||||
|
|
||||||
return I18n.t("topic_voting.vote_title");
|
return i18n("topic_voting.vote_title");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrs.vote_count) {
|
if (attrs.vote_count) {
|
||||||
return I18n.t("topic_voting.anonymous_button", {
|
return i18n("topic_voting.anonymous_button", {
|
||||||
count: attrs.vote_count,
|
count: attrs.vote_count,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return I18n.t("topic_voting.anonymous_button", { count: 1 });
|
return i18n("topic_voting.anonymous_button", { count: 1 });
|
||||||
},
|
},
|
||||||
|
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
|
@ -60,7 +60,7 @@ export default createWidget("vote-button", {
|
||||||
{
|
{
|
||||||
attributes: {
|
attributes: {
|
||||||
title: this.currentUser
|
title: this.currentUser
|
||||||
? I18n.t("topic_voting.votes_left_button_title", {
|
? i18n("topic_voting.votes_left_button_title", {
|
||||||
count: this.currentUser.votes_left,
|
count: this.currentUser.votes_left,
|
||||||
})
|
})
|
||||||
: "",
|
: "",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { h } from "virtual-dom";
|
import { h } from "virtual-dom";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
|
import getURL from "discourse/lib/get-url";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
|
||||||
|
|
||||||
export default createWidget("vote-count", {
|
export default createWidget("vote-count", {
|
||||||
tagName: "div.vote-count-wrapper",
|
tagName: "div.vote-count-wrapper",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { h } from "virtual-dom";
|
import { h } from "virtual-dom";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export default createWidget("vote-options", {
|
export default createWidget("vote-options", {
|
||||||
tagName: "div.vote-options",
|
tagName: "div.vote-options",
|
||||||
|
@ -20,13 +20,13 @@ export default createWidget("vote-options", {
|
||||||
!attrs.user_voted
|
!attrs.user_voted
|
||||||
) {
|
) {
|
||||||
contents.push([
|
contents.push([
|
||||||
h("div", I18n.t("topic_voting.reached_limit")),
|
h("div", i18n("topic_voting.reached_limit")),
|
||||||
h(
|
h(
|
||||||
"p",
|
"p",
|
||||||
h(
|
h(
|
||||||
"a",
|
"a",
|
||||||
{ href: this.currentUser.get("path") + "/activity/votes" },
|
{ href: this.currentUser.get("path") + "/activity/votes" },
|
||||||
I18n.t("topic_voting.list_votes")
|
i18n("topic_voting.list_votes")
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
13
package.json
13
package.json
|
@ -1,15 +1,16 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discourse/lint-configs": "2.2.2",
|
"@discourse/lint-configs": "2.4.0",
|
||||||
"ember-template-lint": "6.0.0",
|
"ember-template-lint": "6.1.0",
|
||||||
"eslint": "9.15.0",
|
"eslint": "9.19.0",
|
||||||
"prettier": "2.8.8"
|
"prettier": "2.8.8"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 18",
|
"node": ">= 22",
|
||||||
"npm": "please-use-pnpm",
|
"npm": "please-use-pnpm",
|
||||||
"yarn": "please-use-pnpm",
|
"yarn": "please-use-pnpm",
|
||||||
"pnpm": ">= 9"
|
"pnpm": "9.x"
|
||||||
}
|
},
|
||||||
|
"packageManager": "pnpm@9.15.5"
|
||||||
}
|
}
|
||||||
|
|
1317
pnpm-lock.yaml
1317
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import I18n from "I18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
acceptance(
|
acceptance(
|
||||||
"Discourse Voting Plugin | /activity/votes | empty state",
|
"Discourse Voting Plugin | /activity/votes | empty state",
|
||||||
|
@ -27,7 +27,7 @@ acceptance(
|
||||||
await visit(`/u/${currentUser}/activity/votes`);
|
await visit(`/u/${currentUser}/activity/votes`);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
query("div.empty-state span.empty-state-title").innerText,
|
query("div.empty-state span.empty-state-title").innerText,
|
||||||
I18n.t("topic_voting.no_votes_title_self")
|
i18n("topic_voting.no_votes_title_self")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ acceptance(
|
||||||
await visit(`/u/${anotherUser}/activity/votes`);
|
await visit(`/u/${anotherUser}/activity/votes`);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
query("div.empty-state span.empty-state-title").innerText,
|
query("div.empty-state span.empty-state-title").innerText,
|
||||||
I18n.t("topic_voting.no_votes_title_others", { username: anotherUser })
|
i18n("topic_voting.no_votes_title_others", { username: anotherUser })
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue