Skip to content
Snippets Groups Projects
Commit 9cdece4d authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1440916: Allow parent post to display attachements when editing post


behatnotneeded

Change-Id: If1e4aada3bc5fe747e1024dbb6b5d46367df946e
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 415c8143
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,21 @@ $parent = get_record_sql(
array(0, $parentid)
);
if ($parent) {
$parent->filecount = 0;
if ($parent->attachments = get_records_sql_array("
SELECT a.*, aff.size, aff.fileid, pa.post
FROM {artefact} a
JOIN {interaction_forum_post_attachment} pa ON pa.attachment = a.id
LEFT JOIN {artefact_file_files} aff ON aff.artefact = a.id
WHERE pa.post = ?", array($parentid))) {
$parent->filecount = count($parent->attachments);
safe_require('artefact', 'file');
foreach ($parent->attachments as $file) {
$file->icon = call_static_method(generate_artefact_class_name($file->artefacttype), 'get_icon', array('id' => $file->id, 'post' => $parentid));
}
}
}
define('GROUP', $parent->group);
$membership = user_can_access_forum((int)$parent->forum);
......
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