mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix: 🚨 Fix DeepSource linter warnings
This commit is contained in:
parent
45e5460975
commit
1d301d72ae
10 changed files with 39 additions and 40 deletions
|
|
@ -347,13 +347,10 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
hostname: string,
|
||||
): Promise<URL | null> {
|
||||
try {
|
||||
return User.federationRequester.resolveWebFinger(
|
||||
username,
|
||||
hostname,
|
||||
);
|
||||
return FederationRequester.resolveWebFinger(username, hostname);
|
||||
} catch {
|
||||
try {
|
||||
return User.federationRequester.resolveWebFinger(
|
||||
return FederationRequester.resolveWebFinger(
|
||||
username,
|
||||
hostname,
|
||||
"application/activity+json",
|
||||
|
|
@ -854,7 +851,7 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
|
||||
const user = await User.insert({
|
||||
id: randomUUIDv7(),
|
||||
username: username,
|
||||
username,
|
||||
displayName: username,
|
||||
password: options?.password
|
||||
? await bunPassword.hash(options.password)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { sanitizeHtml, sanitizeHtmlInline } from "@/sanitization";
|
|||
import markdownItTaskLists from "@hackmd/markdown-it-task-lists";
|
||||
import { type Note, User, db } from "@versia/kit/db";
|
||||
import { Instances, Users } from "@versia/kit/tables";
|
||||
import { FederationRequester } from "@versia/sdk/http";
|
||||
import { and, eq, inArray, isNull, or, sql } from "drizzle-orm";
|
||||
import linkifyHtml from "linkify-html";
|
||||
import {
|
||||
|
|
@ -222,10 +223,7 @@ export const findManyNotes = async (
|
|||
* @param text The text to parse mentions from.
|
||||
* @returns An array of users mentioned in the text.
|
||||
*/
|
||||
export const parseTextMentions = async (
|
||||
text: string,
|
||||
author: User,
|
||||
): Promise<User[]> => {
|
||||
export const parseTextMentions = async (text: string): Promise<User[]> => {
|
||||
const mentionedPeople = [...text.matchAll(mentionValidator)];
|
||||
if (mentionedPeople.length === 0) {
|
||||
return [];
|
||||
|
|
@ -276,7 +274,7 @@ export const parseTextMentions = async (
|
|||
|
||||
// Resolve remote mentions not in database
|
||||
for (const person of notFoundRemoteUsers) {
|
||||
const url = await (await author.federationRequester).resolveWebFinger(
|
||||
const url = await FederationRequester.resolveWebFinger(
|
||||
person[1] ?? "",
|
||||
person[2] ?? "",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -185,19 +185,19 @@ export class InboxProcessor {
|
|||
await Note.fromVersia(n);
|
||||
})
|
||||
.on(VersiaEntities.Follow, (f) => {
|
||||
this.processFollowRequest(f);
|
||||
InboxProcessor.processFollowRequest(f);
|
||||
})
|
||||
.on(VersiaEntities.FollowAccept, (f) => {
|
||||
this.processFollowAccept(f);
|
||||
InboxProcessor.processFollowAccept(f);
|
||||
})
|
||||
.on(VersiaEntities.FollowReject, (f) => {
|
||||
this.processFollowReject(f);
|
||||
InboxProcessor.processFollowReject(f);
|
||||
})
|
||||
.on(VersiaEntities.Like, (l) => {
|
||||
this.processLikeRequest(l);
|
||||
InboxProcessor.processLikeRequest(l);
|
||||
})
|
||||
.on(VersiaEntities.Delete, (d) => {
|
||||
this.processDelete(d);
|
||||
InboxProcessor.processDelete(d);
|
||||
})
|
||||
.on(VersiaEntities.User, async (u) => {
|
||||
await User.fromVersia(u);
|
||||
|
|
@ -216,7 +216,7 @@ export class InboxProcessor {
|
|||
* @param {VersiaFollow} follow - The Follow entity to process.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
private async processFollowRequest(
|
||||
private static async processFollowRequest(
|
||||
follow: VersiaEntities.Follow,
|
||||
): Promise<void> {
|
||||
const author = await User.resolve(follow.data.author);
|
||||
|
|
@ -264,7 +264,7 @@ export class InboxProcessor {
|
|||
* @param {VersiaFollowAccept} followAccept - The FollowAccept entity to process.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
private async processFollowAccept(
|
||||
private static async processFollowAccept(
|
||||
followAccept: VersiaEntities.FollowAccept,
|
||||
): Promise<void> {
|
||||
const author = await User.resolve(followAccept.data.author);
|
||||
|
|
@ -299,7 +299,7 @@ export class InboxProcessor {
|
|||
* @param {VersiaFollowReject} followReject - The FollowReject entity to process.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
private async processFollowReject(
|
||||
private static async processFollowReject(
|
||||
followReject: VersiaEntities.FollowReject,
|
||||
): Promise<void> {
|
||||
const author = await User.resolve(followReject.data.author);
|
||||
|
|
@ -334,7 +334,9 @@ export class InboxProcessor {
|
|||
* @param {VersiaDelete} delete_ - The Delete entity to process.
|
||||
* @returns {Promise<void>}
|
||||
*/ // JS doesn't allow the use of `delete` as a variable name
|
||||
public async processDelete(delete_: VersiaEntities.Delete): Promise<void> {
|
||||
public static async processDelete(
|
||||
delete_: VersiaEntities.Delete,
|
||||
): Promise<void> {
|
||||
const toDelete = delete_.data.deleted;
|
||||
|
||||
const author = delete_.data.author
|
||||
|
|
@ -403,7 +405,9 @@ export class InboxProcessor {
|
|||
* @param {VersiaLikeExtension} like - The Like entity to process.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
private async processLikeRequest(like: VersiaEntities.Like): Promise<void> {
|
||||
private static async processLikeRequest(
|
||||
like: VersiaEntities.Like,
|
||||
): Promise<void> {
|
||||
const author = await User.resolve(like.data.author);
|
||||
const likedNote = await Note.resolve(like.data.liked);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue