Skip to content

Commit

Permalink
chore: remove limits for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-ae committed Sep 12, 2024
1 parent a4df1b9 commit 7b4e031
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ To configure your Ubiquibot to run this plugin, add the following to the `.ubiqu
reviewDelayTolerance: "3 Days"
taskStaleTimeoutDuration: "30 Days"
maxConcurrentTasks: # Default concurrent task limits per role.
admin: 10
member: 5
contributor: 3
startRequiresWallet: true # default is true
Expand Down
2 changes: 1 addition & 1 deletion src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const startStopSchema = T.Object(
reviewDelayTolerance: T.String({ default: "1 Day" }),
taskStaleTimeoutDuration: T.String({ default: "30 Days" }),
startRequiresWallet: T.Boolean({ default: true }),
maxConcurrentTasks: T.Record(T.String(), T.Integer(), { default: { admin: 20, member: 10, contributor: 2 } }),
maxConcurrentTasks: T.Record(T.String(), T.Integer(), { default: { admin: Infinity, member: 10, contributor: 2 } }),
emptyWalletText: T.String({ default: "Please set your wallet address with the /wallet command first and try again." }),
},
{
Expand Down
17 changes: 1 addition & 16 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,6 @@ describe("User start/stop", () => {
expect(memberLimit).toEqual(6);
});

test("should set maxLimits to 8 if the user is an admin", async () => {
const issue = db.issue.findFirst({ where: { id: { equals: 1 } } }) as unknown as Issue;
const sender = db.users.findFirst({ where: { id: { equals: 1 } } }) as unknown as Sender;

const adminLimit = maxConcurrentDefaults.admin;

createIssuesForMaxAssignment(adminLimit + 4, sender.id);
const context = createContext(issue, sender) as unknown as Context;

context.adapters = createAdapters(getSupabase(), context as unknown as Context);
await expect(userStartStop(context)).rejects.toThrow("You have reached your max task limit. Please close out some tasks before assigning new ones.");

expect(adminLimit).toEqual(8);
});

test("User can't start an issue if they have previously been unassigned by an admin", async () => {
const issue = db.issue.findFirst({ where: { id: { equals: 6 } } }) as unknown as Issue;
const sender = db.users.findFirst({ where: { id: { equals: 2 } } }) as unknown as PayloadSender;
Expand Down Expand Up @@ -587,7 +572,7 @@ function createIssuesForMaxAssignment(n: number, userId: number) {
}

const maxConcurrentDefaults = {
admin: 8,
admin: Infinity,
member: 6,
contributor: 4,
};
Expand Down

0 comments on commit 7b4e031

Please sign in to comment.