refactor: Reexport UserLimits, change getLimits to get limits (#167)

* refactor: Reexport UserLimits, change getLimits to get limits

Signed-off-by: Jacob Schlecht <dadadah@echoha.us>

* fix: Use new userlimits on the client class

Signed-off-by: Jacob Schlecht <dadadah@echoha.us>

---------

Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
This commit is contained in:
Jacob Schlecht
2026-06-29 12:00:18 -06:00
committed by GitHub
parent afdd11fc3b
commit 4573e6b2bb
2 changed files with 14 additions and 6 deletions
+7 -4
View File
@@ -4,14 +4,14 @@ import { batch, createSignal } from "solid-js";
import { ReactiveMap } from "@solid-primitives/map";
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
import { API } from "stoat-api";
import type { DataLogin, RevoltConfig, Role, UserLimits } from "stoat-api";
import type { DataLogin, RevoltConfig, Role } from "stoat-api";
import type { Channel } from "./classes/Channel.js";
import type { Emoji } from "./classes/Emoji.js";
import type { Message } from "./classes/Message.js";
import type { Server } from "./classes/Server.js";
import type { ServerMember } from "./classes/ServerMember.js";
import type { User } from "./classes/User.js";
import type { User, UserLimits } from "./classes/User.js";
import { AccountCollection } from "./collections/AccountCollection.js";
import { BotCollection } from "./collections/BotCollection.js";
import { ChannelCollection } from "./collections/ChannelCollection.js";
@@ -611,11 +611,14 @@ export class Client extends AsyncEventEmitter<Events> {
this.#slowmodeTimers.set(channelId, timer);
}
getLimits(): UserLimits | undefined {
/**
* Backend enforced limits for the logged in user
*/
get limits(): UserLimits | undefined {
if (!this.configured() || !this.user) {
return;
}
return this.user.getLimits();
return this.user.limits;
}
}
+7 -2
View File
@@ -1,8 +1,8 @@
import type {
User as APIUser,
UserLimits as APIUserLimits,
DataEditUser,
Presence,
UserLimits,
} from "stoat-api";
import { decodeTime } from "ulid";
@@ -14,6 +14,8 @@ import type { Channel } from "./Channel.js";
import type { File } from "./File.js";
import { UserProfile } from "./UserProfile.js";
export type UserLimits = APIUserLimits;
/**
* User Class
*/
@@ -347,7 +349,10 @@ export class User {
);
}
getLimits(): UserLimits | undefined {
/**
* Backend enforced limits for a user
*/
get limits(): UserLimits | undefined {
if (!this.#collection.client.configured()) {
return;
}