Link to attachment page instead of big-ass image

This commit is contained in:
Mikael Nordfeldth 2016-05-01 11:26:28 +02:00
parent e4f688fcfd
commit 7aa9a69c2f
3 changed files with 8 additions and 3 deletions

View File

@ -516,6 +516,11 @@ class File extends Managed_DataObject
return $filepath;
}
public function getAttachmentUrl()
{
return common_local_url('attachment', array('attachment'=>$this->getID()));
}
public function getUrl($prefer_local=true)
{
if ($prefer_local && !empty($this->filename)) {

View File

@ -491,7 +491,7 @@ class ActivityObject
$object->type = self::mimeTypeToObjectType($file->mimetype);
$object->id = TagURI::mint(sprintf("file:%d", $file->id));
$object->link = common_local_url('attachment', array('attachment' => $file->id));
$object->link = $file->getAttachmentUrl();
if ($file->title) {
$object->title = $file->title;

View File

@ -87,8 +87,8 @@ class AttachmentListItem extends Widget
function linkAttr() {
return array('class' => 'attachment',
'href' => $this->attachment->getUrl(false),
'id' => 'attachment-' . $this->attachment->id,
'href' => $this->attachment->getAttachmentUrl(),
'id' => 'attachment-' . $this->attachment->getID(),
'title' => $this->linkTitle());
}