Skip to content

Commit ec4cb2e

Browse files
committed
Document remaining issues.
1 parent 818e4cf commit ec4cb2e

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/appservice/Api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class Api {
8787
}
8888

8989
// TODO: getMjolnir can fail if the ownerId doesn't match the requesting userId.
90+
// https://github.com/matrix-org/mjolnir/issues/408
9091
const mjolnir = this.mjolnirManager.getMjolnir(mjolnirId, userId);
9192
if (mjolnir === undefined) {
9293
response.status(400).send("unknown mjolnir mxid");
@@ -143,6 +144,7 @@ export class Api {
143144
}
144145

145146
// TODO: provisionNewMjolnir will throw if it fails...
147+
// https://github.com/matrix-org/mjolnir/issues/408
146148
const [mjolnirId, managementRoom] = await this.mjolnirManager.provisionNewMjolnir(userId);
147149

148150
response.status(200).json({ mxid: mjolnirId, roomId: managementRoom });
@@ -180,6 +182,7 @@ export class Api {
180182
}
181183

182184
// TODO: getMjolnir can fail if the ownerId doesn't match the requesting userId.
185+
// https://github.com/matrix-org/mjolnir/issues/408
183186
const mjolnir = this.mjolnirManager.getMjolnir(mjolnirId, userId);
184187
if (mjolnir === undefined) {
185188
response.status(400).send("unknown mjolnir mxid");

src/appservice/AppService.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ export class MjolnirAppService {
7474
// is it ok for this to be async? seems a bit dodge.
7575
// it should be BridgeRequestEvent not whatever this is
7676
public async onEvent(request: Request<WeakEvent>, context: BridgeContext) {
77-
// https://github.com/matrix-org/matrix-appservice-irc/blob/develop/src/bridge/MatrixHandler.ts#L921
78-
// ^ that's how matrix-appservice-irc maps from room to channel, we basically need to do the same but map
79-
// from room to which mjolnir it's for, unless that information is present in BridgeContext, which it might be...
80-
// How do we get that information in bridge context?
81-
// Alternatively we have to either use their advanced user member caching or track this ourselves somehow ffs.
82-
// Alternatively just don't care about it right now, let it push events through to them all and get
83-
// consultation from bridge people (Halfy).
8477
const mxEvent = request.getData();
8578
if ('m.room.member' === mxEvent.type) {
8679
if ('invite' === mxEvent.content['membership'] && mxEvent.state_key === this.bridge.botUserId) {

src/appservice/MjolnirManager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ export class MjolnirManager {
9393
public getOwnedMjolnirs(ownerId: string): ManagedMjolnir[] {
9494
// TODO we need to use the database for this but also provide the utility
9595
// for going from a MjolnirRecord to a ManagedMjolnir.
96+
// https://github.com/matrix-org/mjolnir/issues/409
9697
return [...this.mjolnirs.values()].filter(mjolnir => mjolnir.ownerId !== ownerId);
9798
}
9899

99100
public onEvent(request: Request<WeakEvent>, context: BridgeContext) {
100-
// We honestly don't know how we're going to map from bridge to user
101-
// https://github.com/matrix-org/matrix-appservice-bridge/blob/6046d31c54d461ad53e6d6e244ce2d944b62f890/src/components/room-bridge-store.ts
102-
// looks like it might work, but we will ask, figure it out later.
101+
// TODO We need a way to map a room id (that the event is from) to a set of managed mjolnirs that should be informed.
102+
// https://github.com/matrix-org/mjolnir/issues/412
103103
[...this.mjolnirs.values()].forEach((mj: ManagedMjolnir) => mj.onEvent(request));
104104
}
105105

@@ -152,6 +152,7 @@ export class MjolnirManager {
152152
}
153153

154154
// TODO: We need to check that an owner still has access to the appservice each time they send a command to the mjolnir or use the web api.
155+
// https://github.com/matrix-org/mjolnir/issues/410
155156
/**
156157
* Used at startup to create all the ManagedMjolnir instances and start them so that they will respond to users.
157158
*/
@@ -190,6 +191,7 @@ export class ManagedMjolnir {
190191
this.mjolnir.client.emit('room.message', mxEvent.room_id, mxEvent);
191192
}
192193
// TODO: We need to figure out how to inform the mjolnir of `room.join`.
194+
// https://github.com/matrix-org/mjolnir/issues/411
193195
}
194196
if (mxEvent['type'] === 'm.room.member') {
195197
if (mxEvent['content']['membership'] === 'invite' && mxEvent.state_key === await this.mjolnir.client.getUserId()) {

0 commit comments

Comments
 (0)