Commit 4f218788 authored by Robert Lyon's avatar Robert Lyon

Bug 1826766: Only show 'uploaded by' if the viewer is not owner

behatnotneeded

Change-Id: I299b411bd3d5368ce11997bc6390a04ddc121279
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 29b323a2
......@@ -347,7 +347,12 @@ var FileBrowser = (function($) {
}
}
$('#' + self.id + '_edit_messages').empty();
$('#' + self.id + '_edit_uploadedby').text(self.filedata[id].uploadedby);
if (self.filedata[id].uploadedby) {
$('#' + self.id + '_edit_uploadedby').text(self.filedata[id].uploadedby);
}
else {
$('#' + self.id + '_edit_uploadedby').parent().hide();
}
$('#' + self.id + '_edit_row input.permission').each(function () {
var perm = $(this).prop('name').split(':');
if (self.filedata[id].permissions[perm[1]] && self.filedata[id].permissions[perm[1]][perm[2]] == 1) {
......
......@@ -692,9 +692,11 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
if ($group && $item->author == $USER->get('id')) {
$item->can_edit = 1; // This will show the delete, edit buttons in filelist, but doesn't change the actual permissions in the checkbox
}
$userobj = new User();
$userobj->find_by_id($item->author);
$item->uploadedby = display_name($userobj, null, true);
if ($group || $institution || ($USER->get('id') != $item->author)) {
$userobj = new User();
$userobj->find_by_id($item->author);
$item->uploadedby = display_name($userobj, null, true);
}
}
if ($item->artefacttype == 'folder') {
if ($item->childcount > 0 && defined('FOLDER_SIZE')) {
......@@ -1385,7 +1387,8 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
$filetype = $this->get('oldextension') . ' ' . get_string('file', 'artefact.file');
}
if (!empty($this->author)) {
$uploadedby = null;
if ($this->group || $this->institution || ($USER->get('id') != $this->author)) {
$uploader = new User();
$uploader->find_by_id($this->author);
$uploadedby = display_name($uploader, null, true);
......
......@@ -31,10 +31,12 @@
<td>{$ownername}</td>
</tr>
{/if}
{if $uploadedby}
<tr>
<th>{str tag=uploadedby section=artefact.file}:</th>
<td>{$uploadedby}</td>
</tr>
{/if}
<tr>
<th>{str tag=Created section=artefact.file}:</th>
<td>{$created}</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment