Only show number of attachments if > 1
This commit is contained in:
parent
8c2473a227
commit
bd70caace8
|
@ -207,14 +207,12 @@ class NoticeListItem extends Widget
|
||||||
return 'shownotice' !== $this->out->args['action'];
|
return 'shownotice' !== $this->out->args['action'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachmentCount() {
|
function attachmentCount($discriminant = true) {
|
||||||
$f2p = new File_to_post;
|
$file_oembed = new File_oembed;
|
||||||
$f2p->post_id = $this->notice->id;
|
$query = "select count(*) as c from file_oembed join file_to_post on file_oembed.file_id = file_to_post.file_id where post_id=" . $this->notice->id;
|
||||||
$file = new File;
|
$file_oembed->query($query);
|
||||||
$file->joinAdd($f2p);
|
$file_oembed->fetch();
|
||||||
$file->selectAdd();
|
return intval($file_oembed->c);
|
||||||
$file->selectAdd('file.id as id');
|
|
||||||
return $file->find(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNoticeAttachmentsIcon()
|
function showNoticeAttachmentsIcon()
|
||||||
|
@ -224,7 +222,6 @@ class NoticeListItem extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
$href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments';
|
$href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments';
|
||||||
|
|
||||||
$this->out->elementStart('p', 'entry-attachments');
|
$this->out->elementStart('p', 'entry-attachments');
|
||||||
$this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count);
|
$this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count);
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user