DEV: Bump dependencies and fix linting

This commit is contained in:
David Taylor 2025-02-06 13:08:50 +00:00
parent 2caa98208e
commit 80f55bb4c3
No known key found for this signature in database
GPG Key ID: 46904C18B1D3F434
11 changed files with 771 additions and 615 deletions

View File

@ -1,6 +1,6 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import NavItem from "discourse/models/nav-item";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default {
name: "discourse-topic-voting",
@ -13,7 +13,7 @@ export default {
"controller:full-page-search"
);
pageSearchController.sortOrders.pushObject({
name: I18n.t("search.most_votes"),
name: i18n("search.most_votes"),
id: 5,
term: "order:votes",
});

View File

@ -1,5 +1,5 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
function initialize(api) {
api.addPostClassesCallback((post) => {
@ -18,7 +18,7 @@ function initialize(api) {
let title = "";
if (topic.user_voted) {
title = ` title='${I18n.t("topic_voting.voted")}'`;
title = ` title='${i18n("topic_voting.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}>`
);
buffer.push(I18n.t("topic_voting.votes", { count: topic.vote_count }));
buffer.push(i18n("topic_voting.votes", { count: topic.vote_count }));
buffer.push("</a>");
if (buffer.length > 0) {

View File

@ -1,6 +1,6 @@
import UserAction from "discourse/models/user-action";
import UserTopicListRoute from "discourse/routes/user-topic-list";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default class UserActivityVotes extends UserTopicListRoute {
userActionType = UserAction.TYPES.topics;
@ -20,8 +20,8 @@ export default class UserActivityVotes extends UserTopicListRoute {
emptyState() {
const user = this.modelFor("user");
const title = this.isCurrentUser(user)
? I18n.t("topic_voting.no_votes_title_self")
: I18n.t("topic_voting.no_votes_title_others", {
? i18n("topic_voting.no_votes_title_self")
: i18n("topic_voting.no_votes_title_others", {
username: user.username,
});

View File

@ -1,6 +1,6 @@
import { iconNode } from "discourse/lib/icon-library";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default createWidget("remove-vote", {
tagName: "div.remove-vote",
@ -10,7 +10,7 @@ export default createWidget("remove-vote", {
},
html() {
return [iconNode("xmark"), I18n.t("topic_voting.remove_vote")];
return [iconNode("xmark"), i18n("topic_voting.remove_vote")];
},
click() {

View File

@ -2,7 +2,7 @@ import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default createWidget("vote-box", {
tagName: "div.voting-wrapper",
@ -27,7 +27,7 @@ export default createWidget("vote-box", {
if (state.votesAlert > 0) {
const html =
"<div class='voting-popup-menu vote-options popup-menu'>" +
I18n.t("topic_voting.votes_left", {
i18n("topic_voting.votes_left", {
count: state.votesAlert,
path: this.currentUser.get("path") + "/activity/votes",
}) +

View File

@ -2,7 +2,7 @@ import { h } from "virtual-dom";
import cookie from "discourse/lib/cookie";
import { applyBehaviorTransformer } from "discourse/lib/transformer";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default createWidget("vote-button", {
tagName: "div",
@ -31,27 +31,27 @@ export default createWidget("vote-button", {
buildButtonTitle(attrs) {
if (this.currentUser) {
if (attrs.closed) {
return I18n.t("topic_voting.voting_closed_title");
return i18n("topic_voting.voting_closed_title");
}
if (attrs.user_voted) {
return I18n.t("topic_voting.voted_title");
return i18n("topic_voting.voted_title");
}
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) {
return I18n.t("topic_voting.anonymous_button", {
return i18n("topic_voting.anonymous_button", {
count: attrs.vote_count,
});
}
return I18n.t("topic_voting.anonymous_button", { count: 1 });
return i18n("topic_voting.anonymous_button", { count: 1 });
},
html(attrs) {
@ -60,7 +60,7 @@ export default createWidget("vote-button", {
{
attributes: {
title: this.currentUser
? I18n.t("topic_voting.votes_left_button_title", {
? i18n("topic_voting.votes_left_button_title", {
count: this.currentUser.votes_left,
})
: "",

View File

@ -1,8 +1,8 @@
import { h } from "virtual-dom";
import { ajax } from "discourse/lib/ajax";
import cookie from "discourse/lib/cookie";
import getURL from "discourse/lib/get-url";
import { createWidget } from "discourse/widgets/widget";
import getURL from "discourse-common/lib/get-url";
export default createWidget("vote-count", {
tagName: "div.vote-count-wrapper",

View File

@ -1,6 +1,6 @@
import { h } from "virtual-dom";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
export default createWidget("vote-options", {
tagName: "div.vote-options",
@ -20,13 +20,13 @@ export default createWidget("vote-options", {
!attrs.user_voted
) {
contents.push([
h("div", I18n.t("topic_voting.reached_limit")),
h("div", i18n("topic_voting.reached_limit")),
h(
"p",
h(
"a",
{ href: this.currentUser.get("path") + "/activity/votes" },
I18n.t("topic_voting.list_votes")
i18n("topic_voting.list_votes")
)
),
]);

View File

@ -1,15 +1,16 @@
{
"private": true,
"devDependencies": {
"@discourse/lint-configs": "2.2.2",
"ember-template-lint": "6.0.0",
"eslint": "9.15.0",
"@discourse/lint-configs": "2.4.0",
"ember-template-lint": "6.1.0",
"eslint": "9.19.0",
"prettier": "2.8.8"
},
"engines": {
"node": ">= 18",
"node": ">= 22",
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"pnpm": ">= 9"
}
"pnpm": "9.x"
},
"packageManager": "pnpm@9.15.5"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
acceptance(
"Discourse Voting Plugin | /activity/votes | empty state",
@ -27,7 +27,7 @@ acceptance(
await visit(`/u/${currentUser}/activity/votes`);
assert.equal(
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`);
assert.equal(
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 })
);
});
}