forked from GNUsocial/gnu-social
[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:
committed by
Diogo Cordeiro
parent
3c9a07677e
commit
c7475d78b4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user