This commit is contained in:
Half-Shot 2024-04-16 22:35:29 +01:00
parent f2d97af122
commit 1b27b4b3a3
3 changed files with 34 additions and 14 deletions

View File

@ -229,10 +229,12 @@ pub async fn js_read_feed(url: String, options: ReadFeedOptions) -> Result<FeedR
.map(|v| v.to_string()),
}),
Err(err) => Err(err),
}
false => Err(JsError::new(Status::Unknown, "Feed exceeded maximum size"))
}
},
false => {
Err(JsError::new(Status::Unknown, "Feed exceeded maximum size"))
}
}
}
Err(err) => Err(JsError::new(Status::Unknown, err)),
},
StatusCode::NOT_MODIFIED => Ok(FeedResult {

View File

@ -40,7 +40,7 @@ describe("IntentUtils", () => {
expect(hasInvited).to.be.true;
});
it("invites the user to the room and joins", () => {
it("should fail if the bot was not invited to the room", () => {
const targetIntent = IntentMock.create(SENDER_USER_ID);
const matrixClient = MatrixClientMock.create();

View File

@ -118,9 +118,8 @@ describe("Config/BridgePermissions", () => {
)
).to.be.false;
});
const checkActorValues = ["@foo:bar", "bar", "*"];
checkActorValues.forEach(actor => {
it(`will return true for a service defintion of '${actor}' that has a sufficent level`, () => {
it(`will check that a userId actor has a sufficent level`, () => {
const bridgePermissions = genBridgePermissions("@foo:bar", "fake-service", "commands");
expect(
bridgePermissions.checkActionAny(
@ -129,6 +128,25 @@ describe("Config/BridgePermissions", () => {
)
).to.be.true;
});
it(`will check that a homeserver actor has a sufficent level`, () => {
const bridgePermissions = genBridgePermissions("bar", "fake-service", "commands");
expect(
bridgePermissions.checkActionAny(
"@foo:bar",
"commands"
)
).to.be.true;
});
it(`will check that a wildcard actor has a sufficent level`, () => {
const bridgePermissions = genBridgePermissions("*", "fake-service", "commands");
expect(
bridgePermissions.checkActionAny(
"@foo:bar",
"commands"
)
).to.be.true;
});
})
})