Skip to content

Commit 33aed28

Browse files
committed
add pre room user joined test
1 parent dab1ec6 commit 33aed28

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

AppsRocketChatTesterApp.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ import {
2727
IUIKitResponse,
2828
UIKitViewSubmitInteractionContext,
2929
} from "@rocket.chat/apps-engine/definition/uikit";
30+
import { UserNotAllowedException } from "@rocket.chat/apps-engine/definition/exceptions";
31+
import {
32+
IPreRoomUserJoined,
33+
IRoomUserJoinedContext,
34+
} from "@rocket.chat/apps-engine/definition/rooms";
3035

31-
export class RocketChatTester extends App {
36+
export class RocketChatTester extends App implements IPreRoomUserJoined {
3237
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
3338
super(info, logger, accessors);
3439
}
@@ -65,6 +70,12 @@ export class RocketChatTester extends App {
6570
);
6671
}
6772

73+
public async executePreRoomUserJoined(context: IRoomUserJoinedContext) {
74+
if (context.joiningUser.username === "userNotAllowedByApp") {
75+
throw new UserNotAllowedException("TEST OF NOT ALLOWED USER");
76+
}
77+
}
78+
6879
public async executeViewSubmitHandler(
6980
interactionContext: UIKitViewSubmitInteractionContext,
7081
read: IRead,

app.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "bc4dd4a1-bf9b-408e-83a4-aba7eba0bf02",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"requiredApiVersion": "^1.44.0",
55
"iconFile": "icon.png",
66
"author": {
@@ -12,5 +12,7 @@
1212
"nameSlug": "appsrocketchattester",
1313
"classFile": "AppsRocketChatTesterApp.ts",
1414
"description": "An app that provides endpoints to test Apps integration to Rocket.Chat",
15-
"implements": []
15+
"implements": [
16+
"IPreRoomUserJoined"
17+
]
1618
}

dist/appsrocketchattester_0.2.0.zip

14.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)