Skip to content

Commit 04c8f64

Browse files
authored
allow spaces in names of tagged users (#67)
1 parent 61ec83b commit 04c8f64

File tree

9 files changed

+372
-322
lines changed

9 files changed

+372
-322
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ updates:
33
- package-ecosystem: "npm"
44
directory: "/services/bot"
55
schedule:
6-
interval: "daily"
6+
interval: "weekly"
77
assignees:
88
- "avthorn"
99
- package-ecosystem: "github-actions"

docs/administration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can add individual admins to a project by tagging them using the following c
3232
```
3333
=== "Regex"
3434
```
35-
^\s*create admin [\S]+\s*$
35+
^\s*create admin \S+?(\s\S+?)?\s*$
3636
```
3737

3838
???+ important
@@ -67,7 +67,7 @@ You can remove individual admins to a project by tagging them using the followin
6767
```
6868
=== "Regex"
6969
```
70-
^\s*(delete|remove) admin [\S]+\s*$
70+
^\s*(delete|remove) admin \S+?(\s\S+?)?\s*$
7171
```
7272

7373
???+ important

docs/queues.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ You can add other members within the same space to the current queue using the f
220220
```
221221
=== "Regex"
222222
```
223-
^\s*add person .+\s*$
223+
^\s*add person \S+?(\s\S+?)?\s*$
224224
```
225225

226226
???+ important
@@ -249,7 +249,7 @@ You can remove other members within the same space from the current queue using
249249
```
250250
=== "Regex"
251251
```
252-
^\s*remove person .+\s*$
252+
^\s*remove person \S+?(\s\S+?)?\s*$
253253
```
254254

255255
???+ important
@@ -305,7 +305,7 @@ Qutex can give you an estimated time remaining until you are moved to the head o
305305
f(\gamma, n)=\begin{cases}
306306
0 \quad &\text{if} \, n = 0\\
307307
\max(g(\gamma, 0) - \alpha, 0) \quad &\text{if} \, n = 1 \\
308-
g(\gamma, n) + f(h(\theta), n-1)) \quad &\text{if} \, n \notin {0,1} \\
308+
g(\gamma, n) + f(h(\gamma), n-1)) \quad &\text{if} \, n \notin {0,1} \\
309309
\end{cases}
310310
\end{equation*}
311311
$$

services/bot/src/commands/admins/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class Create extends CommandBase implements ICommand {
1414
public readonly AUTHORIZATION: Auth = Auth.PROJECT_ADMIN;
1515
public readonly COMMAND_TYPE: CommandType = CommandType.CREATE;
1616
public readonly COMMAND_BASE: string = 'admin';
17-
public readonly ARGS: string = '{name:\\S+?}';
17+
public readonly ARGS: string = '{name:\\S+?(\\s\\S+?)?}';
1818
public readonly DESCRIPTION: string = 'Adds a target project admin';
1919
/* eslint-enable jsdoc/require-jsdoc */
2020

services/bot/src/commands/admins/remove.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class Remove extends CommandBase implements ICommand {
1414
public readonly AUTHORIZATION: Auth = Auth.PROJECT_ADMIN;
1515
public readonly COMMAND_TYPE: CommandType = CommandType.OPERATION;
1616
public readonly COMMAND_BASE: string = 'remove admin';
17-
public readonly ARGS: string = '{name:\\S+?}';
17+
public readonly ARGS: string = '{name:\\S+?(\\s\\S+?)?}';
1818
public readonly DESCRIPTION: string = 'Removes a user as a project admin';
1919
/* eslint-enable jsdoc/require-jsdoc */
2020

services/bot/src/commands/queue/addPerson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AddPerson extends CommandBase implements ICommand {
1414
public readonly AUTHORIZATION: Auth = Auth.PROJECT_ADMIN;
1515
public readonly COMMAND_TYPE: CommandType = CommandType.OPERATION;
1616
public readonly COMMAND_BASE: string = 'add person';
17-
public readonly ARGS: string = '{name:\\S+?}';
17+
public readonly ARGS: string = '{name:\\S+?(\\s\\S+?)?}';
1818
public readonly DESCRIPTION: string = 'Adds a tagged person to the current queue';
1919
public readonly QUEUE: boolean = true;
2020
/* eslint-enable jsdoc/require-jsdoc */

services/bot/src/commands/queue/removePerson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class RemovePerson extends CommandBase implements ICommand {
1313
public readonly AUTHORIZATION: Auth = Auth.PROJECT_ADMIN;
1414
public readonly COMMAND_TYPE: CommandType = CommandType.OPERATION;
1515
public readonly COMMAND_BASE: string = 'remove person';
16-
public readonly ARGS: string = '{name:\\S+?}';
16+
public readonly ARGS: string = '{name:\\S+?(\\s\\S+?)?}';
1717
public readonly QUEUE: boolean = true;
1818
public readonly DESCRIPTION: string = 'Removes a tagged person from the current queue';
1919
/* eslint-enable jsdoc/require-jsdoc */

services/bot/tests/parser.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ describe('Parser is working', () => {
144144
// Not a real command
145145
expect(result.action).toEqual(undefined);
146146
});
147+
test('create admin with queue specification with spaces in name', async () => {
148+
await CREATE_QUEUE(project as ProjectDocument, 'FOOBAR');
149+
BOT.messages.get
150+
.mockReturnValue({ text: 'create admin FOO BAR BADOO on queue FOOBAR', mentionedPeople: ['fooId2'] });
151+
const result = await new Parser().parse(MOCK_REQUEST);
152+
// Not a real command
153+
expect(result.action).toEqual(undefined);
154+
});
147155
});
148156
describe('remove admin', () => {
149157
test('remove admin no queue specification', async () => {
@@ -163,6 +171,14 @@ describe('Parser is working', () => {
163171
// Not a real command
164172
expect(result.action).toEqual(undefined);
165173
});
174+
test('remove admin with queue specification with spaces in name', async () => {
175+
await CREATE_QUEUE(project as ProjectDocument, 'FOOBAR');
176+
BOT.messages.get
177+
.mockReturnValue({ text: 'remove admin FOO BAR BADOOOO on queue FOOBAR', mentionedPeople: ['fooId2'] });
178+
const result = await new Parser().parse(MOCK_REQUEST);
179+
// Not a real command
180+
expect(result.action).toEqual(undefined);
181+
});
166182
});
167183

168184
describe('help', () => {

0 commit comments

Comments
 (0)