Revoked share links (#664)

* Move to revokation API for share links

* Respect revoked share links
Add documentation for shares endpoints

* 💚
This commit is contained in:
Tom Moor
2018-06-16 12:36:25 -07:00
committed by GitHub
parent fad5976dd2
commit ae502c10c9
10 changed files with 190 additions and 20 deletions

View File

@ -36,7 +36,7 @@ describe('#documents.info', async () => {
expect(body.data.id).toEqual(document.id);
});
it('should return redacted documents from shareId without token', async () => {
it('should return redacted document from shareId without token', async () => {
const { document } = await seed();
const share = await buildShare({
documentId: document.id,
@ -55,6 +55,20 @@ describe('#documents.info', async () => {
expect(body.data.updatedBy).toEqual(undefined);
});
it('should not return document from revoked shareId', async () => {
const { document, user } = await seed();
const share = await buildShare({
documentId: document.id,
teamId: document.teamId,
});
await share.revoke(user.id);
const res = await server.post('/api/documents.info', {
body: { shareId: share.id },
});
expect(res.status).toEqual(400);
});
it('should return documents from shareId with token', async () => {
const { user, document, collection } = await seed();
const share = await buildShare({