@ -64,6 +64,7 @@ router.post('shares.create', auth(), async ctx => {
|
|||||||
documentId,
|
documentId,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
|
revokedAt: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -88,6 +88,24 @@ describe('#shares.create', async () => {
|
|||||||
expect(body.data.documentTitle).toBe(document.title);
|
expect(body.data.documentTitle).toBe(document.title);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow creating a share record if link previously revoked', async () => {
|
||||||
|
const { user, document } = await seed();
|
||||||
|
const share = await buildShare({
|
||||||
|
documentId: document.id,
|
||||||
|
teamId: user.teamId,
|
||||||
|
userId: user.id,
|
||||||
|
});
|
||||||
|
await share.revoke();
|
||||||
|
const res = await server.post('/api/shares.create', {
|
||||||
|
body: { token: user.getJwtToken(), documentId: document.id },
|
||||||
|
});
|
||||||
|
const body = await res.json();
|
||||||
|
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
expect(body.data.id).not.toEqual(share.id);
|
||||||
|
expect(body.data.documentTitle).toBe(document.title);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return existing share link for document and user', async () => {
|
it('should return existing share link for document and user', async () => {
|
||||||
const { user, document } = await seed();
|
const { user, document } = await seed();
|
||||||
const share = await buildShare({
|
const share = await buildShare({
|
||||||
|
Reference in New Issue
Block a user