mirror of
https://github.com/flarum/core.git
synced 2025-07-10 11:26:24 +02:00
Rename user posts count to comments count
This commit is contained in:
migrations
src
@ -25,7 +25,7 @@ class CreateUsersTable extends Migration {
|
|||||||
$table->dateTime('last_seen_time')->nullable();
|
$table->dateTime('last_seen_time')->nullable();
|
||||||
$table->dateTime('read_time')->nullable();
|
$table->dateTime('read_time')->nullable();
|
||||||
$table->integer('discussions_count')->unsigned()->default(0);
|
$table->integer('discussions_count')->unsigned()->default(0);
|
||||||
$table->integer('posts_count')->unsigned()->default(0);
|
$table->integer('comments_count')->unsigned()->default(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class UserSerializer extends UserBasicSerializer
|
|||||||
'joinTime' => $user->join_time ? $user->join_time->toRFC3339String() : null,
|
'joinTime' => $user->join_time ? $user->join_time->toRFC3339String() : null,
|
||||||
'lastSeenTime' => $user->last_seen_time ? $user->last_seen_time->toRFC3339String() : null,
|
'lastSeenTime' => $user->last_seen_time ? $user->last_seen_time->toRFC3339String() : null,
|
||||||
'discussionsCount' => (int) $user->discussions_count,
|
'discussionsCount' => (int) $user->discussions_count,
|
||||||
'postsCount' => (int) $user->posts_count,
|
'commentsCount' => (int) $user->comments_count,
|
||||||
'canEdit' => $canEdit,
|
'canEdit' => $canEdit,
|
||||||
'canDelete' => $user->can($actorUser, 'delete'),
|
'canDelete' => $user->can($actorUser, 'delete'),
|
||||||
];
|
];
|
||||||
|
@ -131,7 +131,7 @@ class DiscussionsTableSeeder extends Seeder
|
|||||||
$prefix = DB::getTablePrefix();
|
$prefix = DB::getTablePrefix();
|
||||||
DB::table('users')->update([
|
DB::table('users')->update([
|
||||||
'discussions_count' => DB::raw('(SELECT COUNT(id) FROM '.$prefix.'discussions WHERE start_user_id = '.$prefix.'users.id)'),
|
'discussions_count' => DB::raw('(SELECT COUNT(id) FROM '.$prefix.'discussions WHERE start_user_id = '.$prefix.'users.id)'),
|
||||||
'posts_count' => DB::raw('(SELECT COUNT(id) FROM '.$prefix.'posts WHERE user_id = '.$prefix.'users.id and type = "comment")'),
|
'comments_count' => DB::raw('(SELECT COUNT(id) FROM '.$prefix.'posts WHERE user_id = '.$prefix.'users.id and type = "comment")'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user