feat: Sharing improvements (#1388)

* add migrations

* first pass at API

* feat: Updated share dialog UI

* tests

* test

* styling tweaks

* feat: Show share state on document

* fix: Allow publishing share links for draft docs

* test: shares.info
This commit is contained in:
Tom Moor
2020-07-28 19:14:32 -07:00
committed by GitHub
parent 0b33b5bc05
commit 169ad5b025
28 changed files with 514 additions and 77 deletions

View File

@@ -41,7 +41,6 @@ export default class Document extends BaseModel {
deletedAt: ?string;
url: string;
urlId: string;
shareUrl: ?string;
revision: number;
get emoji() {
@@ -90,10 +89,7 @@ export default class Document extends BaseModel {
@action
share = async () => {
const res = await client.post("/shares.create", { documentId: this.id });
invariant(res && res.data, "Share data should be available");
this.shareUrl = res.data.url;
return this.shareUrl;
return this.store.rootStore.shares.create({ documentId: this.id });
};
@action

View File

@@ -17,6 +17,7 @@ class Event extends BaseModel {
name: string,
email: string,
title: string,
published: boolean,
};
get model() {

View File

@@ -5,6 +5,8 @@ import User from "./User";
class Share extends BaseModel {
id: string;
url: string;
published: boolean;
documentId: string;
documentTitle: string;
documentUrl: string;
createdBy: User;