Skip to content

Commit

Permalink
Also check the expiration on all other renderings
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
nickvergessen authored and vitormattos committed Jan 4, 2023
1 parent 26b8738 commit 0a5a9a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Controller/ChatController.php
Expand Up @@ -466,7 +466,7 @@ public function receiveMessages(int $lookIntoFuture,
$this->preloadShares($comments);

$i = 0;
$now = $this->timeFactory->getDateTime('now', new \DateTimeZone('UTC'));
$now = $this->timeFactory->getDateTime();
$messages = $commentIdToIndex = $parentIds = [];
foreach ($comments as $comment) {
$id = (int) $comment->getId();
Expand All @@ -475,7 +475,8 @@ public function receiveMessages(int $lookIntoFuture,

$expireDate = $message->getComment()->getExpireDate();
if ($expireDate instanceof \DateTime && $expireDate < $now) {
$message->setVisibility(false);
$commentIdToIndex[$id] = null;
continue;
}

if (!$message->getVisibility()) {
Expand Down
5 changes: 4 additions & 1 deletion lib/Dashboard/TalkWidget.php
Expand Up @@ -31,6 +31,7 @@
use OCA\Talk\Manager;
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Comments\IComment;
use OCP\Dashboard\IAPIWidget;
use OCP\Dashboard\IButtonWidget;
Expand All @@ -50,14 +51,16 @@ class TalkWidget implements IAPIWidget, IIconWidget, IButtonWidget, IOptionWidge
private IL10N $l10n;
private Manager $manager;
private MessageParser $messageParser;
protected ITimeFactory $timeFactory;

public function __construct(
IUserSession $userSession,
Config $talkConfig,
IURLGenerator $url,
IL10N $l10n,
Manager $manager,
MessageParser $messageParser
MessageParser $messageParser,
ITimeFactory $timeFactory
) {
$user = $userSession->getUser();
if ($user instanceof IUser && $talkConfig->isDisabledForUser($user)) {
Expand Down

0 comments on commit 0a5a9a1

Please sign in to comment.