mirror of
https://github.com/flarum/framework.git
synced 2025-05-11 16:52:37 +08:00
Fix some incorrect attribute names
This commit is contained in:
parent
4f259425b0
commit
7d0813bce4
@ -24,7 +24,7 @@ class CurrentUserSerializer extends UserSerializer
|
|||||||
$attributes += [
|
$attributes += [
|
||||||
'isActivated' => (bool) $user->is_email_confirmed,
|
'isActivated' => (bool) $user->is_email_confirmed,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'readTime' => $this->formatDate($user->read_notifications_at),
|
'readTime' => $this->formatDate($user->marked_all_as_read_at),
|
||||||
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
|
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
|
||||||
'newNotificationsCount' => (int) $user->getNewNotificationsCount(),
|
'newNotificationsCount' => (int) $user->getNewNotificationsCount(),
|
||||||
'preferences' => (array) $user->preferences
|
'preferences' => (array) $user->preferences
|
||||||
|
@ -51,7 +51,7 @@ class DiscussionRepository
|
|||||||
{
|
{
|
||||||
return Discussion::leftJoin('discussions_users', 'discussions_users.discussion_id', '=', 'discussions.id')
|
return Discussion::leftJoin('discussions_users', 'discussions_users.discussion_id', '=', 'discussions.id')
|
||||||
->where('user_id', $user->id)
|
->where('user_id', $user->id)
|
||||||
->whereRaw('read_number >= last_post_number')
|
->whereRaw('last_read_post_number >= last_post_number')
|
||||||
->pluck('id')
|
->pluck('id')
|
||||||
->all();
|
->all();
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ class UserState extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function read($number)
|
public function read($number)
|
||||||
{
|
{
|
||||||
if ($number > $this->last_read_at) {
|
if ($number > $this->last_read_post_number) {
|
||||||
$this->last_read_at = $number;
|
$this->last_read_post_number = $number;
|
||||||
$this->last_read_at = Carbon::now();
|
$this->last_read_at = Carbon::now();
|
||||||
|
|
||||||
$this->raise(new UserRead($this));
|
$this->raise(new UserRead($this));
|
||||||
|
@ -58,7 +58,7 @@ class CollectGarbage implements Middleware
|
|||||||
|
|
||||||
$time = Carbon::now()->timestamp;
|
$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);
|
$earliestToKeep = date('Y-m-d H:i:s', $time - 24 * 60 * 60);
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ class Rememberer
|
|||||||
|
|
||||||
public function remember(ResponseInterface $response, AccessToken $token)
|
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();
|
$token->save();
|
||||||
|
|
||||||
return FigResponseCookies::set(
|
return FigResponseCookies::set(
|
||||||
$response,
|
$response,
|
||||||
$this->cookie->make(self::COOKIE_NAME, $token->id, $token->lifetime)
|
$this->cookie->make(self::COOKIE_NAME, $token->token, $token->lifetime_seconds)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Flarum\Notification\Command;
|
namespace Flarum\Notification\Command;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Flarum\Notification\Notification;
|
use Flarum\Notification\Notification;
|
||||||
use Flarum\User\AssertPermissionTrait;
|
use Flarum\User\AssertPermissionTrait;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ class ReadNotificationHandler
|
|||||||
'type' => $notification->type,
|
'type' => $notification->type,
|
||||||
'subject_id' => $notification->subject_id
|
'subject_id' => $notification->subject_id
|
||||||
])
|
])
|
||||||
->update(['is_read' => true]);
|
->update(['read_at' => Carbon::now()]);
|
||||||
|
|
||||||
$notification->is_read = true;
|
$notification->is_read = true;
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class NotificationSyncer
|
|||||||
array_map(function (User $user) use ($attributes, $now) {
|
array_map(function (User $user) use ($attributes, $now) {
|
||||||
return $attributes + [
|
return $attributes + [
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'time' => $now
|
'created_at' => $now
|
||||||
];
|
];
|
||||||
}, $recipients)
|
}, $recipients)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user