From: Mikael Nordfeldth Date: Sun, 1 May 2016 09:26:28 +0000 (+0200) Subject: Link to attachment page instead of big-ass image X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7aa9a69c2fcccc79ace8cdffa4765fec1ece5d77;p=quix0rs-gnu-social.git Link to attachment page instead of big-ass image --- diff --git a/classes/File.php b/classes/File.php index 9643b78f18..46d4d5498d 100644 --- a/classes/File.php +++ b/classes/File.php @@ -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)) { diff --git a/lib/activityobject.php b/lib/activityobject.php index 87eea13727..ca6390b725 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -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; diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php index 6ee3c7087b..dc22c8af29 100644 --- a/lib/attachmentlistitem.php +++ b/lib/attachmentlistitem.php @@ -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()); }