Fix some incorrect attribute names

This commit is contained in:
Toby Zerner 2018-07-21 17:19:15 +09:30
parent e8cd2d4111
commit a7a0a2ca86
7 changed files with 10 additions and 9 deletions

View File

@ -24,7 +24,7 @@ class CurrentUserSerializer extends UserSerializer
$attributes += [
'isActivated' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'readTime' => $this->formatDate($user->read_notifications_at),
'readTime' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
'newNotificationsCount' => (int) $user->getNewNotificationsCount(),
'preferences' => (array) $user->preferences

View File

@ -51,7 +51,7 @@ class DiscussionRepository
{
return Discussion::leftJoin('discussions_users', 'discussions_users.discussion_id', '=', 'discussions.id')
->where('user_id', $user->id)
->whereRaw('read_number >= last_post_number')
->whereRaw('last_read_post_number >= last_post_number')
->pluck('id')
->all();
}

View File

@ -57,8 +57,8 @@ class UserState extends AbstractModel
*/
public function read($number)
{
if ($number > $this->last_read_at) {
$this->last_read_at = $number;
if ($number > $this->last_read_post_number) {
$this->last_read_post_number = $number;
$this->last_read_at = Carbon::now();
$this->raise(new UserRead($this));

View File

@ -58,7 +58,7 @@ class CollectGarbage implements Middleware
$time = Carbon::now()->timestamp;
AccessToken::whereRaw('last_activity <= ? - lifetime', [$time])->delete();
AccessToken::whereRaw('last_activity_at <= ? - lifetime_seconds', [$time])->delete();
$earliestToKeep = date('Y-m-d H:i:s', $time - 24 * 60 * 60);

View File

@ -33,12 +33,12 @@ class Rememberer
public function remember(ResponseInterface $response, AccessToken $token)
{
$token->lifetime = 5 * 365 * 24 * 60 * 60; // 5 years
$token->lifetime_seconds = 5 * 365 * 24 * 60 * 60; // 5 years
$token->save();
return FigResponseCookies::set(
$response,
$this->cookie->make(self::COOKIE_NAME, $token->id, $token->lifetime)
$this->cookie->make(self::COOKIE_NAME, $token->token, $token->lifetime_seconds)
);
}

View File

@ -11,6 +11,7 @@
namespace Flarum\Notification\Command;
use Carbon\Carbon;
use Flarum\Notification\Notification;
use Flarum\User\AssertPermissionTrait;
@ -36,7 +37,7 @@ class ReadNotificationHandler
'type' => $notification->type,
'subject_id' => $notification->subject_id
])
->update(['is_read' => true]);
->update(['read_at' => Carbon::now()]);
$notification->is_read = true;

View File

@ -179,7 +179,7 @@ class NotificationSyncer
array_map(function (User $user) use ($attributes, $now) {
return $attributes + [
'user_id' => $user->id,
'time' => $now
'created_at' => $now
];
}, $recipients)
);