[CORE][UI][ROUTER] Added view action, which inlines images and videos but downloads everything else. Fixed File url to get an URL fromthe view action, so when a making a remote notice, the correct URL is used, not accessing directly to the file

This commit is contained in:
Miguel Dantas
2019-06-26 01:54:55 +01:00
committed by Diogo Cordeiro
parent 3c9a07677e
commit c7475d78b4
5 changed files with 64 additions and 3 deletions

View File

@@ -599,6 +599,11 @@ class File extends Managed_DataObject
return common_local_url('attachment_download', array('attachment'=>$this->getID()));
}
public function getAttachmentViewUrl()
{
return common_local_url('attachment_view', array('attachment'=>$this->getID()));
}
/**
* @param mixed $use_local true means require local, null means prefer local, false means use whatever is stored
* @return string
@@ -609,7 +614,7 @@ class File extends Managed_DataObject
if ($use_local !== false) {
if (is_string($this->filename) || !empty($this->filename)) {
// A locally stored file, so let's generate a URL for our instance.
return self::url($this->getFilename());
return getAttachmentViewUrl();
}
if ($use_local) {
// if the file wasn't stored locally (has filename) and we require a local URL