mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
fixed several column changes found by tests
This commit is contained in:
parent
7539c25048
commit
fd859e33be
|
@ -399,7 +399,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function readers()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'users_discussions');
|
||||
return $this->belongsToMany(User::class, 'discussions_users');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,6 @@ class Floodgate
|
|||
new CheckingForFlooding($actor)
|
||||
);
|
||||
|
||||
return $isFlooding ?? Post::where('user_id', $actor->id)->where('time', '>=', new DateTime('-10 seconds'))->exists();
|
||||
return $isFlooding ?? Post::where('user_id', $actor->id)->where('created_at', '>=', new DateTime('-10 seconds'))->exists();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,10 @@ use Flarum\Database\AbstractModel;
|
|||
use Flarum\User\Exception\InvalidConfirmationTokenException;
|
||||
|
||||
/**
|
||||
* @todo document database columns with @property
|
||||
* @property string $token
|
||||
* @property int $user_id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property string $email
|
||||
*/
|
||||
class EmailToken extends AbstractModel
|
||||
{
|
||||
|
@ -49,7 +52,7 @@ class EmailToken extends AbstractModel
|
|||
{
|
||||
$token = new static;
|
||||
|
||||
$token->id = str_random(40);
|
||||
$token->token = str_random(40);
|
||||
$token->user_id = $userId;
|
||||
$token->email = $email;
|
||||
$token->created_at = time();
|
||||
|
|
|
@ -50,8 +50,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|||
* @property \Carbon\Carbon|null $last_seen_at
|
||||
* @property \Carbon\Carbon|null $marked_all_as_read_at
|
||||
* @property \Carbon\Carbon|null $read_notifications_at
|
||||
* @property int $discussions_count
|
||||
* @property int $comments_count
|
||||
* @property int $discussion_count
|
||||
* @property int $comment_count
|
||||
*/
|
||||
class User extends AbstractModel
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ class UserMetadataUpdater
|
|||
$user = $post->user;
|
||||
|
||||
if ($user && $user->exists) {
|
||||
$user->comments_count += $amount;
|
||||
$user->comment_count += $amount;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class UserMetadataUpdater
|
|||
$user = $discussion->startUser;
|
||||
|
||||
if ($user && $user->exists) {
|
||||
$user->discussions_count += $amount;
|
||||
$user->discussion_count += $amount;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class CreateUserControllerTest extends ApiControllerTestCase
|
|||
/** @var User $user */
|
||||
$user = User::where('username', 'test')->firstOrFail();
|
||||
|
||||
$this->assertEquals(1, $user->is_activated);
|
||||
$this->assertEquals(1, $user->is_email_confirmed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user