forked from GNUsocial/gnu-social
[CORE][UI] Made attachment actions and its subactions be able to identify attachments by id and by filehash. Changed the url stored in the DB to be attachment//view
This commit is contained in:
parent
9536f2a909
commit
aa5c6bbf08
@ -1,4 +1,4 @@
|
|||||||
# GNU social 1.24.x
|
# GNU social 1.25.x
|
||||||
(c) 2010-2019 Free Software Foundation, Inc
|
(c) 2010-2019 Free Software Foundation, Inc
|
||||||
|
|
||||||
This is the README file for GNU social, the free
|
This is the README file for GNU social, the free
|
||||||
|
@ -59,8 +59,10 @@ class AttachmentAction extends ManagedAction
|
|||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if ($id = $this->trimmed('attachment')) {
|
if (!empty($id = $this->trimmed('attachment'))) {
|
||||||
$this->attachment = File::getKV($id);
|
$this->attachment = File::getKV($id);
|
||||||
|
} elseif (!empty($filehash = $this->trimmed('filehash'))) {
|
||||||
|
$this->attachment = File::getByHash($filehash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->attachment instanceof File) {
|
if (!$this->attachment instanceof File) {
|
||||||
|
@ -614,7 +614,7 @@ class File extends Managed_DataObject
|
|||||||
if ($use_local !== false) {
|
if ($use_local !== false) {
|
||||||
if (is_string($this->filename) || !empty($this->filename)) {
|
if (is_string($this->filename) || !empty($this->filename)) {
|
||||||
// A locally stored file, so let's generate a URL for our instance.
|
// A locally stored file, so let's generate a URL for our instance.
|
||||||
return getAttachmentViewUrl();
|
return $this->getAttachmentViewUrl();
|
||||||
}
|
}
|
||||||
if ($use_local) {
|
if ($use_local) {
|
||||||
// if the file wasn't stored locally (has filename) and we require a local URL
|
// if the file wasn't stored locally (has filename) and we require a local URL
|
||||||
|
@ -32,7 +32,7 @@ defined('GNUSOCIAL') || die();
|
|||||||
define('GNUSOCIAL_ENGINE', 'GNU social');
|
define('GNUSOCIAL_ENGINE', 'GNU social');
|
||||||
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
|
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
|
||||||
|
|
||||||
define('GNUSOCIAL_BASE_VERSION', '1.24.1');
|
define('GNUSOCIAL_BASE_VERSION', '1.25.0');
|
||||||
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
||||||
|
|
||||||
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
||||||
|
@ -161,7 +161,7 @@ class MediaFile
|
|||||||
// Well, let's just continue below.
|
// Well, let's just continue below.
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileurl = File::url($this->filename);
|
$fileurl = common_local_url('attachment_view', array('filehash' => $this->filehash));
|
||||||
|
|
||||||
$file = new File;
|
$file = new File;
|
||||||
|
|
||||||
|
@ -219,21 +219,17 @@ class Router
|
|||||||
array('q' => '.+'));
|
array('q' => '.+'));
|
||||||
$m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
|
$m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
|
||||||
|
|
||||||
$m->connect('attachment/:attachment',
|
foreach (['' => 'attachment',
|
||||||
array('action' => 'attachment'),
|
'/view' => 'attachment_view',
|
||||||
array('attachment' => '[0-9]+'));
|
'/download' => 'attachment_download',
|
||||||
|
'/thumbnail' => 'attachment_thumbnail'] as $postfix => $action) {
|
||||||
$m->connect('attachment/:attachment/view',
|
foreach (['attachment' => '[0-9]+',
|
||||||
array('action' => 'attachment_view'),
|
'filehash' => '[A-Za-z0-9._-]+'] as $type => $match) {
|
||||||
array('attachment' => '[0-9]+'));
|
$m->connect("attachment/:{$type}{$postfix}",
|
||||||
|
['action' => $action],
|
||||||
$m->connect('attachment/:attachment/download',
|
[$type => $match]);
|
||||||
array('action' => 'attachment_download'),
|
}
|
||||||
array('attachment' => '[0-9]+'));
|
}
|
||||||
|
|
||||||
$m->connect('attachment/:attachment/thumbnail',
|
|
||||||
array('action' => 'attachment_thumbnail'),
|
|
||||||
array('attachment' => '[0-9]+'));
|
|
||||||
|
|
||||||
$m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto',
|
$m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto',
|
||||||
array('action' => 'newnotice'),
|
array('action' => 'newnotice'),
|
||||||
|
Loading…
Reference in New Issue
Block a user