diff --git a/src/definition/App.ts b/src/definition/App.ts
index 464814ee4..97d53048e 100644
--- a/src/definition/App.ts
+++ b/src/definition/App.ts
@@ -57,18 +57,6 @@ export abstract class App implements IApp {
return this.info.nameSlug;
}
- /**
- * Gets the username of this App's app user.
- *
- * @return {string} the username of the app user
- *
- * @deprecated This method will be removed in the next major version.
- * Please use read.getUserReader().getAppUser() instead.
- */
- public getAppUserUsername(): string {
- return `${ this.info.nameSlug }.bot`;
- }
-
/**
* Get the ID of this App, please see for how to obtain an ID for your App.
*
diff --git a/src/definition/IApp.ts b/src/definition/IApp.ts
index b355c3b11..1837d641e 100644
--- a/src/definition/IApp.ts
+++ b/src/definition/IApp.ts
@@ -26,16 +26,6 @@ export interface IApp {
*/
getNameSlug(): string;
- /**
- * Gets the username of this App's app user.
- *
- * @return {string} the username of the app user
- *
- * @deprecated This method will be removed in the next major version.
- * Please use read.getAppUser instead.
- */
- getAppUserUsername(): string;
-
/**
* Get the ID of this App, please see for how to obtain an ID for your App.
*
diff --git a/src/definition/accessors/ILivechatRead.ts b/src/definition/accessors/ILivechatRead.ts
index 11dee0c23..3cb233ab7 100644
--- a/src/definition/accessors/ILivechatRead.ts
+++ b/src/definition/accessors/ILivechatRead.ts
@@ -7,22 +7,10 @@ export interface ILivechatRead {
/**
* Gets online status of the livechat.
* @param departmentId (optional) the id of the livechat department
- * @deprecated use `isOnlineAsync` instead
*/
- isOnline(departmentId?: string): boolean;
- /**
- * Gets online status of the livechat.
- * @param departmentId (optional) the id of the livechat department
- */
- isOnlineAsync(departmentId?: string): Promise;
+ isOnline(departmentId?: string): Promise;
getDepartmentsEnabledWithAgents(): Promise>;
getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise>;
- /**
- * @deprecated This method does not adhere to the conversion practices applied
- * elsewhere in the Apps-Engine and will be removed in the next major version.
- * Prefer the alternative methods to fetch visitors.
- */
- getLivechatVisitors(query: object): Promise>;
getLivechatVisitorById(id: string): Promise;
getLivechatVisitorByEmail(email: string): Promise;
getLivechatVisitorByToken(token: string): Promise;
diff --git a/src/definition/accessors/IRoomBuilder.ts b/src/definition/accessors/IRoomBuilder.ts
index 4c375f460..88d536e38 100644
--- a/src/definition/accessors/IRoomBuilder.ts
+++ b/src/definition/accessors/IRoomBuilder.ts
@@ -67,28 +67,6 @@ export interface IRoomBuilder {
*/
getCreator(): IUser;
- /**
- * Adds a user to the room, these are by username until further notice.
- *
- * @param username the user's username to add to the room
- * @deprecated in favor of `addMemberToBeAddedByUsername`. This method will be removed on version 2.0.0
- */
- addUsername(username: string): IRoomBuilder;
-
- /**
- * Sets the usernames of who are joined to the room.
- *
- * @param usernames the list of usernames
- * @deprecated in favor of `setMembersByUsernames`. This method will be removed on version 2.0.0
- */
- setUsernames(usernames: Array): IRoomBuilder;
-
- /**
- * Gets the usernames of users in the room.
- * @deprecated in favor of `getMembersUsernames`. This method will be removed on version 2.0.0
- */
- getUsernames(): Array;
-
/**
* Adds a member to the room by username
*
diff --git a/src/definition/accessors/IRoomRead.ts b/src/definition/accessors/IRoomRead.ts
index 2ccd18fb3..862e075ea 100644
--- a/src/definition/accessors/IRoomRead.ts
+++ b/src/definition/accessors/IRoomRead.ts
@@ -62,6 +62,13 @@ export interface IRoomRead {
*/
getDirectByUsernames(usernames: Array): Promise;
+ /**
+ * Gets a direct room with all user ids
+ * @param userIds all user ids belonging to the direct room
+ * @returns the room
+ */
+ getDirectByUserIds(userIds: Array): Promise;
+
/**
* Get a list of the moderators of a given room
*
diff --git a/src/definition/accessors/IUserRead.ts b/src/definition/accessors/IUserRead.ts
index 4fce21a37..d89dd516a 100644
--- a/src/definition/accessors/IUserRead.ts
+++ b/src/definition/accessors/IUserRead.ts
@@ -12,7 +12,7 @@ export interface IUserRead {
/**
* Gets the app user of this app.
*/
- getAppUser(appId?: string): Promise;
+ getAppUser(): Promise;
/**
* Gets the user's badge count (unread messages count).
diff --git a/src/definition/livechat/ILivechatRoomClosedHandler.ts b/src/definition/livechat/ILivechatRoomClosedHandler.ts
deleted file mode 100644
index 5c2e80314..000000000
--- a/src/definition/livechat/ILivechatRoomClosedHandler.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { IHttp, IPersistence, IRead } from '../accessors';
-import { AppMethod } from '../metadata';
-import { ILivechatRoom } from './ILivechatRoom';
-
-/**
- * Handler called after a livechat room is closed.
- * @deprecated please prefer the IPostLivechatRoomClosed event
- */
-export interface ILivechatRoomClosedHandler {
- /**
- * Method called *after* a livechat room is closed.
- *
- * @param livechatRoom The livechat room which is closed.
- * @param read An accessor to the environment
- * @param http An accessor to the outside world
- * @param persistence An accessor to the App's persistence
- */
- [AppMethod.EXECUTE_LIVECHAT_ROOM_CLOSED_HANDLER](data: ILivechatRoom, read: IRead, http: IHttp, persistence: IPersistence): Promise;
-}
diff --git a/src/definition/livechat/index.ts b/src/definition/livechat/index.ts
index 5ea8d9f42..b40aa7769 100644
--- a/src/definition/livechat/index.ts
+++ b/src/definition/livechat/index.ts
@@ -2,7 +2,6 @@ import { IDepartment } from './IDepartment';
import { ILivechatEventContext } from './ILivechatEventContext';
import { ILivechatMessage } from './ILivechatMessage';
import { ILivechatRoom } from './ILivechatRoom';
-import { ILivechatRoomClosedHandler } from './ILivechatRoomClosedHandler';
import { ILivechatTransferData } from './ILivechatTransferData';
import { ILivechatTransferEventContext, LivechatTransferEventType } from './ILivechatTransferEventContext';
import { IPostLivechatAgentAssigned } from './IPostLivechatAgentAssigned';
@@ -27,7 +26,6 @@ export {
IPostLivechatRoomClosed,
IPostLivechatRoomSaved,
IPostLivechatRoomTransferred,
- ILivechatRoomClosedHandler,
ILivechatTransferData,
ILivechatTransferEventContext,
IDepartment,
diff --git a/src/definition/metadata/AppInterface.ts b/src/definition/metadata/AppInterface.ts
index b84a0e18b..77adec92c 100644
--- a/src/definition/metadata/AppInterface.ts
+++ b/src/definition/metadata/AppInterface.ts
@@ -35,10 +35,6 @@ export enum AppInterface {
// Livechat
IPostLivechatRoomStarted = 'IPostLivechatRoomStarted',
IPostLivechatRoomClosed = 'IPostLivechatRoomClosed',
- /**
- * @deprecated please use the AppMethod.EXECUTE_POST_LIVECHAT_ROOM_CLOSED method
- */
- ILivechatRoomClosedHandler = 'ILivechatRoomClosedHandler',
IPostLivechatAgentAssigned = 'IPostLivechatAgentAssigned',
IPostLivechatAgentUnassigned = 'IPostLivechatAgentUnassigned',
IPostLivechatRoomTransferred = 'IPostLivechatRoomTransferred',
diff --git a/src/definition/rooms/IRoom.ts b/src/definition/rooms/IRoom.ts
index da106db08..b0ff72954 100644
--- a/src/definition/rooms/IRoom.ts
+++ b/src/definition/rooms/IRoom.ts
@@ -7,10 +7,6 @@ export interface IRoom {
slugifiedName: string;
type: RoomType;
creator: IUser;
- /**
- * @deprecated usernames will be removed on version 2.0.0
- */
- usernames: Array;
userIds?: Array;
isDefault?: boolean;
isReadOnly?: boolean;
diff --git a/src/server/AppManager.ts b/src/server/AppManager.ts
index 7dac3a270..9fa45c19e 100644
--- a/src/server/AppManager.ts
+++ b/src/server/AppManager.ts
@@ -482,7 +482,6 @@ export class AppManager {
undoSteps.push(() => this.removeAppUser(app));
} catch (err) {
aff.setAppUserError({
- username: app.getAppUserUsername(),
message: 'Failed to create an app user for this app.',
});
@@ -973,7 +972,7 @@ export class AppManager {
}
private async createAppUser(appInfo: IAppInfo): Promise {
- const appUser = await (this.bridges.getUserBridge() as IInternalUserBridge & UserBridge).getAppUser(appInfo.id);
+ const appUser = await (this.bridges.getUserBridge() as IInternalUserBridge & UserBridge).getAppUser();
if (appUser) {
return appUser.id;
@@ -997,7 +996,7 @@ export class AppManager {
}
private async removeAppUser(app: ProxiedApp): Promise {
- const appUser = await (this.bridges.getUserBridge() as IInternalUserBridge & UserBridge).getAppUser(app.getID());
+ const appUser = await (this.bridges.getUserBridge() as IInternalUserBridge & UserBridge).getAppUser();
if (!appUser) {
return true;
diff --git a/src/server/ProxiedApp.ts b/src/server/ProxiedApp.ts
index 2e60fd316..4c4d087ea 100644
--- a/src/server/ProxiedApp.ts
+++ b/src/server/ProxiedApp.ts
@@ -117,10 +117,6 @@ export class ProxiedApp implements IApp {
return this.app.getNameSlug();
}
- public getAppUserUsername(): string {
- return this.app.getAppUserUsername();
- }
-
public getID(): string {
return this.app.getID();
}
diff --git a/src/server/accessors/LivechatRead.ts b/src/server/accessors/LivechatRead.ts
index 7a73cffda..af9ac7386 100644
--- a/src/server/accessors/LivechatRead.ts
+++ b/src/server/accessors/LivechatRead.ts
@@ -7,20 +7,10 @@ import { LivechatBridge } from '../bridges/LivechatBridge';
export class LivechatRead implements ILivechatRead {
constructor(private readonly livechatBridge: LivechatBridge, private readonly appId: string) { }
- /**
- * @deprecated please use the `isOnlineAsync` method instead.
- * In the next major, this method will be `async`
- */
- public isOnline(departmentId?: string): boolean {
- console.warn('The `LivechatRead.isOnline` method is deprecated and won\'t behave as intended. Please use `LivechatRead.isOnlineAsync` instead');
-
+ public isOnline(departmentId?: string): Promise {
return this.livechatBridge.doIsOnline(departmentId, this.appId);
}
- public isOnlineAsync(departmentId?: string): Promise {
- return this.livechatBridge.doIsOnlineAsync(departmentId, this.appId);
- }
-
public getDepartmentsEnabledWithAgents(): Promise> {
return this.livechatBridge.doFindDepartmentsEnabledWithAgents(this.appId);
}
@@ -29,15 +19,6 @@ export class LivechatRead implements ILivechatRead {
return this.livechatBridge.doFindRooms(visitor, departmentId, this.appId);
}
- /**
- * @deprecated This method does not adhere to the conversion practices applied
- * elsewhere in the Apps-Engine and will be removed in the next major version.
- * Prefer the alternative methods to fetch visitors.
- */
- public getLivechatVisitors(query: object): Promise> {
- return this.livechatBridge.doFindVisitors(query, this.appId);
- }
-
public getLivechatVisitorById(id: string): Promise {
return this.livechatBridge.doFindVisitorById(id, this.appId);
}
diff --git a/src/server/accessors/RoomBuilder.ts b/src/server/accessors/RoomBuilder.ts
index 7c3de167d..cefb18c67 100644
--- a/src/server/accessors/RoomBuilder.ts
+++ b/src/server/accessors/RoomBuilder.ts
@@ -57,33 +57,6 @@ export class RoomBuilder implements IRoomBuilder {
return this.room.creator;
}
- /**
- * @deprecated
- */
- public addUsername(username: string): IRoomBuilder {
- this.addMemberToBeAddedByUsername(username);
- return this;
- }
-
- /**
- * @deprecated
- */
- public setUsernames(usernames: Array): IRoomBuilder {
- this.setMembersToBeAddedByUsernames(usernames);
- return this;
- }
-
- /**
- * @deprecated
- */
- public getUsernames(): Array {
- const usernames = this.getMembersToBeAddedUsernames();
- if (usernames && usernames.length > 0) {
- return usernames;
- }
- return this.room.usernames || [];
- }
-
public addMemberToBeAddedByUsername(username: string): IRoomBuilder {
this.members.push(username);
return this;
diff --git a/src/server/accessors/RoomRead.ts b/src/server/accessors/RoomRead.ts
index 137669c42..2b9f331ea 100644
--- a/src/server/accessors/RoomRead.ts
+++ b/src/server/accessors/RoomRead.ts
@@ -36,6 +36,10 @@ export class RoomRead implements IRoomRead {
return this.roomBridge.doGetDirectByUsernames(usernames, this.appId);
}
+ public getDirectByUserIds(userIds: Array): Promise {
+ return this.roomBridge.doGetDirectByUserIds(userIds, this.appId);
+ }
+
public getModerators(roomId: string): Promise> {
return this.roomBridge.doGetModerators(roomId, this.appId);
}
diff --git a/src/server/accessors/UserRead.ts b/src/server/accessors/UserRead.ts
index 5f9eb1999..f2eccbd08 100644
--- a/src/server/accessors/UserRead.ts
+++ b/src/server/accessors/UserRead.ts
@@ -13,8 +13,8 @@ export class UserRead implements IUserRead {
return this.userBridge.doGetByUsername(username, this.appId);
}
- public getAppUser(appId: string = this.appId): Promise {
- return this.userBridge.doGetAppUser(appId);
+ public getAppUser(): Promise {
+ return this.userBridge.doGetAppUser(this.appId);
}
public getUserUnreadMessageCount(uid: string): Promise {
diff --git a/src/server/bridges/IInternalUserBridge.ts b/src/server/bridges/IInternalUserBridge.ts
index 50597ea5c..8219a95d0 100644
--- a/src/server/bridges/IInternalUserBridge.ts
+++ b/src/server/bridges/IInternalUserBridge.ts
@@ -2,7 +2,7 @@ import { IUser, IUserCreationOptions } from '../../definition/users';
export interface IInternalUserBridge {
create(data: Partial, appId: string, options?: IUserCreationOptions): Promise;
- getAppUser(appId?: string): Promise;
+ getAppUser(): Promise;
remove(user: IUser, appId: string): Promise;
getActiveUserCount(): Promise;
}
diff --git a/src/server/bridges/LivechatBridge.ts b/src/server/bridges/LivechatBridge.ts
index edd04f96f..01702cc0d 100644
--- a/src/server/bridges/LivechatBridge.ts
+++ b/src/server/bridges/LivechatBridge.ts
@@ -39,18 +39,12 @@ type LivechatMultiplePermissions = keyof Pick<
>;
export abstract class LivechatBridge extends BaseBridge {
- public doIsOnline(departmentId?: string, appId?: string): boolean {
+ public async doIsOnline(departmentId?: string, appId?: string): Promise {
if (this.hasReadPermission(appId, 'livechat-status')) {
return this.isOnline(departmentId, appId);
}
}
- public async doIsOnlineAsync(departmentId?: string, appId?: string): Promise {
- if (this.hasReadPermission(appId, 'livechat-status')) {
- return this.isOnlineAsync(departmentId, appId);
- }
- }
-
public async doCreateMessage(message: ILivechatMessage, appId: string): Promise {
if (this.hasWritePermission(appId, 'livechat-message')) {
return this.createMessage(message, appId);
@@ -75,12 +69,6 @@ export abstract class LivechatBridge extends BaseBridge {
}
}
- public async doFindVisitors(query: object, appId: string): Promise> {
- if (this.hasReadPermission(appId, 'livechat-visitor')) {
- return this.findVisitors(query, appId);
- }
- }
-
public async doFindVisitorById(id: string, appId: string): Promise {
if (this.hasReadPermission(appId, 'livechat-visitor')) {
return this.findVisitorById(id, appId);
@@ -153,22 +141,11 @@ export abstract class LivechatBridge extends BaseBridge {
}
}
- /**
- * @deprecated please use the `isOnlineAsync` method instead.
- * In the next major, this method will be `async`
- */
- protected abstract isOnline(departmentId?: string, appId?: string): boolean;
- protected abstract isOnlineAsync(departmentId?: string, appId?: string): Promise;
+ protected abstract isOnline(departmentId?: string, appId?: string): Promise;
protected abstract createMessage(message: ILivechatMessage, appId: string): Promise;
protected abstract getMessageById(messageId: string, appId: string): Promise;
protected abstract updateMessage(message: ILivechatMessage, appId: string): Promise;
protected abstract createVisitor(visitor: IVisitor, appId: string): Promise;
- /**
- * @deprecated This method does not adhere to the conversion practices applied
- * elsewhere in the Apps-Engine and will be removed in the next major version.
- * Prefer other methods that fetch visitors.
- */
- protected abstract findVisitors(query: object, appId: string): Promise>;
protected abstract findVisitorById(id: string, appId: string): Promise;
protected abstract findVisitorByEmail(email: string, appId: string): Promise;
protected abstract findVisitorByToken(token: string, appId: string): Promise;
diff --git a/src/server/bridges/RoomBridge.ts b/src/server/bridges/RoomBridge.ts
index 1a97ff017..c01303ec7 100644
--- a/src/server/bridges/RoomBridge.ts
+++ b/src/server/bridges/RoomBridge.ts
@@ -37,6 +37,12 @@ export abstract class RoomBridge extends BaseBridge {
}
}
+ public async doGetDirectByUserIds(userIds: Array, appId: string): Promise {
+ if (this.hasReadPermission(appId)) {
+ return this.getDirectByUserIds(userIds, appId);
+ }
+ }
+
public async doGetDirectByUsernames(usernames: Array, appId: string): Promise {
if (this.hasReadPermission(appId)) {
return this.getDirectByUsernames(usernames, appId);
@@ -97,6 +103,7 @@ export abstract class RoomBridge extends BaseBridge {
protected abstract getCreatorById(roomId: string, appId: string): Promise;
protected abstract getCreatorByName(roomName: string, appId: string): Promise;
protected abstract getDirectByUsernames(usernames: Array, appId: string): Promise;
+ protected abstract getDirectByUserIds(userIds: Array, appId: string): Promise;
protected abstract getMembers(roomId: string, appId: string): Promise>;
protected abstract update(room: IRoom, members: Array, appId: string): Promise;
protected abstract createDiscussion(
diff --git a/src/server/bridges/UserBridge.ts b/src/server/bridges/UserBridge.ts
index 633df3d5d..670c507e4 100644
--- a/src/server/bridges/UserBridge.ts
+++ b/src/server/bridges/UserBridge.ts
@@ -17,7 +17,7 @@ export abstract class UserBridge extends BaseBridge {
}
}
- public async doGetAppUser(appId?: string): Promise {
+ public async doGetAppUser(appId: string): Promise {
return this.getAppUser(appId);
}
@@ -47,7 +47,7 @@ export abstract class UserBridge extends BaseBridge {
protected abstract getById(id: string, appId: string): Promise;
protected abstract getByUsername(username: string, appId: string): Promise;
- protected abstract getAppUser(appId?: string): Promise;
+ protected abstract getAppUser(appId: string): Promise;
protected abstract getActiveUserCount(): Promise;
protected abstract getUserUnreadMessageCount(uid: string): Promise;
diff --git a/src/server/managers/AppListenerManager.ts b/src/server/managers/AppListenerManager.ts
index 4054e248b..543373f78 100644
--- a/src/server/managers/AppListenerManager.ts
+++ b/src/server/managers/AppListenerManager.ts
@@ -238,11 +238,6 @@ export class AppListenerManager {
// Livechat
case AppInterface.IPostLivechatRoomStarted:
return this.executePostLivechatRoomStarted(data as ILivechatRoom);
- /**
- * @deprecated please prefer the AppInterface.IPostLivechatRoomClosed event
- */
- case AppInterface.ILivechatRoomClosedHandler:
- return this.executeLivechatRoomClosedHandler(data as ILivechatRoom);
case AppInterface.IPostLivechatRoomClosed:
return this.executePostLivechatRoomClosed(data as ILivechatRoom);
case AppInterface.IPostLivechatRoomSaved:
@@ -1060,26 +1055,6 @@ export class AppListenerManager {
}
}
- private async executeLivechatRoomClosedHandler(data: ILivechatRoom): Promise {
- const cfLivechatRoom = Utilities.deepCloneAndFreeze(data);
-
- for (const appId of this.listeners.get(AppInterface.ILivechatRoomClosedHandler)) {
- const app = this.manager.getOneById(appId);
-
- if (!app.hasMethod(AppMethod.EXECUTE_LIVECHAT_ROOM_CLOSED_HANDLER)) {
- continue;
- }
-
- await app.call(AppMethod.EXECUTE_LIVECHAT_ROOM_CLOSED_HANDLER,
- cfLivechatRoom,
- this.am.getReader(appId),
- this.am.getHttp(appId),
- this.am.getPersistence(appId),
- this.am.getModifier(appId),
- );
- }
- }
-
private async executePostLivechatRoomClosed(data: ILivechatRoom): Promise {
const cfLivechatRoom = Utilities.deepCloneAndFreeze(data);
diff --git a/src/server/rooms/Room.ts b/src/server/rooms/Room.ts
index 34ae7c3b4..43366b2b8 100644
--- a/src/server/rooms/Room.ts
+++ b/src/server/rooms/Room.ts
@@ -19,25 +19,6 @@ export class Room implements IRoom {
public lastModifiedAt?: Date;
public customFields?: { [key: string]: any };
public userIds?: Array;
- private _USERNAMES: Array;
-
- private [PrivateManager]: AppManager;
-
- /**
- * @deprecated
- */
- public get usernames(): Array {
- // Get usernames
- if (!this._USERNAMES) {
- this._USERNAMES = this[PrivateManager].getBridges().getInternalBridge().doGetUsernamesOfRoomById(this.id);
- }
-
- return this._USERNAMES;
- }
-
- public set usernames(usernames) {
- return;
- }
public constructor(room: IRoom, manager: AppManager) {
Object.assign(this, room);
diff --git a/tests/server/accessors/RoomBuilder.spec.ts b/tests/server/accessors/RoomBuilder.spec.ts
index a83b37ad2..c4a52c4c2 100644
--- a/tests/server/accessors/RoomBuilder.spec.ts
+++ b/tests/server/accessors/RoomBuilder.spec.ts
@@ -37,19 +37,6 @@ export class RoomBuilderAccessorTestFixture {
Expect(room.creator).toEqual(TestData.getUser());
Expect(rb.getCreator()).toEqual(TestData.getUser());
- Expect(rb.addUsername('testing.username')).toBe(rb);
- Expect(room.usernames).not.toBeDefined();
- Expect(rb.getUsernames()).not.toBeEmpty();
- Expect(room.usernames).not.toBeDefined();
- Expect(rb.getUsernames()[0]).toEqual('testing.username');
- Expect(rb.addUsername('another.username')).toBe(rb);
- Expect(room.usernames).not.toBeDefined();
- Expect(rb.getUsernames().length).toBe(2);
-
- Expect(rb.setUsernames([])).toBe(rb);
- Expect(room.usernames).not.toBeDefined();
- Expect(rb.getUsernames()).toBeEmpty();
-
Expect(rb.addMemberToBeAddedByUsername('testing.username')).toBe(rb);
Expect(rb.getMembersToBeAddedUsernames()).not.toBeEmpty();
Expect(rb.getMembersToBeAddedUsernames()[0]).toEqual('testing.username');
diff --git a/tests/server/accessors/RoomExtender.spec.ts b/tests/server/accessors/RoomExtender.spec.ts
index 0f12983b8..176f6d871 100644
--- a/tests/server/accessors/RoomExtender.spec.ts
+++ b/tests/server/accessors/RoomExtender.spec.ts
@@ -23,9 +23,7 @@ export class RoomExtenderAccessorTestFixture {
Expect(() => re.addCustomField('thing', 'second')).toThrowError(Error, 'The room already contains a custom field by the key: thing');
Expect(() => re.addCustomField('thing.', 'second')).toThrowError(Error, 'The given key contains a period, which is not allowed. Key: thing.');
- Expect(room.usernames).not.toBeDefined();
Expect(re.addMember(TestData.getUser('theId', 'bradley'))).toBe(re);
- Expect(room.usernames).not.toBeDefined();
Expect(re.getMembersBeingAdded()).toBeDefined();
Expect(re.getMembersBeingAdded()).not.toBeEmpty();
Expect(re.getMembersBeingAdded()[0]).not.toBeEmpty();
diff --git a/tests/server/accessors/RoomRead.spec.ts b/tests/server/accessors/RoomRead.spec.ts
index 9bd6ae4c1..96fe0f223 100644
--- a/tests/server/accessors/RoomRead.spec.ts
+++ b/tests/server/accessors/RoomRead.spec.ts
@@ -31,6 +31,9 @@ export class RoomReadAccessorTestFixture {
doGetCreatorByName(name, appId): Promise {
return Promise.resolve(theUser);
},
+ doGetDirectByUserIds(userIds, appId): Promise {
+ return Promise.resolve(theRoom);
+ },
doGetDirectByUsernames(usernames, appId): Promise {
return Promise.resolve(theRoom);
},
@@ -56,6 +59,8 @@ export class RoomReadAccessorTestFixture {
Expect(await rr.getCreatorUserByName('testing')).toBe(this.user);
Expect(await rr.getDirectByUsernames([this.user.username])).toBeDefined();
Expect(await rr.getDirectByUsernames([this.user.username])).toBe(this.room);
+ Expect(await rr.getDirectByUserIds([this.user.id])).toBeDefined();
+ Expect(await rr.getDirectByUserIds([this.user.id])).toBe(this.room);
}
@AsyncTest()
diff --git a/tests/server/accessors/UserRead.spec.ts b/tests/server/accessors/UserRead.spec.ts
index 85f6b3f64..242ec8596 100644
--- a/tests/server/accessors/UserRead.spec.ts
+++ b/tests/server/accessors/UserRead.spec.ts
@@ -8,7 +8,6 @@ import { TestData } from '../../test-data/utilities';
export class UserReadAccessorTestFixture {
private user: IUser;
private mockUserBridge: UserBridge;
- private mockAppId: 'test-appId';
@SetupFixture
public setupFixture() {
@@ -22,7 +21,7 @@ export class UserReadAccessorTestFixture {
doGetByUsername(id, appId): Promise {
return Promise.resolve(theUser);
},
- doGetAppUser(appId?: string): Promise {
+ doGetAppUser(appId: string): Promise {
return Promise.resolve(theUser);
},
} as UserBridge;
@@ -40,8 +39,7 @@ export class UserReadAccessorTestFixture {
Expect(await ur.getByUsername('username')).toBeDefined();
Expect(await ur.getByUsername('username')).toEqual(this.user);
- Expect(await ur.getAppUser(this.mockAppId)).toBeDefined();
- Expect(await ur.getAppUser(this.mockAppId)).toEqual(this.user);
+ Expect(await ur.getAppUser()).toBeDefined();
Expect(await ur.getAppUser()).toEqual(this.user);
}
}
diff --git a/tests/test-data/bridges/livechatBridge.ts b/tests/test-data/bridges/livechatBridge.ts
index 67faa32e8..08e88dec8 100644
--- a/tests/test-data/bridges/livechatBridge.ts
+++ b/tests/test-data/bridges/livechatBridge.ts
@@ -8,10 +8,7 @@ export class TestLivechatBridge extends LivechatBridge {
public findDepartmentsEnabledWithAgents(appId: string): Promise> {
throw new Error('Method not implemented.');
}
- public isOnline(departmentId?: string): boolean {
- throw new Error('Method not implemented');
- }
- public isOnlineAsync(departmentId?: string): Promise {
+ public isOnline(departmentId?: string): Promise {
throw new Error('Method not implemented');
}
public createMessage(message: ILivechatMessage, appId: string): Promise {
@@ -29,10 +26,6 @@ export class TestLivechatBridge extends LivechatBridge {
public transferVisitor(visitor: IVisitor, transferData: ILivechatTransferData, appId: string): Promise {
throw new Error('Method not implemented');
}
- public findVisitors(query: object, appId: string): Promise> {
- console.warn('The method AppLivechatBridge.findVisitors is deprecated. Please consider using its alternatives');
- throw new Error('Method not implemented');
- }
public findVisitorById(id: string, appId: string): Promise {
throw new Error('Method not implemented');
}
diff --git a/tests/test-data/bridges/roomBridge.ts b/tests/test-data/bridges/roomBridge.ts
index 1159e2456..8e6d990a1 100644
--- a/tests/test-data/bridges/roomBridge.ts
+++ b/tests/test-data/bridges/roomBridge.ts
@@ -28,6 +28,10 @@ export class TestsRoomBridge extends RoomBridge {
throw new Error('Method not implemented');
}
+ public getDirectByUserIds(userIds: Array, appId: string): Promise {
+ throw new Error('Method not implemented');
+ }
+
public getMembers(roomName: string, appId: string): Promise> {
throw new Error('Method not implemented.');
}
diff --git a/tests/test-data/bridges/userBridge.ts b/tests/test-data/bridges/userBridge.ts
index 18993c1ca..99c9c4a8f 100644
--- a/tests/test-data/bridges/userBridge.ts
+++ b/tests/test-data/bridges/userBridge.ts
@@ -23,7 +23,7 @@ export class TestsUserBridge extends UserBridge {
throw new Error('Method not implemented.');
}
- public getAppUser(appId?: string): Promise {
+ public getAppUser(appId: string): Promise {
throw new Error('Method not implemented.');
}
diff --git a/tests/test-data/utilities.ts b/tests/test-data/utilities.ts
index 19d9f8c68..e70ac10a4 100644
--- a/tests/test-data/utilities.ts
+++ b/tests/test-data/utilities.ts
@@ -97,7 +97,6 @@ export class TestData {
displayName: 'Testing Room',
type: RoomType.CHANNEL,
creator: TestData.getUser(),
- usernames: [TestData.getUser().username],
isDefault: true,
isReadOnly: false,
displaySystemMessages: true,