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:
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@ class Event extends BaseModel {
|
||||
name: string,
|
||||
email: string,
|
||||
title: string,
|
||||
published: boolean,
|
||||
};
|
||||
|
||||
get model() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user