diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-03-04 13:14:52 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-03-04 16:04:30 +0000 |
commit | 5e2a9de3f07126e65a58bf7b285d5900acd99fec (patch) | |
tree | 11c9ce8e2ba8302e84fea09773aa348909693dff /apps/files/lib | |
parent | 4df7cf1f54bdc10fe7dce11f396ab3a568977e47 (diff) | |
download | nextcloud-server-5e2a9de3f07126e65a58bf7b285d5900acd99fec.tar.gz nextcloud-server-5e2a9de3f07126e65a58bf7b285d5900acd99fec.zip |
Activity: show if files are hidden or not
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/Activity/Provider.php | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 2f6e406978a..f50d9d6a42a 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -230,10 +230,42 @@ class Provider implements IProvider { $subject = $this->l->t('{user} restored {file}'); $this->setIcon($event, 'actions/history', 'core'); } elseif ($event->getSubject() === 'renamed_self') { - $subject = $this->l->t('You renamed {oldfile} to {newfile}'); + $oldFileName = $parsedParameters['oldfile']['name']; + $newFileName = $parsedParameters['newfile']['name']; + + if ($this->isHiddenFile($oldFileName)) { + if ($this->isHiddenFile($newFileName)) { + $subject = $this->l->t('You renamed {oldfile} (hidden) to {newfile} (hidden)'); + } else { + $subject = $this->l->t('You renamed {oldfile} (hidden) to {newfile}'); + } + } else { + if ($this->isHiddenFile($newFileName)) { + $subject = $this->l->t('You renamed {oldfile} to {newfile} (hidden)'); + } else { + $subject = $this->l->t('You renamed {oldfile} to {newfile}'); + } + } + $this->setIcon($event, 'change'); } elseif ($event->getSubject() === 'renamed_by') { - $subject = $this->l->t('{user} renamed {oldfile} to {newfile}'); + $oldFileName = $parsedParameters['oldfile']['name']; + $newFileName = $parsedParameters['newfile']['name']; + + if ($this->isHiddenFile($oldFileName)) { + if ($this->isHiddenFile($newFileName)) { + $subject = $this->l->t('{user} renamed {oldfile} (hidden) to {newfile} (hidden)'); + } else { + $subject = $this->l->t('{user} renamed {oldfile} (hidden) to {newfile}'); + } + } else { + if ($this->isHiddenFile($newFileName)) { + $subject = $this->l->t('{user} renamed {oldfile} to {newfile} (hidden)'); + } else { + $subject = $this->l->t('{user} renamed {oldfile} to {newfile}'); + } + } + $this->setIcon($event, 'change'); } elseif ($event->getSubject() === 'moved_self') { $subject = $this->l->t('You moved {oldfile} to {newfile}'); @@ -270,6 +302,10 @@ class Provider implements IProvider { return $event; } + private function isHiddenFile(string $filename): bool { + return strlen($filename) > 0 && $filename[0] === '.'; + } + protected function setSubjects(IEvent $event, $subject, array $parameters) { $placeholders = $replacements = []; foreach ($parameters as $placeholder => $parameter) { |