mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-09 20:58:12 +08:00
fix(lint): fix linter issues in template store
This commit is contained in:
parent
9726618069
commit
ef8759dd62
1 changed files with 8 additions and 8 deletions
|
@ -109,7 +109,7 @@ class TemplateStore extends NylasStore {
|
|||
let draftContents = contents ? contents : QuotedHTMLTransformer.removeQuotedHTML(draft.body);
|
||||
|
||||
const sigIndex = draftContents.indexOf('<div class="nylas-n1-signature">');
|
||||
draftContents = sigIndex>-1 ? draftContents.slice(0,sigIndex) : draftContents;
|
||||
draftContents = sigIndex > -1 ? draftContents.slice(0, sigIndex) : draftContents;
|
||||
if (!draftName || draftName.length === 0) {
|
||||
this._displayError('Give your draft a subject to name your template.');
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class TemplateStore extends NylasStore {
|
|||
}
|
||||
|
||||
saveNewTemplate(name, contents, callback) {
|
||||
if(!name || name.length===0){
|
||||
if (!name || name.length === 0) {
|
||||
this._displayError('You must provide a template name.');
|
||||
return;
|
||||
}
|
||||
|
@ -227,12 +227,12 @@ class TemplateStore extends NylasStore {
|
|||
this._displayError('Invalid template name! Names can only contain letters, numbers, spaces, dashes, and underscores.');
|
||||
return;
|
||||
}
|
||||
if(newName.length===0){
|
||||
if (newName.length === 0) {
|
||||
this._displayError('You must provide a template name.');
|
||||
return;
|
||||
}
|
||||
|
||||
const newFilename = `${newName}.html`;
|
||||
const newFilename = `${newName}.html`;
|
||||
const oldPath = path.join(this._templatesDir, `${oldName}.html`);
|
||||
const newPath = path.join(this._templatesDir, newFilename);
|
||||
fs.rename(oldPath, newPath, () => {
|
||||
|
@ -245,7 +245,7 @@ class TemplateStore extends NylasStore {
|
|||
}
|
||||
|
||||
_onInsertTemplateId({templateId, draftClientId} = {}) {
|
||||
this.getTemplateContents(templateId, (template_body) => {
|
||||
this.getTemplateContents(templateId, (templateBody) => {
|
||||
DraftStore.sessionForClientId(draftClientId).then((session)=> {
|
||||
let proceed = true;
|
||||
if (!session.draft().pristine) {
|
||||
|
@ -258,11 +258,11 @@ class TemplateStore extends NylasStore {
|
|||
}
|
||||
|
||||
if (proceed) {
|
||||
let draftContents = QuotedHTMLTransformer.removeQuotedHTML(session.draft().body);
|
||||
const draftContents = QuotedHTMLTransformer.removeQuotedHTML(session.draft().body);
|
||||
const sigIndex = draftContents.indexOf('<div class="nylas-n1-signature">');
|
||||
const signature = sigIndex>-1 ? draftContents.slice(sigIndex) : "";
|
||||
const signature = sigIndex > -1 ? draftContents.slice(sigIndex) : '';
|
||||
|
||||
const draftHtml = QuotedHTMLTransformer.appendQuotedHTML(template_body+signature, session.draft().body);
|
||||
const draftHtml = QuotedHTMLTransformer.appendQuotedHTML(templateBody + signature, session.draft().body);
|
||||
session.changes.add({body: draftHtml});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue