Skip to content

Save forward_date correctly to the DB. #967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
### Removed
### Fixed
- `forward_date` is now correctly saved to the DB.
### Security

## [0.57.0] - 2019-06-01
Expand Down
9 changes: 4 additions & 5 deletions src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,18 +881,17 @@ public static function insertMessageRequest(Message $message)
}

// Insert the forwarded message user in users table
$forward_date = null;
$forward_date = $message->getForwardDate() ? self::getTimestamp($message->getForwardDate()) : null;

$forward_from = $message->getForwardFrom();
if ($forward_from instanceof User) {
self::insertUser($forward_from, $forward_date);
self::insertUser($forward_from);
$forward_from = $forward_from->getId();
$forward_date = self::getTimestamp($message->getForwardDate());
}
$forward_from_chat = $message->getForwardFromChat();
if ($forward_from_chat instanceof Chat) {
self::insertChat($forward_from_chat, $forward_date);
self::insertChat($forward_from_chat);
$forward_from_chat = $forward_from_chat->getId();
$forward_date = self::getTimestamp($message->getForwardDate());
}

// New and left chat member
Expand Down