Skip to content

Commit

Permalink
Fix initialise typo (#440)
Browse files Browse the repository at this point in the history
* Fix initalise typo

* changelog

* .
  • Loading branch information
Half-Shot authored Oct 5, 2022
1 parent 13f72ab commit cf45ad6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.d/440.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix typo'd function name `Bridge.initalise` -> `Bridge.initialise`.
2 changes: 1 addition & 1 deletion spec/integ/bridge.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ describe("Bridge", function() {

beforeEach(() => {
userIsRegistered = false;
return bridge.initalise();
return bridge.initialise();
});

afterAll(() => {
Expand Down
20 changes: 10 additions & 10 deletions src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,11 @@ export class Bridge {
}

/**
* Load registration, databases and initalise bridge components.
* Load registration, databases and initialise bridge components.
*
* **This must be called before `listen()`**
*/
public async initalise(): Promise<void> {
public async initialise(): Promise<void> {
if (typeof this.opts.registration === "string") {
const regObj = yaml.load(await fs.readFile(this.opts.registration, 'utf8'));
if (typeof regObj !== "object") {
Expand Down Expand Up @@ -713,7 +713,7 @@ export class Bridge {

/**
* Setup a HTTP listener to handle appservice traffic.
* ** This must be called after .initalise() **
* ** This must be called after .initialise() **
* @param port The port to listen on.
* @param appServiceInstance The AppService instance to attach to.
* If not provided, one will be created.
Expand All @@ -722,7 +722,7 @@ export class Bridge {
public async listen(
port: number, hostname = "0.0.0.0", backlog = 10, appServiceInstance?: AppService): Promise<void> {
if (!this.registration) {
throw Error('initalise() not called, cannot listen');
throw Error('initialise() not called, cannot listen');
}

const homeserverToken = this.registration.getHomeserverToken();
Expand Down Expand Up @@ -761,15 +761,15 @@ export class Bridge {
}

/**
* Run the bridge (start listening). This calls `initalise()` and `listen()`.
* Run the bridge (start listening). This calls `initialise()` and `listen()`.
* @param port The port to listen on.
* @param appServiceInstance The AppService instance to attach to.
* If not provided, one will be created.
* @param hostname Optional hostname to bind to.
* @return A promise resolving when the bridge is ready.
*/
public async run(port: number, appServiceInstance?: AppService, hostname = "0.0.0.0", backlog = 10): Promise<void> {
await this.initalise();
await this.initialise();
await this.listen(port, hostname, backlog, appServiceInstance);
}

Expand Down Expand Up @@ -1065,19 +1065,19 @@ export class Bridge {
*/
public getIntent(userId?: string, request?: Request<unknown>): Intent|EncryptedIntent {
if (!this.appServiceBot || !this.botSdkAS) {
throw Error('Cannot call getIntent before calling .initalise()');
throw Error('Cannot call getIntent before calling .initialise()');
}
if (!userId) {
if (!this.botIntent) {
// This will be defined when .run is called.
throw Error('Cannot call getIntent before calling .initalise()');
throw Error('Cannot call getIntent before calling .initialise()');
}
return this.botIntent;
}
else if (userId === this.botUserId) {
if (!this.botIntent) {
// This will be defined when .run is called.
throw Error('Cannot call getIntent before calling .initalise()');
throw Error('Cannot call getIntent before calling .initialise()');
}
return this.botIntent;
}
Expand Down Expand Up @@ -1528,7 +1528,7 @@ export class Bridge {

if (this.botSdkAS) {
metrics.registerMatrixSdkMetrics(this.botSdkAS);
} // Else, we will set this up in initalise()
} // Else, we will set this up in initialise()
if (registerEndpoint && this.appservice) {
metrics.addAppServicePath(this);
} // Else, we will add the path in listen()
Expand Down

0 comments on commit cf45ad6

Please sign in to comment.