Skip to content
Snippets Groups Projects
Commit 0697a5b1 authored by Jared Hancock's avatar Jared Hancock
Browse files

oops: Fix installation of canned responses

parent 350bd6d2
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,9 @@ extends InstrumentedList {
$fileId = $file;
elseif (is_array($file) && isset($file['id']))
$fileId = $file['id'];
elseif ($F = AttachmentFile::upload($file))
elseif (isset($file['tmp_name']) && ($F = AttachmentFile::upload($file)))
$fileId = $F->getId();
elseif ($F = AttachmentFile::create($file))
$fileId = $F->getId();
else
continue;
......
......@@ -142,10 +142,10 @@ class Internationalization {
if (($tpl = $this->getTemplate('templates/premade.yaml'))
&& ($canned = $tpl->getData())) {
foreach ($canned as $c) {
if (($premade = Canned::create($c))
&& isset($c['attachments'])) {
if (!($premade = Canned::create($c)) || !$premade->save())
continue;
if (isset($c['attachments'])) {
$premade->attachments->upload($c['attachments']);
$premade->save();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment