diff options
author | dartcafe <github@dartcafe.de> | 2021-05-28 17:56:24 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-05-28 17:56:24 +0300 |
commit | e69ca2448a42fb616da0e4dda4b2761459439c8d (patch) | |
tree | 3e9ae0b95ceed5aced497fe3457183c53c419746 /lib | |
parent | bca5b5ec9f3ea94933776dc3a2abeef6119dd118 (diff) |
fix #1658
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Db/Option.php | 24 | ||||
-rw-r--r-- | lib/Migration/Version0109Date20210323120002.php | 2 |
2 files changed, 17 insertions, 9 deletions
diff --git a/lib/Db/Option.php b/lib/Db/Option.php index 241cd536..e81f4e81 100644 --- a/lib/Db/Option.php +++ b/lib/Db/Option.php @@ -131,31 +131,39 @@ class Option extends Entity implements JsonSerializable { } public function getPollOptionText(): string { - if ($this->timestamp && $this->duration) { - return date('c', $this->timestamp) . ' - ' . date('c', $this->timestamp + $this->duration); - } elseif ($this->timestamp && !$this->duration) { - return date('c', $this->timestamp); + if ($this->getTimestamp() && $this->getDuration()) { + return date('c', $this->getTimestamp()) . ' - ' . date('c', $this->getTimestamp() + $this->getDuration()); + } elseif ($this->getTimestamp() && !$this->getDuration()) { + return date('c', $this->getTimestamp()); } return htmlspecialchars_decode($this->pollOptionText); } public function getOrder(): int { if ($this->timestamp) { - return $this->timestamp; + return $this->getTimestamp(); } return $this->order; } + // used for 1.9.0-beta1 installtions + public function getOwner() { + if ($this->owner === 'disallow') { + return ''; + } + return $this->owner; + } + private function getDisplayName(): ?string { - if (!strncmp($this->owner, 'deleted_', 8)) { + if (!strncmp($this->getOwner(), 'deleted_', 8)) { return 'Deleted User'; } return $this->getOwnerIsNoUser() ? $this->owner - : \OC::$server->getUserManager()->get($this->owner)->getDisplayName(); + : \OC::$server->getUserManager()->get($this->getOwner())->getDisplayName(); } private function getOwnerIsNoUser(): bool { - return !\OC::$server->getUserManager()->get($this->owner) instanceof IUser; + return !\OC::$server->getUserManager()->get($this->getOwner()) instanceof IUser; } } diff --git a/lib/Migration/Version0109Date20210323120002.php b/lib/Migration/Version0109Date20210323120002.php index b86d3dd5..0fdec262 100644 --- a/lib/Migration/Version0109Date20210323120002.php +++ b/lib/Migration/Version0109Date20210323120002.php @@ -78,7 +78,7 @@ class Version0109Date20210323120002 extends SimpleMigrationStep { $table->addColumn('owner', 'string', [ 'length' => 64, 'notnull' => true, - 'default' => 'disallow' + 'default' => '' ]); } if (!$table->hasColumn('released')) { |