Move title validation to server (#552)

closes issue-546
This commit is contained in:
Tom Moor
2018-01-31 19:23:33 -08:00
committed by Jori Lallo
parent c24ef20a24
commit ae4aed6fe0
4 changed files with 54 additions and 17 deletions

View File

@ -11,8 +11,6 @@ import type { User } from 'types';
import BaseModel from './BaseModel';
import Collection from './Collection';
const DEFAULT_TITLE = 'Untitled document';
class Document extends BaseModel {
isSaving: boolean = false;
hasPendingChanges: boolean = false;
@ -172,14 +170,6 @@ class Document extends BaseModel {
lastRevision: this.revision,
});
} else {
if (!this.title) {
this.title = DEFAULT_TITLE;
this.text = this.text.replace(
new RegExp(`^# `),
`# ${DEFAULT_TITLE}`
);
}
const data = {
parentDocument: undefined,
collection: this.collection.id,