Skip to content

Commit

Permalink
Remove PentaDb, PentaBackend, CachingBackend, FDMCommand (#237)
Browse files Browse the repository at this point in the history
* Remove FDMCommand as it is totally dependent upon PentaDb

(We also didn't use it for the past 2 years)

* Remove PentaDb, PentaBackend, CachingBackend

* Comment about why we use PentaXML
  • Loading branch information
reivilibre authored Dec 16, 2024
1 parent 60b0cde commit a7583ca
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 1,179 deletions.
82 changes: 0 additions & 82 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,88 +175,6 @@ conference:
# Should never be less than 5 minutes.
lookaheadMinutes: 5

# Connection information to get data about the conference during the conference.
# This can be readonly. Currently the bot only supports postgresql.
# Should be specified as null if not using Pentabarf.
database: null
#database:
#host: "localhost"
#port: 5432
#username: "db_username"
#password: "db_password"
#database: "your_db"
#sslmode: "require"

## The table/view for the bot to access for information about people involved in the conference.
## Must at least have the following columns:
## event_id - TEXT(like) - The penta ID for the talk (event) associated with
## the person, if relevant. Null if a coordinator.
## person_id - TEXT(like) - The penta ID for the person.
## event_role - TEXT(like) - One of [speaker, coordinator, host]. See roles later on.
## name - TEXT(like) - The full name, or otherwise useful name, for the person.
## email - TEXT(like) - The preferred email address for the person.
## matrix_id - TEXT(like) - If known, the Matrix User ID for the person, otherwise null.
## conference_room - TEXT(like) - The relevant room. This should match the event_id or be
## the room where coordinators are assigned.
##
## People may be assigned multiple roles with multiple rows.
##
## Roles:
## speaker - A speaker for event_id. This person will get moderator in their talk's
## room, and invited to the auditorium backstage room. They will be required
## to check in before their talk starts.
##
## host - Someone who is moderating the talk itself in collaboration with the speakers
## for the event_id. One host must check in before the talk starts, otherwise
## the issue will be raised to the management room and coordinators will be
## asked to take over. Hosts will get moderator in their talk's room, and be
## invited to the public auditorium room, backstage room, and talk room.
##
## coordinator - These are typically people responsible for scheduling the auditorium's
## talks. They'll get moderator in the auditorium room, backstage room, and all
## talk rooms for their auditorium, though will only be invited to the auditorium
## and backstage room (and the talk rooms on-demand if needed to fill in for a
## missing host).
##
## The bot will ignore unknown events, rooms, and roles.
##
## CAUTION: Although the bot uses parameterized queries, it is unable to use the table name as
## a parameter. As such, this particular config value is vulnerable to SQL injection. Seeing as
## how you (the bot's admin) are the one entering it: don't do that to yourself.
#tblPeople: "view_matrix_bot_export_people"

## The table/view for the bot to access for information about the conference schedule.
## Must at least have the following columns:
## event_id - TEXT(like) - The penta ID for the talk (event).
## conference_room - TEXT(like) - The relevant room. This should match the event_id.
## start_datetime - TIMESTAMP WITHOUT TIME ZONE - The start time of the talk. The timezone
## is determined by the bot using the timezone elsewhere in this config.
## duration - INTERVAL - How long the talk is meant to last (start to end).
## presentation_length - INTERVAL - The portion of `duration` where the speaker is presenting.
## The remainder is assumed to be Q&A.
## prerecorded - BOOLEAN - True if the presentation is prerecorded. When false, the
## bot will assume that presentation_length is zero and switch
## directly into "hallway" mode at start_datetime.
##
## The bot will ignore unknown talks. Any if the start_datetime is NULL then the bot will ignore
## that record. If the INTERVAL fields are NULL, the bot will assume zero.
##
## Note: the bot is capable of running both tblSchedule and tblPeople off the same table/view.
## It will use DISTINCT where it needs to in order to get accurate information.
##
## CAUTION: Although the bot uses parameterized queries, it is unable to use the table name as
## a parameter. As such, this particular config value is vulnerable to SQL injection. Seeing as
## how you (the bot's admin) are the one entering it: don't do that to yourself.
#tblSchedule: "view_matrix_bot_export_schedule"

## The duration in seconds added to the `presentation_length` to account for preroll material
## such as sponsor segments. If this is built into the table already then set this to zero.
#schedulePreBufferSeconds: 30

## The duration in seconds added to the talk `duration` to account for postroll material
## such as sponsor segments. If this is built into the table already then set this to zero.
#schedulePostBufferSeconds: 30

# Various prefixes used by the bot when parsing information.
prefixes:
# The prefixes for the rooms listed in the pentabarf definition which
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"matrix-widget-api": "^1.6.0",
"moment": "^2.29.4",
"node-fetch": "^2.6.1",
"pg": "^8.9.0",
"postcss-preset-env": "^6.7.0",
"prom-client": "^15.0.0",
"qs": "^6.11.2",
Expand All @@ -47,7 +46,6 @@
"devDependencies": {
"@types/jest": "^29.2.5",
"@types/node": "^18",
"@types/pg": "^7.14.7",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"homerunner-client": "^0.0.6",
Expand Down
1 change: 0 additions & 1 deletion spec/util/e2e-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export class E2ETestEnv {
},
schedule: {
backend: 'json',
database: undefined,
scheduleDefinition,
},
subspaces: {
Expand Down
41 changes: 9 additions & 32 deletions src/Conference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ import { MatrixRoom } from "./models/MatrixRoom";
import { Auditorium, AuditoriumBackstage } from "./models/Auditorium";
import { Talk } from "./models/Talk";
import { ResolvedPersonIdentifier, resolveIdentifiers } from "./invites";
import { PentaDb } from "./backends/penta/db/PentaDb";
import { PermissionsCommand } from "./commands/PermissionsCommand";
import { InterestRoom } from "./models/InterestRoom";
import { IStateEvent } from "./models/room_state";
import { logMessage } from "./LogProxy";
import { IScheduleBackend } from "./backends/IScheduleBackend";
import { PentaBackend } from "./backends/penta/PentaBackend";
import { setUnion } from "./utils/sets";
import { ConferenceMatrixClient } from "./ConferenceMatrixClient";
import { Gauge } from "prom-client";
Expand All @@ -66,8 +64,6 @@ const attendeeTotalGauge = new Gauge({ name: "confbot_attendee_total", help: "Th
export class Conference {
private rootSpace: Space | null;
private dbRoom: MatrixRoom | null;
// TODO This shouldn't be here.
private pentaDb: PentaDb | null = null;
private subspaces: {
[subspaceId: string]: Space
} = {};
Expand Down Expand Up @@ -206,11 +202,6 @@ export class Conference {
public async construct() {
this.reset();

if (this.backend instanceof PentaBackend) {
// TODO this is not nice.
this.pentaDb = this.backend.db;
}

// Locate all the rooms for the conference
const roomIds = await this.client.getJoinedRooms();
const batchSize = 20;
Expand Down Expand Up @@ -357,12 +348,6 @@ export class Conference {
}
}

public async getPentaDb(): Promise<PentaDb | null> {
if (this.pentaDb === null) return null;
await this.pentaDb.connect();
return this.pentaDb;
}

public async getSpace(): Promise<Space | null> {
return this.rootSpace;
}
Expand Down Expand Up @@ -728,22 +713,17 @@ export class Conference {
return people;
}

/**
* @deprecated Just use `.getSpeakers()`
*/
public async getPeopleForTalk(talk: Talk): Promise<IPerson[]> {
const db = await this.getPentaDb();
if (db !== null) {
return await this.resolvePeople(await db.findAllPeopleForTalk(await talk.getId()));
}

return talk.getSpeakers();
}

/**
* @deprecated This always returns `[]`.
*/
public async getPeopleForInterest(int: InterestRoom): Promise<IPerson[]> {
const db = await this.getPentaDb();
if (db !== null) {
// Yes, an interest room is an auditorium to Penta.
return await this.resolvePeople(await db.findAllPeopleForAuditorium(await int.getId()));
}

return [];
}

Expand Down Expand Up @@ -889,13 +869,10 @@ export class Conference {
return this.getUpcomingTalksByLambda(talk => talk.endTime, inNextMinutes, minBefore);
}

/**
* @deprecated This always returns `[]` and should be removed or fixed.
*/
public async findPeopleWithId(personId: string): Promise<IPerson[]> {
// TODO
const db = await this.getPentaDb();
if (db !== null) {
return await db.findPeopleWithId(personId);
}

return [];
}

Expand Down
106 changes: 0 additions & 106 deletions src/__tests__/backends/penta/CachingBackend.test.ts

This file was deleted.

72 changes: 0 additions & 72 deletions src/__tests__/backends/penta/PentaBackend.test.ts

This file was deleted.

Loading

0 comments on commit a7583ca

Please sign in to comment.