Skip to content
Snippets Groups Projects
Commit a92a3f8b authored by JediKev's avatar JediKev
Browse files

issue: FAQ/Page Attachments

This addresses an issue where inserting images on a Page or FAQ and having
the setting enabled for "Login required to view attachments." does not
display the images at all when the Page/FAQ renders in view. This is due to
the Page/FAQ update functions that were not updated to fit the new
`id=>name` format for `keepOnlyFileIds()` introduced with `f179cf15`.
parent d015f4b4
No related branches found
No related tags found
No related merge requests found
...@@ -405,7 +405,7 @@ class FAQ extends VerySimpleModel { ...@@ -405,7 +405,7 @@ class FAQ extends VerySimpleModel {
} }
$images = Draft::getAttachmentIds($vars['answer']); $images = Draft::getAttachmentIds($vars['answer']);
$images = array_map(function($i) { return $i['id']; }, $images); $images = array_flip(array_map(function($i) { return $i['id']; }, $images));
$this->getAttachments()->keepOnlyFileIds($images, true); $this->getAttachments()->keepOnlyFileIds($images, true);
// Handle language-specific attachments // Handle language-specific attachments
......
...@@ -282,7 +282,7 @@ class Page extends VerySimpleModel { ...@@ -282,7 +282,7 @@ class Page extends VerySimpleModel {
// Attach inline attachments from the editor // Attach inline attachments from the editor
$keepers = Draft::getAttachmentIds($vars['body']); $keepers = Draft::getAttachmentIds($vars['body']);
$keepers = array_map(function($i) { return $i['id']; }, $keepers); $keepers = array_flip(array_map(function($i) { return $i['id']; }, $keepers));
$this->attachments->keepOnlyFileIds($keepers, true); $this->attachments->keepOnlyFileIds($keepers, true);
if ($rv) if ($rv)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment