Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade lemmy-bot and lemmy-js-client version to be compatible with lemmy 0.19.3 #12

Merged
merged 5 commits into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -52,8 +52,8 @@
"dotenv": "^16.3.1",
"inversify": "^6.0.1",
"inversify-binding-decorators": "^4.0.0",
"lemmy-bot": "^0.4.1",
"lemmy-js-client": "^0.18.1-rc.3",
"lemmy-bot": "^0.5.1",
"lemmy-js-client": "0.19.2-alpha.3",
"moment": "^2.29.4",
"mysql2": "^3.6.0",
"pg": "8.2.x",
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ export class DeterminesIfUserIsAdmin {
public async handle(person: Person): Promise<boolean> {
const details = await this.client.getDetailsForPerson(person);

return details.person_view.person.admin;
return details.person_view.is_admin;
}
}
9 changes: 3 additions & 6 deletions src/Classes/ValueObjects/LemmyApi.ts
Original file line number Diff line number Diff line change
@@ -13,8 +13,7 @@ export class LemmyApi {
) {}

async createPost(form: Omit<CreatePost, "auth">): Promise<number> {
return (await this.client.createPost({ ...form, auth: this.token }))
.post_view.post.id;
return (await this.client.createPost({ ...form })).post_view.post.id;
}

async createFeaturedPost(
@@ -36,20 +35,18 @@ export class LemmyApi {
post_id: postIdentifier,
featured: featurePost,
feature_type: featuredType,
auth: this.token,
})
).post_view.post.id;
}

async getDetailsForPerson(person: Person): Promise<GetPersonDetailsResponse> {
return await this.client.getPersonDetails({
username: person.name,
auth: this.token,
});
}

async getCommunityIdentifier(name: string): Promise<number> {
return (await this.client.getCommunity({ name: name, auth: this.token }))
.community_view.community.id;
return (await this.client.getCommunity({ name: name })).community_view
.community.id;
}
}
9 changes: 5 additions & 4 deletions src/Tests/Unit/Services/DeterminesifUserPermissions.test.ts
Original file line number Diff line number Diff line change
@@ -125,17 +125,17 @@ describe(DeterminesIfUserIsAdmin, () => {

const person = instance<Person>(mock<Person>());
const counts = instance<PersonAggregates>(mock<PersonAggregates>());
const getPersonInterface = (isAdmin: boolean): Person => {
const getPersonInterface = (): Person => {
return {
...person,
admin: isAdmin,
};
};

const regularUserResponse: GetPersonDetailsResponse = {
person_view: {
person: getPersonInterface(false),
person: getPersonInterface(),
counts: counts,
is_admin: false,
},
posts: [],
comments: [],
@@ -144,8 +144,9 @@ describe(DeterminesIfUserIsAdmin, () => {

const adminResponse: GetPersonDetailsResponse = {
person_view: {
person: getPersonInterface(true),
person: getPersonInterface(),
counts: counts,
is_admin: true,
},
posts: [],
comments: [],
38 changes: 20 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -2676,27 +2676,27 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

lemmy-bot@^0.4.1:
version "0.4.5"
resolved "https://registry.yarnpkg.com/lemmy-bot/-/lemmy-bot-0.4.5.tgz#b1f01993a38277c124c220017771aa67c173d24c"
integrity sha512-GDf/Qjeig3RcjFgYAlUwsA3/YmOgKZOK0vs15KaPDNjMno+l9JZsb0I7XUuIMCPAHZUlSdSBuS9kLJzE9LouAA==
lemmy-bot@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/lemmy-bot/-/lemmy-bot-0.5.1.tgz#17075e3e09a6e4010e06634f8332b9c3f129bcb2"
integrity sha512-dRguH3qHLHRdnZzZ5MvguVy94k8rz/COvF+KJGkn0OOx/Qhzp/ByDv9vXZh0x9rzkddfVp4ODPZCgEDrDPbJog==
dependencies:
lemmy-js-client "0.18.3-rc.1"
node-cron "^3.0.2"
lemmy-js-client "0.19.0"
node-cron "^3.0.3"
sqlite3 "^5.1.6"

lemmy-js-client@0.18.3-rc.1:
version "0.18.3-rc.1"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.18.3-rc.1.tgz#e256981618d011de04882edbb81ee450bde0f068"
integrity sha512-z+ZqPoeJClxh3oQiD7ICgkrLKwFZvxs07a/28rvCouVu5zbhjGu0xXltq0GpgtzqFsGamXZ3tYz66ryzYjPBxg==
lemmy-js-client@0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.19.0.tgz#50098183264fa176784857f45665b06994b31e18"
integrity sha512-h+E8wC9RKjlToWw9+kuGFAzk4Fiaf61KqAwzvoCDAfj2L1r+YNt5EDMOggGCoRx5PlqLuIVr7BNEU46KxJfmHA==
dependencies:
cross-fetch "^3.1.5"
form-data "^4.0.0"

lemmy-js-client@^0.18.1-rc.3:
version "0.18.1"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.18.1.tgz#28df266eded0ef4a72b05ee6eabebddadfd81a27"
integrity sha512-maafUZ9ZJkXthRZmM0+limJmymF2kmN/8SiKufS3V4OVNM72s+wUFFiyhKmA370g23iZRW6SUagE7jNKnqNyYQ==
lemmy-js-client@0.19.2-alpha.3:
version "0.19.2-alpha.3"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.19.2-alpha.3.tgz#644bf9f2bf406b08342ea10f8e325953112f628a"
integrity sha512-SqI/S4mPsbo35Yo1ODYP4vhj5lGlci73KKdQigaT+6hO8SQaeATcMBV3RBxUYswNGGLN4vN+sCvavGoATfkqCw==
dependencies:
cross-fetch "^3.1.5"
form-data "^4.0.0"
@@ -3006,10 +3006,10 @@ node-addon-api@^4.2.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==

node-cron@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/node-cron/-/node-cron-3.0.2.tgz#bb0681342bd2dfb568f28e464031280e7f06bd01"
integrity sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ==
node-cron@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/node-cron/-/node-cron-3.0.3.tgz#c4bc7173dd96d96c50bdb51122c64415458caff2"
integrity sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==
dependencies:
uuid "8.3.2"

@@ -3978,6 +3978,8 @@ unique-filename@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230"
integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==
dependencies:
unique-slug "^2.0.0"

unique-slug@^2.0.0:
version "2.0.2"

Unchanged files with check annotations Beta

return await this.determinesIfUserIsAdmin.handle(person);
}
public async handle(message: string): Promise<void> {

Check warning on line 22 in src/Classes/Handlers/PrivateMessages/SchedulesPostsHandling.ts

GitHub Actions / build (18.16.1)

'message' is defined but never used

Check warning on line 22 in src/Classes/Handlers/PrivateMessages/SchedulesPostsHandling.ts

GitHub Actions / build (18.16.1)

'message' is defined but never used
await this.postSchedulerService.handlePostSchedule();
}
}