Merge pull request #2695 from nextcloud/remove-leading-slashes-on-share-activity
Remove leading slash from sharing activity
This commit is contained in:
commit
6fd421cc3c
|
@ -206,7 +206,7 @@ class Provider implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,10 +142,11 @@ class FavoriteProvider implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $event->getObjectId(),
|
'id' => $event->getObjectId(),
|
||||||
'name' => basename($event->getObjectName()),
|
'name' => basename($event->getObjectName()),
|
||||||
'path' => $event->getObjectName(),
|
'path' => trim($event->getObjectName(), '/'),
|
||||||
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $event->getObjectId()]),
|
||||||
];
|
];
|
||||||
|
|
||||||
$event->setParsedSubject(str_replace('{file}', trim($parameter['path'], '/'), $subject))
|
$event->setParsedSubject(str_replace('{file}', $parameter['path'], $subject))
|
||||||
->setRichSubject($subject, ['file' => $parameter]);
|
->setRichSubject($subject, ['file' => $parameter]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ class Provider implements IProvider {
|
||||||
foreach ($parameters as $placeholder => $parameter) {
|
foreach ($parameters as $placeholder => $parameter) {
|
||||||
$placeholders[] = '{' . $placeholder . '}';
|
$placeholders[] = '{' . $placeholder . '}';
|
||||||
if ($parameter['type'] === 'file') {
|
if ($parameter['type'] === 'file') {
|
||||||
$replacements[] = trim($parameter['path'], '/');
|
$replacements[] = $parameter['path'];
|
||||||
} else {
|
} else {
|
||||||
$replacements[] = $parameter['name'];
|
$replacements[] = $parameter['name'];
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,8 @@ class Provider implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ class Downloads implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Groups implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ class PublicLinks implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ class Users implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ class Activity implements IProvider {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => basename($path),
|
'name' => basename($path),
|
||||||
'path' => $path,
|
'path' => trim($path, '/'),
|
||||||
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class Definitions {
|
||||||
'path' => [
|
'path' => [
|
||||||
'since' => '11.0.0',
|
'since' => '11.0.0',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'description' => 'The full path of the file for the user',
|
'description' => 'The full path of the file for the user, should not start with a slash',
|
||||||
'example' => 'path/to/file.txt',
|
'example' => 'path/to/file.txt',
|
||||||
],
|
],
|
||||||
'link' => [
|
'link' => [
|
||||||
|
|
Loading…
Reference in New Issue