mirror of
https://github.com/flarum/core.git
synced 2025-08-20 23:31:27 +02:00
Compare commits
2 Commits
sqlite-dri
...
dk/2.x-db-
Author | SHA1 | Date | |
---|---|---|---|
|
9faf01f965 | ||
|
88cce7d7cf |
10
.github/workflows/REUSABLE_backend.yml
vendored
10
.github/workflows/REUSABLE_backend.yml
vendored
@@ -44,7 +44,7 @@ on:
|
||||
description: Versions of databases to test with. Should be array of strings encoded as JSON array
|
||||
type: string
|
||||
required: false
|
||||
default: '["mysql:5.7", "mysql:8.0.30", "mysql:8.1.0", "mariadb"]'
|
||||
default: '["mysql:5.7", "mysql:8.0.30", "mysql:8.1.0", "mariadb", "postgres:16"]'
|
||||
|
||||
php_ini_values:
|
||||
description: PHP ini values
|
||||
@@ -118,6 +118,14 @@ jobs:
|
||||
image: ${{ matrix.service }}
|
||||
ports:
|
||||
- 13306:3306
|
||||
postgres:
|
||||
image: ${{ matrix.service }}
|
||||
ports:
|
||||
- 13306:5432
|
||||
env:
|
||||
POSTGRES_USER: root
|
||||
POSTGRES_PASSWORD: root
|
||||
POSTGRES_DB: flarum_test
|
||||
|
||||
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
||||
|
||||
|
@@ -112,7 +112,6 @@
|
||||
"dflydev/fig-cookies": "^3.0",
|
||||
"doctrine/dbal": "^3.6.2",
|
||||
"dragonmantank/cron-expression": "^3.3",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"franzl/whoops-middleware": "2.0",
|
||||
"guzzlehttp/guzzle": "*",
|
||||
"illuminate/bus": "^10.0",
|
||||
|
@@ -10,23 +10,19 @@
|
||||
namespace Flarum\Approval\Tests\integration;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\User\User;
|
||||
|
||||
trait InteractsWithUnapprovedContent
|
||||
{
|
||||
protected function prepareUnapprovedDatabaseContent()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
@@ -35,7 +31,7 @@ trait InteractsWithUnapprovedContent
|
||||
['id' => 6, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 6, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
['id' => 7, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 7, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
@@ -49,7 +45,7 @@ trait InteractsWithUnapprovedContent
|
||||
['id' => 10, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 4],
|
||||
['id' => 11, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 1, 'is_approved' => 0, 'number' => 5],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0]
|
||||
],
|
||||
'group_user' => [
|
||||
|
@@ -9,12 +9,9 @@
|
||||
|
||||
namespace Flarum\Flags\Tests\integration\api\flags;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -31,7 +28,7 @@ class ListTest extends TestCase
|
||||
$this->extension('flarum-flags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
[
|
||||
'id' => 3,
|
||||
@@ -47,10 +44,10 @@ class ListTest extends TestCase
|
||||
'group_permission' => [
|
||||
['group_id' => Group::MODERATOR_ID, 'permission' => 'discussion.viewFlags'],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => '', 'user_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 3, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
|
@@ -9,13 +9,9 @@
|
||||
|
||||
namespace Flarum\Flags\Tests\integration\api\flags;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListWithTagsTest extends TestCase
|
||||
@@ -33,13 +29,13 @@ class ListWithTagsTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 1, 'name' => 'Unrestricted', 'slug' => '1', 'position' => 0, 'parent_id' => null],
|
||||
['id' => 2, 'name' => 'Mods can view discussions', 'slug' => '2', 'position' => 0, 'parent_id' => null, 'is_restricted' => true],
|
||||
['id' => 3, 'name' => 'Mods can view flags', 'slug' => '3', 'position' => 0, 'parent_id' => null, 'is_restricted' => true],
|
||||
['id' => 4, 'name' => 'Mods can view discussions and flags', 'slug' => '4', 'position' => 0, 'parent_id' => null, 'is_restricted' => true],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
[
|
||||
'id' => 3,
|
||||
@@ -59,7 +55,7 @@ class ListWithTagsTest extends TestCase
|
||||
['group_id' => Group::MODERATOR_ID, 'permission' => 'tag4.viewDiscussions'],
|
||||
['group_id' => Group::MODERATOR_ID, 'permission' => 'tag4.discussion.viewFlags'],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'no tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'has tags where mods can view discussions but not flags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'has tags where mods can view flags but not discussions', 'user_id' => 1, 'comment_count' => 1],
|
||||
@@ -72,7 +68,7 @@ class ListWithTagsTest extends TestCase
|
||||
['discussion_id' => 4, 'tag_id' => 4],
|
||||
['discussion_id' => 5, 'tag_id' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
// From regular ListTest
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
|
@@ -10,13 +10,9 @@
|
||||
namespace Flarum\Likes\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class LikePostTest extends TestCase
|
||||
@@ -30,21 +26,21 @@ class LikePostTest extends TestCase
|
||||
$this->extension('flarum-likes');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'Acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'number' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 3, 'number' => 2, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 5, 'number' => 3, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'discussionRenamed', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 6, 'number' => 4, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0],
|
||||
['id' => 6, 'name_singular' => 'Acme1', 'name_plural' => 'Acme1', 'is_hidden' => 0]
|
||||
],
|
||||
|
@@ -10,13 +10,10 @@
|
||||
namespace Flarum\Likes\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Likes\Api\LoadLikesRelationship;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListPostsTest extends TestCase
|
||||
@@ -33,13 +30,13 @@ class ListPostsTest extends TestCase
|
||||
$this->extension('flarum-likes');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 100, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 101, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 101, 'discussion_id' => 100, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 102, 'username' => 'user102', 'email' => '102@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 103, 'username' => 'user103', 'email' => '103@machine.local', 'is_email_confirmed' => 1],
|
||||
|
@@ -10,10 +10,8 @@
|
||||
namespace Flarum\Mentions\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
@@ -32,14 +30,14 @@ class GroupMentionsTest extends TestCase
|
||||
$this->extension('flarum-mentions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 3, 'username' => 'potato', 'email' => 'potato@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'toby', 'email' => 'toby@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 3, 'first_post_id' => 4, 'comment_count' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 4, 'number' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><p>One of the <GROUPMENTION groupname="Mods" id="4">@"Mods"#g4</GROUPMENTION> will look at this</p></r>'],
|
||||
['id' => 6, 'number' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><p><GROUPMENTION groupname="OldGroupName" id="100">@"OldGroupName"#g100</GROUPMENTION></p></r>'],
|
||||
['id' => 7, 'number' => 4, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><p><GROUPMENTION groupname="OldGroupName" id="11">@"OldGroupName"#g11</GROUPMENTION></p></r>'],
|
||||
@@ -55,7 +53,7 @@ class GroupMentionsTest extends TestCase
|
||||
['group_id' => Group::MEMBER_ID, 'permission' => 'postWithoutThrottle'],
|
||||
['group_id' => 9, 'permission' => 'mentionGroups'],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 9, 'name_singular' => 'HasPermissionToMentionGroups', 'name_plural' => 'test'],
|
||||
['id' => 10, 'name_singular' => 'Hidden', 'name_plural' => 'Ninjas', 'icon' => 'fas fa-wrench', 'color' => '#000', 'is_hidden' => 1],
|
||||
['id' => 11, 'name_singular' => 'Fresh Name', 'name_plural' => 'Fresh Name', 'color' => '#ccc', 'icon' => 'fas fa-users', 'is_hidden' => 0]
|
||||
|
@@ -10,12 +10,9 @@
|
||||
namespace Flarum\Mentions\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Mentions\Api\LoadMentionedByRelationship;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListPostsTest extends TestCase
|
||||
@@ -32,10 +29,10 @@ class ListPostsTest extends TestCase
|
||||
$this->extension('flarum-mentions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
@@ -46,7 +43,7 @@ class ListPostsTest extends TestCase
|
||||
['post_id' => 3, 'mentions_user_id' => 1],
|
||||
['post_id' => 4, 'mentions_user_id' => 2]
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
@@ -115,10 +112,10 @@ class ListPostsTest extends TestCase
|
||||
protected function prepareMentionedByData(): void
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 100, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 101, 'comment_count' => 12],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 101, 'discussion_id' => 100, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
['id' => 102, 'discussion_id' => 100, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>text</p></t>'],
|
||||
['id' => 103, 'discussion_id' => 100, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>text</p></t>', 'is_private' => 1],
|
||||
|
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Mentions\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Extend;
|
||||
use Flarum\Formatter\Formatter;
|
||||
use Flarum\Post\CommentPost;
|
||||
@@ -34,16 +33,16 @@ class PostMentionsTest extends TestCase
|
||||
$this->extension('flarum-mentions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 3, 'username' => 'potato', 'email' => 'potato@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'toby', 'email' => 'toby@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 5, 'username' => 'bad_user', 'email' => 'bad_user@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 3, 'first_post_id' => 4, 'comment_count' => 2],
|
||||
['id' => 50, 'title' => __CLASS__, 'is_private' => true, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 3, 'first_post_id' => 4, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 4, 'number' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><POSTMENTION displayname="TobyFlarum___" id="5" number="2" discussionid="2" username="toby">@tobyuuu#5</POSTMENTION></r>'],
|
||||
['id' => 5, 'number' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 4, 'type' => 'comment', 'content' => '<r><POSTMENTION displayname="potato" id="4" number="3" discussionid="2" username="potato">@potato#4</POSTMENTION></r>'],
|
||||
['id' => 6, 'number' => 4, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><POSTMENTION displayname="i_am_a_deleted_user" id="7" number="5" discussionid="2" username="i_am_a_deleted_user">@"i_am_a_deleted_user"#p7</POSTMENTION></r>'],
|
||||
|
@@ -10,14 +10,10 @@
|
||||
namespace Flarum\Mentions\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class TagMentionsTest extends TestCase
|
||||
{
|
||||
@@ -30,20 +26,20 @@ class TagMentionsTest extends TestCase
|
||||
$this->extension('flarum-tags', 'flarum-mentions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 3, 'username' => 'potato', 'email' => 'potato@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'toby', 'email' => 'toby@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 3, 'first_post_id' => 4, 'comment_count' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 4, 'number' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><TAGMENTION id="1" slug="test_old_slug" tagname="TestOldName">#test_old_slug</TAGMENTION></r>'],
|
||||
['id' => 7, 'number' => 5, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 2021, 'type' => 'comment', 'content' => '<r><TAGMENTION id="3" slug="support" tagname="Support">#deleted_relation</TAGMENTION></r>'],
|
||||
['id' => 8, 'number' => 6, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 4, 'type' => 'comment', 'content' => '<r><TAGMENTION id="2020" slug="i_am_a_deleted_tag" tagname="i_am_a_deleted_tag">#i_am_a_deleted_tag</TAGMENTION></r>'],
|
||||
['id' => 10, 'number' => 11, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 4, 'type' => 'comment', 'content' => '<r><TAGMENTION id="5" slug="laravel">#laravel</TAGMENTION></r>'],
|
||||
],
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 1, 'name' => 'Test', 'slug' => 'test', 'is_restricted' => 0],
|
||||
['id' => 2, 'name' => 'Flarum', 'slug' => 'flarum', 'is_restricted' => 0],
|
||||
['id' => 3, 'name' => 'Support', 'slug' => 'support', 'is_restricted' => 0],
|
||||
|
@@ -10,10 +10,8 @@
|
||||
namespace Flarum\Mentions\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Extend;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\DisplayName\DriverInterface;
|
||||
@@ -33,16 +31,16 @@ class UserMentionsTest extends TestCase
|
||||
$this->extension('flarum-mentions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'potato', 'email' => 'potato@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'toby', 'email' => 'toby@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 5, 'username' => 'bad_user', 'email' => 'bad_user@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 3, 'first_post_id' => 4, 'comment_count' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 4, 'number' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'comment', 'content' => '<r><USERMENTION displayname="TobyFlarum___" id="4" username="toby">@tobyuuu</USERMENTION></r>'],
|
||||
['id' => 6, 'number' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 4, 'type' => 'comment', 'content' => '<r><USERMENTION displayname="i_am_a_deleted_user" id="2021" username="i_am_a_deleted_user">@"i_am_a_deleted_user"#2021</USERMENTION></r>'],
|
||||
['id' => 10, 'number' => 11, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 5, 'type' => 'comment', 'content' => '<r><USERMENTION displayname="Bad "#p6 User" id="5">@"Bad "#p6 User"#5</USERMENTION></r>'],
|
||||
|
@@ -27,7 +27,7 @@ class UpdateTest extends TestCase
|
||||
|
||||
$this->extension('flarum-nicknames');
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
2
extensions/statistics/js/dist/admin.js
generated
vendored
2
extensions/statistics/js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/statistics/js/dist/admin.js.map
generated
vendored
2
extensions/statistics/js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
import app from 'flarum/admin/app';
|
||||
import ItemList from 'flarum/common/utils/ItemList';
|
||||
import generateElementId from 'flarum/common/utils/generateElementId';
|
||||
import generateElementId from 'flarum/admin/utils/generateElementId';
|
||||
import FormModal, { IFormModalAttrs } from 'flarum/common/components/FormModal';
|
||||
|
||||
import Mithril from 'mithril';
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Statistics\tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CanRequestCustomTimedStatisticsTest extends TestCase
|
||||
{
|
||||
@@ -39,18 +36,18 @@ class CanRequestCustomTimedStatisticsTest extends TestCase
|
||||
protected function getDatabaseData(): array
|
||||
{
|
||||
return [
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->copy()],
|
||||
['id' => 2, 'username' => 'normal', 'email' => 'normal@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->copy()->subDays(1)],
|
||||
['id' => 3, 'username' => 'normal2', 'email' => 'normal2@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->copy()->subDays(2)],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(2), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()->subDays(1)],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()->subDays(1)],
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Statistics\tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CanRequestLifetimeStatisticsTest extends TestCase
|
||||
{
|
||||
@@ -39,17 +36,17 @@ class CanRequestLifetimeStatisticsTest extends TestCase
|
||||
protected function getDatabaseData(): array
|
||||
{
|
||||
return [
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 2, 'username' => 'normal', 'email' => 'normal@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->subDays(1)],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => $this->nowTime, 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => $this->nowTime->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => $this->nowTime->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => __CLASS__, 'created_at' => $this->nowTime->subDays(2), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1],
|
||||
@@ -78,9 +75,9 @@ class CanRequestLifetimeStatisticsTest extends TestCase
|
||||
|
||||
$this->assertEqualsCanonicalizing(
|
||||
[
|
||||
'users' => count($db[User::class]),
|
||||
'discussions' => count($db[Discussion::class]),
|
||||
'posts' => count($db[Post::class]),
|
||||
'users' => count($db['users']),
|
||||
'discussions' => count($db['discussions']),
|
||||
'posts' => count($db['posts']),
|
||||
],
|
||||
$body
|
||||
);
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Statistics\tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CanRequestTimedStatisticsTest extends TestCase
|
||||
{
|
||||
@@ -39,17 +36,17 @@ class CanRequestTimedStatisticsTest extends TestCase
|
||||
protected function getDatabaseData(): array
|
||||
{
|
||||
return [
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->copy()],
|
||||
['id' => 2, 'username' => 'normal', 'email' => 'normal@machine.local', 'is_email_confirmed' => 1, 'joined_at' => $this->nowTime->copy()->subDays(1)],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(1), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => __CLASS__, 'created_at' => $this->nowTime->copy()->subDays(2), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()->subDays(1)],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'number' => 1, 'created_at' => $this->nowTime->copy()->subDays(1)],
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Sticky\tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListDiscussionsTest extends TestCase
|
||||
@@ -28,12 +25,12 @@ class ListDiscussionsTest extends TestCase
|
||||
$this->extension('flarum-tags', 'flarum-sticky');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'Muralf_', 'email' => 'muralf_@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1, 'is_sticky' => true, 'last_post_number' => 1],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now()->addMinutes(2), 'last_posted_at' => Carbon::now()->addMinutes(5), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1, 'is_sticky' => false, 'last_post_number' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now()->addMinutes(3), 'last_posted_at' => Carbon::now()->addMinute(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1, 'is_sticky' => true, 'last_post_number' => 1],
|
||||
@@ -43,7 +40,7 @@ class ListDiscussionsTest extends TestCase
|
||||
['discussion_id' => 1, 'user_id' => 3, 'last_read_post_number' => 1],
|
||||
['discussion_id' => 3, 'user_id' => 3, 'last_read_post_number' => 1],
|
||||
],
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 1, 'slug' => 'general', 'position' => 0, 'parent_id' => null]
|
||||
],
|
||||
'discussion_tag' => [
|
||||
|
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Subscriptions\tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Extend\ModelVisibility;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
@@ -29,18 +28,18 @@ class ReplyNotificationTest extends TestCase
|
||||
$this->extension('flarum-subscriptions');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1, 'preferences' => json_encode(['flarum-subscriptions.notify_for_all_posts' => true])],
|
||||
['id' => 4, 'username' => 'acme2', 'email' => 'acme2@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1, 'last_post_number' => 1, 'last_post_id' => 1],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 2, 'comment_count' => 1, 'last_post_number' => 1, 'last_post_id' => 2],
|
||||
|
||||
['id' => 33, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 33, 'comment_count' => 6, 'last_post_number' => 6, 'last_post_id' => 38],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 1],
|
||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 1],
|
||||
|
||||
@@ -170,10 +169,10 @@ class ReplyNotificationTest extends TestCase
|
||||
public function deleting_last_posts_then_posting_new_one_sends_reply_notification(array $postIds)
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 5, 'last_post_number' => 5, 'last_post_id' => 10],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 5, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 1],
|
||||
['id' => 6, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 2],
|
||||
['id' => 7, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 3],
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Suspend\Tests\integration\api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class UseForumTest extends TestCase
|
||||
{
|
||||
@@ -27,14 +24,14 @@ class UseForumTest extends TestCase
|
||||
$this->extension('flarum-suspend');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 2, 'username' => 'SuspendedDonny', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1, 'suspended_until' => Carbon::now()->addDay(), 'suspend_reason' => 'acme', 'suspend_message' => 'acme'],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'number' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'discussion_id' => 1, 'content' => '<t><p>Hello, world!</p></t>'],
|
||||
]
|
||||
]);
|
||||
|
@@ -12,7 +12,6 @@ namespace Flarum\Suspend\Tests\integration\api\users;
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListUsersTest extends TestCase
|
||||
@@ -26,7 +25,7 @@ class ListUsersTest extends TestCase
|
||||
$this->extension('flarum-suspend');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 2, 'username' => 'SuspendedDonny1', 'email' => 'acme1@machine.local', 'is_email_confirmed' => 1, 'suspended_until' => Carbon::now()->addDay(), 'suspend_reason' => 'acme', 'suspend_message' => 'acme'],
|
||||
['id' => 3, 'username' => 'SuspendedDonny2', 'email' => 'acme2@machine.local', 'is_email_confirmed' => 1, 'suspended_until' => Carbon::now()->addDay(), 'suspend_reason' => 'acme', 'suspend_message' => 'acme'],
|
||||
|
@@ -10,10 +10,8 @@
|
||||
namespace Flarum\Suspend\Tests\integration\api\users;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class SuspendUserTest extends TestCase
|
||||
@@ -27,12 +25,12 @@ class SuspendUserTest extends TestCase
|
||||
$this->extension('flarum-suspend');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0]
|
||||
],
|
||||
'group_user' => [
|
||||
|
2
extensions/tags/js/dist/admin.js
generated
vendored
2
extensions/tags/js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/tags/js/dist/admin.js.map
generated
vendored
2
extensions/tags/js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,12 +1,11 @@
|
||||
import { extend } from 'flarum/common/extend';
|
||||
import AdminPage from 'flarum/admin/components/AdminPage';
|
||||
import SelectTagsSettingComponent from './components/SelectTagsSettingComponent';
|
||||
import FormGroup from 'flarum/common/components/FormGroup';
|
||||
import type { IFormGroupAttrs } from 'flarum/common/components/FormGroup';
|
||||
|
||||
export default function () {
|
||||
extend(FormGroup.prototype, 'customFieldComponents', function (items) {
|
||||
items.add('flarum-tags.select-tags', (attrs: IFormGroupAttrs) => {
|
||||
return <SelectTagsSettingComponent {...attrs} settingValue={attrs.bidi} />;
|
||||
extend(AdminPage.prototype, 'customSettingComponents', function (items) {
|
||||
items.add('flarum-tags.select-tags', (attrs) => {
|
||||
return <SelectTagsSettingComponent {...attrs} settingValue={this.settings[attrs.setting]} />;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ use Flarum\Group\Permission;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -52,7 +51,6 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
class Tag extends AbstractModel
|
||||
{
|
||||
use ScopeVisibilityTrait;
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tags';
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Tags;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word,
|
||||
'slug' => $this->faker->slug,
|
||||
'description' => $this->faker->sentence,
|
||||
'color' => $this->faker->hexColor,
|
||||
'background_path' => null,
|
||||
'background_mode' => null,
|
||||
'position' => 0,
|
||||
'parent_id' => null,
|
||||
'default_sort' => null,
|
||||
'is_restricted' => false,
|
||||
'is_hidden' => false,
|
||||
'discussion_count' => 0,
|
||||
'last_posted_at' => null,
|
||||
'last_posted_discussion_id' => null,
|
||||
'last_posted_user_id' => null,
|
||||
'icon' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -10,11 +10,9 @@
|
||||
namespace Flarum\Tags\Tests\integration\api\discussions;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
{
|
||||
@@ -31,8 +29,8 @@ class CreateTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
|
@@ -9,14 +9,9 @@
|
||||
|
||||
namespace Flarum\Tags\Tests\integration\api\discussions;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -34,8 +29,8 @@ class ListTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
[
|
||||
'id' => 3,
|
||||
@@ -45,7 +40,7 @@ class ListTest extends TestCase
|
||||
'is_email_confirmed' => 1,
|
||||
]
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 100, 'name_singular' => 'acme', 'name_plural' => 'acme']
|
||||
],
|
||||
'group_user' => [
|
||||
@@ -57,7 +52,7 @@ class ListTest extends TestCase
|
||||
['group_id' => 100, 'permission' => 'tag11.viewForum'],
|
||||
['group_id' => 100, 'permission' => 'tag13.viewForum'],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'no tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'open tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'open tag, restricted child tag', 'user_id' => 1, 'comment_count' => 1],
|
||||
@@ -71,7 +66,7 @@ class ListTest extends TestCase
|
||||
['id' => 11, 'title' => 'private, all closed', 'user_id' => 1, 'comment_count' => 1, 'is_private' => 1],
|
||||
['id' => 12, 'title' => 'private, closed parent, open child tag', 'user_id' => 1, 'comment_count' => 1, 'is_private' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
|
@@ -9,15 +9,10 @@
|
||||
|
||||
namespace Flarum\Tags\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class UpdateTest extends TestCase
|
||||
{
|
||||
@@ -34,8 +29,8 @@ class UpdateTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
@@ -45,10 +40,10 @@ class UpdateTest extends TestCase
|
||||
['group_id' => Group::MEMBER_ID, 'permission' => 'tag11.viewForum'],
|
||||
['group_id' => Group::MEMBER_ID, 'permission' => 'tag11.startDiscussion'],
|
||||
],
|
||||
Discussion::class => [
|
||||
['id' => 1, 'title' => 'Discussion with post', 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 1, 'created_at' => Carbon::now()->subDay()],
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'Discussion with post', 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>Text</p></t>'],
|
||||
],
|
||||
'discussion_tag' => [
|
||||
@@ -246,7 +241,7 @@ class UpdateTest extends TestCase
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(403, $response->getStatusCode(), $response->getBody());
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -9,14 +9,9 @@
|
||||
|
||||
namespace Flarum\Tags\Tests\integration\api\posts;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class ListTest extends TestCase
|
||||
{
|
||||
@@ -33,8 +28,8 @@ class ListTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
[
|
||||
'id' => 3,
|
||||
@@ -44,7 +39,7 @@ class ListTest extends TestCase
|
||||
'is_email_confirmed' => 1,
|
||||
]
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 100, 'name_singular' => 'acme', 'name_plural' => 'acme']
|
||||
],
|
||||
'group_user' => [
|
||||
@@ -53,10 +48,10 @@ class ListTest extends TestCase
|
||||
'group_permission' => [
|
||||
['group_id' => 100, 'permission' => 'tag5.viewForum'],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'no tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>', 'number' => 1],
|
||||
['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'discussionTagged', 'content' => '[[1,5],[5]]', 'number' => 2],
|
||||
['id' => 3, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>', 'number' => 3],
|
||||
|
@@ -12,7 +12,6 @@ namespace Flarum\Tags\Tests\integration\api\tags;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
@@ -29,7 +28,7 @@ class CreateTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -10,11 +10,9 @@
|
||||
namespace Flarum\Tags\Tests\integration\api\tags;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -32,8 +30,8 @@ class ListTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Flarum\Tags\Tests\integration\api\tags;
|
||||
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
@@ -22,7 +21,7 @@ class ListWithFulltextSearchTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 2, 'name' => 'Acme', 'slug' => 'acme'],
|
||||
['id' => 3, 'name' => 'Test', 'slug' => 'test'],
|
||||
['id' => 4, 'name' => 'Tag', 'slug' => 'tag'],
|
||||
|
@@ -10,11 +10,9 @@
|
||||
namespace Flarum\Tags\Tests\integration\api\tags;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ShowTest extends TestCase
|
||||
@@ -32,8 +30,8 @@ class ShowTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
@@ -47,7 +45,7 @@ class ShowTest extends TestCase
|
||||
public function can_show_tag_with_url_decoded_utf8_slug()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 155, 'name' => '测试', 'slug' => '测试', 'position' => 0, 'parent_id' => null]
|
||||
]
|
||||
]);
|
||||
@@ -69,7 +67,7 @@ class ShowTest extends TestCase
|
||||
public function can_show_tag_with_url_encoded_utf8_slug()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
Tag::class => [
|
||||
'tags' => [
|
||||
['id' => 155, 'name' => '测试', 'slug' => '测试', 'position' => 0, 'parent_id' => null]
|
||||
]
|
||||
]);
|
||||
|
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Tags\Tests\integration\authorization;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
@@ -31,8 +30,8 @@ class GlobalPolicyTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -31,8 +31,8 @@ class TagPolicyTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
|
@@ -11,8 +11,6 @@ namespace Flarum\Tags\Tests\integration\api\discussions;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\Tests\integration\RetrievesRepresentativeTags;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
@@ -35,8 +33,8 @@ class DiscussionVisibilityTest extends TestCase
|
||||
$this->extension('flarum-tags');
|
||||
|
||||
$this->prepareDatabase([
|
||||
Tag::class => $this->tags(),
|
||||
User::class => [
|
||||
'tags' => $this->tags(),
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
'group_permission' => [
|
||||
@@ -48,7 +46,7 @@ class DiscussionVisibilityTest extends TestCase
|
||||
['group_id' => Group::MEMBER_ID, 'permission' => 'arbitraryAbility'],
|
||||
['group_id' => Group::GUEST_ID, 'permission' => 'arbitraryAbility']
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'no tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'open tags', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'open tag, restricted child tag', 'user_id' => 1, 'comment_count' => 1],
|
||||
@@ -57,7 +55,7 @@ class DiscussionVisibilityTest extends TestCase
|
||||
['id' => 6, 'title' => 'closed parent, open child tag', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 7, 'title' => 'one closed primary tag', 'user_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p></p></t>'],
|
||||
|
@@ -41,7 +41,6 @@
|
||||
"dflydev/fig-cookies": "^3.0",
|
||||
"doctrine/dbal": "^3.6",
|
||||
"dragonmantank/cron-expression": "*",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"franzl/whoops-middleware": "2.0",
|
||||
"guzzlehttp/guzzle": "^7.7",
|
||||
"illuminate/bus": "^10.0",
|
||||
|
2
framework/core/js/dist-typings/admin/admin.d.ts
generated
vendored
2
framework/core/js/dist-typings/admin/admin.d.ts
generated
vendored
@@ -3,6 +3,7 @@ import './utils/saveSettings';
|
||||
import './utils/ExtensionData';
|
||||
import './utils/isExtensionEnabled';
|
||||
import './utils/getCategorizedExtensions';
|
||||
import './utils/generateElementId';
|
||||
import './components/SettingDropdown';
|
||||
import './components/EditCustomFooterModal';
|
||||
import './components/SessionDropdown';
|
||||
@@ -19,6 +20,7 @@ import './components/ExtensionLinkButton';
|
||||
import './components/PermissionGrid';
|
||||
import './components/ExtensionPermissionGrid';
|
||||
import './components/MailPage';
|
||||
import './components/UploadImageButton';
|
||||
import './components/LoadingModal';
|
||||
import './components/DashboardPage';
|
||||
import './components/BasicsPage';
|
||||
|
107
framework/core/js/dist-typings/admin/components/AdminPage.d.ts
generated
vendored
107
framework/core/js/dist-typings/admin/components/AdminPage.d.ts
generated
vendored
@@ -1,7 +1,8 @@
|
||||
import type Mithril from 'mithril';
|
||||
import Page, { IPageAttrs } from '../../common/components/Page';
|
||||
import Stream from '../../common/utils/Stream';
|
||||
import { FieldComponentOptions } from '../../common/components/FormGroup';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import type { IUploadImageButtonAttrs } from './UploadImageButton';
|
||||
export interface AdminHeaderOptions {
|
||||
title: Mithril.Children;
|
||||
description: Mithril.Children;
|
||||
@@ -13,9 +14,78 @@ export interface AdminHeaderOptions {
|
||||
*/
|
||||
className: string;
|
||||
}
|
||||
export declare type SettingsComponentOptions = FieldComponentOptions & {
|
||||
/**
|
||||
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
|
||||
*
|
||||
* Note: this will be exported from a different location in the future.
|
||||
*
|
||||
* @see https://github.com/flarum/core/issues/3039
|
||||
*/
|
||||
export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
||||
export interface CommonSettingsItemOptions extends Mithril.Attributes {
|
||||
setting: string;
|
||||
};
|
||||
label?: Mithril.Children;
|
||||
help?: Mithril.Children;
|
||||
className?: string;
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate an HTML input element.
|
||||
*/
|
||||
export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOptions {
|
||||
/**
|
||||
* Any valid HTML input `type` value.
|
||||
*/
|
||||
type: HTMLInputTypes;
|
||||
}
|
||||
declare const BooleanSettingTypes: readonly ["bool", "checkbox", "switch", "boolean"];
|
||||
declare const SelectSettingTypes: readonly ["select", "dropdown", "selectdropdown"];
|
||||
declare const TextareaSettingTypes: readonly ["textarea"];
|
||||
declare const ColorPreviewSettingType: "color-preview";
|
||||
declare const ImageUploadSettingType: "image-upload";
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Switch.
|
||||
*/
|
||||
export interface SwitchSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof BooleanSettingTypes[number];
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Select dropdown.
|
||||
*/
|
||||
export interface SelectSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof SelectSettingTypes[number];
|
||||
/**
|
||||
* Map of values to their labels
|
||||
*/
|
||||
options: {
|
||||
[value: string]: Mithril.Children;
|
||||
};
|
||||
default: string;
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Textarea.
|
||||
*/
|
||||
export interface TextareaSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof TextareaSettingTypes[number];
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a ColorPreviewInput.
|
||||
*/
|
||||
export interface ColorPreviewSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof ColorPreviewSettingType;
|
||||
}
|
||||
export interface ImageUploadSettingComponentOptions extends CommonSettingsItemOptions, IUploadImageButtonAttrs {
|
||||
type: typeof ImageUploadSettingType;
|
||||
}
|
||||
export interface CustomSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* All valid options for the setting component builder.
|
||||
*/
|
||||
export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions | ImageUploadSettingComponentOptions | CustomSettingComponentOptions;
|
||||
/**
|
||||
* Valid attrs that can be returned by the `headerInfo` function
|
||||
*/
|
||||
@@ -47,6 +117,36 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
|
||||
* Returns the options passed to the AdminHeader component.
|
||||
*/
|
||||
headerInfo(): AdminHeaderAttrs;
|
||||
/**
|
||||
* A list of extension-defined custom setting components to be available through
|
||||
* {@link AdminPage.buildSettingComponent}.
|
||||
*
|
||||
* The ItemList key represents the value for `type` to be provided when calling
|
||||
* {@link AdminPage.buildSettingComponent}. Other attributes passed are provided
|
||||
* as arguments to the function added to the ItemList.
|
||||
*
|
||||
* ItemList priority has no effect here.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* extend(AdminPage.prototype, 'customSettingComponents', function (items) {
|
||||
* // You can access the AdminPage instance with `this` to access its `settings` property.
|
||||
*
|
||||
* // Prefixing the key with your extension ID is recommended to avoid collisions.
|
||||
* items.add('my-ext.setting-component', (attrs) => {
|
||||
* return (
|
||||
* <div className={attrs.className}>
|
||||
* <label>{attrs.label}</label>
|
||||
* {attrs.help && <p className="helpText">{attrs.help}</p>}
|
||||
*
|
||||
* My setting component!
|
||||
* </div>
|
||||
* );
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
customSettingComponents(): ItemList<(attributes: CommonSettingsItemOptions) => Mithril.Children>;
|
||||
/**
|
||||
* `buildSettingComponent` takes a settings object and turns it into a component.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
@@ -108,3 +208,4 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
|
||||
saveSettings(e: SaveSubmitEvent): Promise<void>;
|
||||
modelLocale(): Record<string, string>;
|
||||
}
|
||||
export {};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import type { IButtonAttrs } from './Button';
|
||||
import type { IButtonAttrs } from '../../common/components/Button';
|
||||
import type Mithril from 'mithril';
|
||||
import Component from '../Component';
|
||||
import Component from '../../common/Component';
|
||||
export interface IUploadImageButtonAttrs extends IButtonAttrs {
|
||||
name: string;
|
||||
routePath: string;
|
3
framework/core/js/dist-typings/common/common.d.ts
generated
vendored
3
framework/core/js/dist-typings/common/common.d.ts
generated
vendored
@@ -34,7 +34,6 @@ import './utils/withAttr';
|
||||
import './utils/focusTrap';
|
||||
import './utils/isDark';
|
||||
import './utils/KeyboardNavigatable';
|
||||
import './utils/generateElementId';
|
||||
import './models/Notification';
|
||||
import './models/User';
|
||||
import './models/Post';
|
||||
@@ -73,8 +72,6 @@ import './components/TextEditorButton';
|
||||
import './components/Tooltip';
|
||||
import './components/AutocompleteDropdown';
|
||||
import './components/GambitsAutocompleteDropdown';
|
||||
import './components/UploadImageButton';
|
||||
import './components/FormGroup';
|
||||
import './helpers/fullTime';
|
||||
import './components/Avatar';
|
||||
import './helpers/humanTime';
|
||||
|
140
framework/core/js/dist-typings/common/components/FormGroup.d.ts
generated
vendored
140
framework/core/js/dist-typings/common/components/FormGroup.d.ts
generated
vendored
@@ -1,140 +0,0 @@
|
||||
import Component from '../Component';
|
||||
import Stream from '../utils/Stream';
|
||||
import ItemList from '../utils/ItemList';
|
||||
import type { IUploadImageButtonAttrs } from './UploadImageButton';
|
||||
import type { ComponentAttrs } from '../Component';
|
||||
import type Mithril from 'mithril';
|
||||
/**
|
||||
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
|
||||
*
|
||||
* Note: this will be exported from a different location in the future.
|
||||
*
|
||||
* @see https://github.com/flarum/core/issues/3039
|
||||
*/
|
||||
export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
||||
export interface CommonFieldOptions extends Mithril.Attributes {
|
||||
label?: Mithril.Children;
|
||||
help?: Mithril.Children;
|
||||
className?: string;
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate an HTML input element.
|
||||
*/
|
||||
export interface HTMLInputFieldComponentOptions extends CommonFieldOptions {
|
||||
/**
|
||||
* Any valid HTML input `type` value.
|
||||
*/
|
||||
type: HTMLInputTypes;
|
||||
}
|
||||
declare const BooleanSettingTypes: readonly ["bool", "checkbox", "switch", "boolean"];
|
||||
declare const SelectSettingTypes: readonly ["select", "dropdown", "selectdropdown"];
|
||||
declare const TextareaSettingTypes: readonly ["textarea"];
|
||||
declare const ColorPreviewSettingType: "color-preview";
|
||||
declare const ImageUploadSettingType: "image-upload";
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Switch.
|
||||
*/
|
||||
export interface SwitchFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof BooleanSettingTypes[number];
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Select dropdown.
|
||||
*/
|
||||
export interface SelectFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof SelectSettingTypes[number];
|
||||
/**
|
||||
* Map of values to their labels
|
||||
*/
|
||||
options: {
|
||||
[value: string]: Mithril.Children;
|
||||
};
|
||||
default: string;
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Textarea.
|
||||
*/
|
||||
export interface TextareaFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof TextareaSettingTypes[number];
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a ColorPreviewInput.
|
||||
*/
|
||||
export interface ColorPreviewFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof ColorPreviewSettingType;
|
||||
}
|
||||
export interface ImageUploadFieldComponentOptions extends CommonFieldOptions, IUploadImageButtonAttrs {
|
||||
type: typeof ImageUploadSettingType;
|
||||
}
|
||||
export interface CustomFieldComponentOptions extends CommonFieldOptions {
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* All valid options for the setting component builder.
|
||||
*/
|
||||
export declare type FieldComponentOptions = HTMLInputFieldComponentOptions | SwitchFieldComponentOptions | SelectFieldComponentOptions | TextareaFieldComponentOptions | ColorPreviewFieldComponentOptions | ImageUploadFieldComponentOptions | CustomFieldComponentOptions;
|
||||
export declare type IFormGroupAttrs = ComponentAttrs & FieldComponentOptions & {
|
||||
bidi?: Stream<any>;
|
||||
};
|
||||
/**
|
||||
* Builds a field component based on the provided attributes.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
* any standard <input> type. Any values inside the 'extra' object will be added
|
||||
* to the component as an attribute.
|
||||
*
|
||||
* Alternatively, you can pass a callback that will be executed in ExtensionPage's
|
||||
* context to include custom JSX elements.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* <FormGroup key="acme.checkbox"
|
||||
* label={app.translator.trans('acme.admin.setting_label')}
|
||||
* type="bool"
|
||||
* help={app.translator.trans('acme.admin.setting_help')}
|
||||
* className="Setting-item" />
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* <FormGroup key="acme.select"
|
||||
* label={app.translator.trans('acme.admin.setting_label')}
|
||||
* type="select"
|
||||
* options={{
|
||||
* 'option1': 'Option 1 label',
|
||||
* 'option2': 'Option 2 label',
|
||||
* }}
|
||||
* default="option1" />
|
||||
*/
|
||||
export default class FormGroup<CustomAttrs extends IFormGroupAttrs = IFormGroupAttrs> extends Component<CustomAttrs> {
|
||||
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||
/**
|
||||
* A list of extension-defined custom setting components to be available.
|
||||
*
|
||||
* The ItemList key represents the value for the `type` attribute.
|
||||
* All attributes passed are provided as arguments to the function added to the ItemList.
|
||||
*
|
||||
* ItemList priority has no effect here.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* extend(AdminPage.prototype, 'customFieldComponents', function (items) {
|
||||
* // You can access the AdminPage instance with `this` to access its `settings` property.
|
||||
*
|
||||
* // Prefixing the key with your extension ID is recommended to avoid collisions.
|
||||
* items.add('my-ext.setting-component', (attrs) => {
|
||||
* return (
|
||||
* <div className={attrs.className}>
|
||||
* <label>{attrs.label}</label>
|
||||
* {attrs.help && <p className="helpText">{attrs.help}</p>}
|
||||
*
|
||||
* My setting component!
|
||||
* </div>
|
||||
* );
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
customFieldComponents(): ItemList<(attributes: CustomAttrs) => Mithril.Children>;
|
||||
}
|
||||
export {};
|
2
framework/core/js/dist/admin.js
generated
vendored
2
framework/core/js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/admin.js.map
generated
vendored
2
framework/core/js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/forum.js
generated
vendored
2
framework/core/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/forum.js.map
generated
vendored
2
framework/core/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@ import './utils/saveSettings';
|
||||
import './utils/ExtensionData';
|
||||
import './utils/isExtensionEnabled';
|
||||
import './utils/getCategorizedExtensions';
|
||||
import './utils/generateElementId';
|
||||
|
||||
import './components/SettingDropdown';
|
||||
import './components/EditCustomFooterModal';
|
||||
@@ -21,6 +22,7 @@ import './components/ExtensionLinkButton';
|
||||
import './components/PermissionGrid';
|
||||
import './components/ExtensionPermissionGrid';
|
||||
import './components/MailPage';
|
||||
import './components/UploadImageButton';
|
||||
import './components/LoadingModal';
|
||||
import './components/DashboardPage';
|
||||
import './components/BasicsPage';
|
||||
|
@@ -3,11 +3,17 @@ import type Mithril from 'mithril';
|
||||
import app from '../app';
|
||||
import Page, { IPageAttrs } from '../../common/components/Page';
|
||||
import Button from '../../common/components/Button';
|
||||
import Switch from '../../common/components/Switch';
|
||||
import Select from '../../common/components/Select';
|
||||
import classList from '../../common/utils/classList';
|
||||
import Stream from '../../common/utils/Stream';
|
||||
import saveSettings from '../utils/saveSettings';
|
||||
import AdminHeader from './AdminHeader';
|
||||
import FormGroup, { FieldComponentOptions } from '../../common/components/FormGroup';
|
||||
import generateElementId from '../utils/generateElementId';
|
||||
import ColorPreviewInput from '../../common/components/ColorPreviewInput';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import type { IUploadImageButtonAttrs } from './UploadImageButton';
|
||||
import UploadImageButton from './UploadImageButton';
|
||||
import extractText from '../../common/utils/extractText';
|
||||
|
||||
export interface AdminHeaderOptions {
|
||||
@@ -22,9 +28,115 @@ export interface AdminHeaderOptions {
|
||||
className: string;
|
||||
}
|
||||
|
||||
export type SettingsComponentOptions = FieldComponentOptions & {
|
||||
/**
|
||||
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
|
||||
*
|
||||
* Note: this will be exported from a different location in the future.
|
||||
*
|
||||
* @see https://github.com/flarum/core/issues/3039
|
||||
*/
|
||||
export type HTMLInputTypes =
|
||||
| 'button'
|
||||
| 'checkbox'
|
||||
| 'color'
|
||||
| 'date'
|
||||
| 'datetime-local'
|
||||
| 'email'
|
||||
| 'file'
|
||||
| 'hidden'
|
||||
| 'image'
|
||||
| 'month'
|
||||
| 'number'
|
||||
| 'password'
|
||||
| 'radio'
|
||||
| 'range'
|
||||
| 'reset'
|
||||
| 'search'
|
||||
| 'submit'
|
||||
| 'tel'
|
||||
| 'text'
|
||||
| 'time'
|
||||
| 'url'
|
||||
| 'week';
|
||||
|
||||
export interface CommonSettingsItemOptions extends Mithril.Attributes {
|
||||
setting: string;
|
||||
};
|
||||
label?: Mithril.Children;
|
||||
help?: Mithril.Children;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate an HTML input element.
|
||||
*/
|
||||
export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOptions {
|
||||
/**
|
||||
* Any valid HTML input `type` value.
|
||||
*/
|
||||
type: HTMLInputTypes;
|
||||
}
|
||||
|
||||
const BooleanSettingTypes = ['bool', 'checkbox', 'switch', 'boolean'] as const;
|
||||
const SelectSettingTypes = ['select', 'dropdown', 'selectdropdown'] as const;
|
||||
const TextareaSettingTypes = ['textarea'] as const;
|
||||
const ColorPreviewSettingType = 'color-preview' as const;
|
||||
const ImageUploadSettingType = 'image-upload' as const;
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Switch.
|
||||
*/
|
||||
export interface SwitchSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof BooleanSettingTypes[number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Select dropdown.
|
||||
*/
|
||||
export interface SelectSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof SelectSettingTypes[number];
|
||||
/**
|
||||
* Map of values to their labels
|
||||
*/
|
||||
options: { [value: string]: Mithril.Children };
|
||||
default: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Textarea.
|
||||
*/
|
||||
export interface TextareaSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof TextareaSettingTypes[number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a ColorPreviewInput.
|
||||
*/
|
||||
export interface ColorPreviewSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof ColorPreviewSettingType;
|
||||
}
|
||||
|
||||
export interface ImageUploadSettingComponentOptions extends CommonSettingsItemOptions, IUploadImageButtonAttrs {
|
||||
type: typeof ImageUploadSettingType;
|
||||
}
|
||||
|
||||
export interface CustomSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* All valid options for the setting component builder.
|
||||
*/
|
||||
export type SettingsComponentOptions =
|
||||
| HTMLInputSettingsComponentOptions
|
||||
| SwitchSettingComponentOptions
|
||||
| SelectSettingComponentOptions
|
||||
| TextareaSettingComponentOptions
|
||||
| ColorPreviewSettingComponentOptions
|
||||
| ImageUploadSettingComponentOptions
|
||||
| CustomSettingComponentOptions;
|
||||
|
||||
/**
|
||||
* Valid attrs that can be returned by the `headerInfo` function
|
||||
@@ -94,6 +206,41 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of extension-defined custom setting components to be available through
|
||||
* {@link AdminPage.buildSettingComponent}.
|
||||
*
|
||||
* The ItemList key represents the value for `type` to be provided when calling
|
||||
* {@link AdminPage.buildSettingComponent}. Other attributes passed are provided
|
||||
* as arguments to the function added to the ItemList.
|
||||
*
|
||||
* ItemList priority has no effect here.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* extend(AdminPage.prototype, 'customSettingComponents', function (items) {
|
||||
* // You can access the AdminPage instance with `this` to access its `settings` property.
|
||||
*
|
||||
* // Prefixing the key with your extension ID is recommended to avoid collisions.
|
||||
* items.add('my-ext.setting-component', (attrs) => {
|
||||
* return (
|
||||
* <div className={attrs.className}>
|
||||
* <label>{attrs.label}</label>
|
||||
* {attrs.help && <p className="helpText">{attrs.help}</p>}
|
||||
*
|
||||
* My setting component!
|
||||
* </div>
|
||||
* );
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
customSettingComponents(): ItemList<(attributes: CommonSettingsItemOptions) => Mithril.Children> {
|
||||
const items = new ItemList<(attributes: CommonSettingsItemOptions) => Mithril.Children>();
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* `buildSettingComponent` takes a settings object and turns it into a component.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
@@ -137,9 +284,77 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
|
||||
return entry.call(this);
|
||||
}
|
||||
|
||||
const { setting, ...attrs } = entry;
|
||||
const customSettingComponents = this.customSettingComponents();
|
||||
|
||||
return <FormGroup bidi={this.setting(setting)} {...attrs} />;
|
||||
const { setting, help, type, label, ...componentAttrs } = entry;
|
||||
|
||||
const value = this.setting(setting)();
|
||||
|
||||
const [inputId, helpTextId] = [generateElementId(), generateElementId()];
|
||||
|
||||
let settingElement: Mithril.Children;
|
||||
|
||||
// Typescript being Typescript
|
||||
// https://github.com/microsoft/TypeScript/issues/14520
|
||||
if ((BooleanSettingTypes as readonly string[]).includes(type)) {
|
||||
return (
|
||||
// TODO: Add aria-describedby for switch help text.
|
||||
//? Requires changes to Checkbox component to allow providing attrs directly for the element(s).
|
||||
<div className="Form-group">
|
||||
<Switch state={!!value && value !== '0'} onchange={this.settings[setting]} {...componentAttrs}>
|
||||
{label}
|
||||
</Switch>
|
||||
{help ? <div className="helpText">{help}</div> : null}
|
||||
</div>
|
||||
);
|
||||
} else if ((SelectSettingTypes as readonly string[]).includes(type)) {
|
||||
const { default: defaultValue, options, ...otherAttrs } = componentAttrs;
|
||||
|
||||
settingElement = (
|
||||
<Select
|
||||
id={inputId}
|
||||
aria-describedby={helpTextId}
|
||||
value={value || defaultValue}
|
||||
options={options}
|
||||
onchange={this.settings[setting]}
|
||||
{...otherAttrs}
|
||||
/>
|
||||
);
|
||||
} else if (type === ImageUploadSettingType) {
|
||||
const { value, ...otherAttrs } = componentAttrs;
|
||||
|
||||
settingElement = <UploadImageButton value={this.settings[setting]} {...otherAttrs} />;
|
||||
} else if (customSettingComponents.has(type)) {
|
||||
return customSettingComponents.get(type)({ setting, help, label, ...componentAttrs });
|
||||
} else {
|
||||
componentAttrs.className = classList('FormControl', componentAttrs.className);
|
||||
|
||||
if ((TextareaSettingTypes as readonly string[]).includes(type)) {
|
||||
settingElement = <textarea id={inputId} aria-describedby={helpTextId} bidi={this.setting(setting)} {...componentAttrs} />;
|
||||
} else {
|
||||
let Tag: VnodeElementTag = 'input';
|
||||
|
||||
if (type === ColorPreviewSettingType) {
|
||||
Tag = ColorPreviewInput;
|
||||
} else {
|
||||
componentAttrs.type = type;
|
||||
}
|
||||
|
||||
settingElement = <Tag id={inputId} aria-describedby={helpTextId} bidi={this.setting(setting)} {...componentAttrs} />;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="Form-group">
|
||||
{label && <label for={inputId}>{label}</label>}
|
||||
{help && (
|
||||
<div id={helpTextId} className="helpText">
|
||||
{help}
|
||||
</div>
|
||||
)}
|
||||
{settingElement}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,7 @@ import Button from '../../common/components/Button';
|
||||
import EditCustomCssModal from './EditCustomCssModal';
|
||||
import EditCustomHeaderModal from './EditCustomHeaderModal';
|
||||
import EditCustomFooterModal from './EditCustomFooterModal';
|
||||
import UploadImageButton from '../../common/components/UploadImageButton';
|
||||
import UploadImageButton from './UploadImageButton';
|
||||
import AdminPage from './AdminPage';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import type Mithril from 'mithril';
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import app from '../app';
|
||||
import Button from './Button';
|
||||
import type { IButtonAttrs } from './Button';
|
||||
import classList from '../utils/classList';
|
||||
import app from '../../admin/app';
|
||||
import Button from '../../common/components/Button';
|
||||
import type { IButtonAttrs } from '../../common/components/Button';
|
||||
import classList from '../../common/utils/classList';
|
||||
import type Mithril from 'mithril';
|
||||
import Component from '../Component';
|
||||
import Component from '../../common/Component';
|
||||
|
||||
export interface IUploadImageButtonAttrs extends IButtonAttrs {
|
||||
name: string;
|
@@ -36,7 +36,6 @@ import './utils/withAttr';
|
||||
import './utils/focusTrap';
|
||||
import './utils/isDark';
|
||||
import './utils/KeyboardNavigatable';
|
||||
import './utils/generateElementId';
|
||||
|
||||
import './models/Notification';
|
||||
import './models/User';
|
||||
@@ -77,8 +76,6 @@ import './components/TextEditorButton';
|
||||
import './components/Tooltip';
|
||||
import './components/AutocompleteDropdown';
|
||||
import './components/GambitsAutocompleteDropdown';
|
||||
import './components/UploadImageButton';
|
||||
import './components/FormGroup';
|
||||
|
||||
import './helpers/fullTime';
|
||||
import './components/Avatar';
|
||||
|
@@ -1,259 +0,0 @@
|
||||
import Component from '../Component';
|
||||
import generateElementId from '../utils/generateElementId';
|
||||
import Switch from './Switch';
|
||||
import Select from './Select';
|
||||
import UploadImageButton from './UploadImageButton';
|
||||
import classList from '../utils/classList';
|
||||
import ColorPreviewInput from './ColorPreviewInput';
|
||||
import Stream from '../utils/Stream';
|
||||
import ItemList from '../utils/ItemList';
|
||||
import type { IUploadImageButtonAttrs } from './UploadImageButton';
|
||||
import type { ComponentAttrs } from '../Component';
|
||||
import type Mithril from 'mithril';
|
||||
|
||||
/**
|
||||
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
|
||||
*
|
||||
* Note: this will be exported from a different location in the future.
|
||||
*
|
||||
* @see https://github.com/flarum/core/issues/3039
|
||||
*/
|
||||
export type HTMLInputTypes =
|
||||
| 'button'
|
||||
| 'checkbox'
|
||||
| 'color'
|
||||
| 'date'
|
||||
| 'datetime-local'
|
||||
| 'email'
|
||||
| 'file'
|
||||
| 'hidden'
|
||||
| 'image'
|
||||
| 'month'
|
||||
| 'number'
|
||||
| 'password'
|
||||
| 'radio'
|
||||
| 'range'
|
||||
| 'reset'
|
||||
| 'search'
|
||||
| 'submit'
|
||||
| 'tel'
|
||||
| 'text'
|
||||
| 'time'
|
||||
| 'url'
|
||||
| 'week';
|
||||
|
||||
export interface CommonFieldOptions extends Mithril.Attributes {
|
||||
label?: Mithril.Children;
|
||||
help?: Mithril.Children;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate an HTML input element.
|
||||
*/
|
||||
export interface HTMLInputFieldComponentOptions extends CommonFieldOptions {
|
||||
/**
|
||||
* Any valid HTML input `type` value.
|
||||
*/
|
||||
type: HTMLInputTypes;
|
||||
}
|
||||
|
||||
const BooleanSettingTypes = ['bool', 'checkbox', 'switch', 'boolean'] as const;
|
||||
const SelectSettingTypes = ['select', 'dropdown', 'selectdropdown'] as const;
|
||||
const TextareaSettingTypes = ['textarea'] as const;
|
||||
const ColorPreviewSettingType = 'color-preview' as const;
|
||||
const ImageUploadSettingType = 'image-upload' as const;
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Switch.
|
||||
*/
|
||||
export interface SwitchFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof BooleanSettingTypes[number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Select dropdown.
|
||||
*/
|
||||
export interface SelectFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof SelectSettingTypes[number];
|
||||
/**
|
||||
* Map of values to their labels
|
||||
*/
|
||||
options: { [value: string]: Mithril.Children };
|
||||
default: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Textarea.
|
||||
*/
|
||||
export interface TextareaFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof TextareaSettingTypes[number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a ColorPreviewInput.
|
||||
*/
|
||||
export interface ColorPreviewFieldComponentOptions extends CommonFieldOptions {
|
||||
type: typeof ColorPreviewSettingType;
|
||||
}
|
||||
|
||||
export interface ImageUploadFieldComponentOptions extends CommonFieldOptions, IUploadImageButtonAttrs {
|
||||
type: typeof ImageUploadSettingType;
|
||||
}
|
||||
|
||||
export interface CustomFieldComponentOptions extends CommonFieldOptions {
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* All valid options for the setting component builder.
|
||||
*/
|
||||
export type FieldComponentOptions =
|
||||
| HTMLInputFieldComponentOptions
|
||||
| SwitchFieldComponentOptions
|
||||
| SelectFieldComponentOptions
|
||||
| TextareaFieldComponentOptions
|
||||
| ColorPreviewFieldComponentOptions
|
||||
| ImageUploadFieldComponentOptions
|
||||
| CustomFieldComponentOptions;
|
||||
|
||||
export type IFormGroupAttrs = ComponentAttrs &
|
||||
FieldComponentOptions & {
|
||||
bidi?: Stream<any>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a field component based on the provided attributes.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
* any standard <input> type. Any values inside the 'extra' object will be added
|
||||
* to the component as an attribute.
|
||||
*
|
||||
* Alternatively, you can pass a callback that will be executed in ExtensionPage's
|
||||
* context to include custom JSX elements.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* <FormGroup key="acme.checkbox"
|
||||
* label={app.translator.trans('acme.admin.setting_label')}
|
||||
* type="bool"
|
||||
* help={app.translator.trans('acme.admin.setting_help')}
|
||||
* className="Setting-item" />
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* <FormGroup key="acme.select"
|
||||
* label={app.translator.trans('acme.admin.setting_label')}
|
||||
* type="select"
|
||||
* options={{
|
||||
* 'option1': 'Option 1 label',
|
||||
* 'option2': 'Option 2 label',
|
||||
* }}
|
||||
* default="option1" />
|
||||
*/
|
||||
export default class FormGroup<CustomAttrs extends IFormGroupAttrs = IFormGroupAttrs> extends Component<CustomAttrs> {
|
||||
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children {
|
||||
const customFieldComponents = this.customFieldComponents();
|
||||
|
||||
const { help, type, label, bidi, ...componentAttrs } = this.attrs;
|
||||
|
||||
// TypeScript being TypeScript
|
||||
const attrs = componentAttrs as unknown as Omit<IFormGroupAttrs, 'bidi' | 'label' | 'help' | 'type'>;
|
||||
|
||||
const value = bidi ? bidi() : null;
|
||||
|
||||
const [inputId, helpTextId] = [generateElementId(), generateElementId()];
|
||||
|
||||
let settingElement: Mithril.Children;
|
||||
|
||||
// Typescript being Typescript
|
||||
// https://github.com/microsoft/TypeScript/issues/14520
|
||||
if ((BooleanSettingTypes as readonly string[]).includes(type)) {
|
||||
return (
|
||||
// TODO: Add aria-describedby for switch help text.
|
||||
//? Requires changes to Checkbox component to allow providing attrs directly for the element(s).
|
||||
<div className="Form-group">
|
||||
<Switch state={!!value && value !== '0'} onchange={bidi} {...attrs}>
|
||||
{label}
|
||||
</Switch>
|
||||
{help ? <div className="helpText">{help}</div> : null}
|
||||
</div>
|
||||
);
|
||||
} else if ((SelectSettingTypes as readonly string[]).includes(type)) {
|
||||
const { default: defaultValue, options, ...otherAttrs } = attrs;
|
||||
|
||||
settingElement = (
|
||||
<Select id={inputId} aria-describedby={helpTextId} value={value || defaultValue} options={options} onchange={bidi} {...otherAttrs} />
|
||||
);
|
||||
} else if (type === ImageUploadSettingType) {
|
||||
const { value, ...otherAttrs } = attrs;
|
||||
|
||||
settingElement = <UploadImageButton value={bidi} {...otherAttrs} />;
|
||||
} else if (customFieldComponents.has(type)) {
|
||||
return customFieldComponents.get(type)(this.attrs);
|
||||
} else {
|
||||
attrs.className = classList('FormControl', attrs.className);
|
||||
|
||||
if ((TextareaSettingTypes as readonly string[]).includes(type)) {
|
||||
settingElement = <textarea id={inputId} aria-describedby={helpTextId} bidi={bidi} {...attrs} />;
|
||||
} else {
|
||||
let Tag: VnodeElementTag = 'input';
|
||||
|
||||
if (type === ColorPreviewSettingType) {
|
||||
Tag = ColorPreviewInput;
|
||||
} else {
|
||||
attrs.type = type;
|
||||
}
|
||||
|
||||
settingElement = <Tag id={inputId} aria-describedby={helpTextId} bidi={bidi} {...attrs} />;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="Form-group">
|
||||
{label && <label for={inputId}>{label}</label>}
|
||||
{help && (
|
||||
<div id={helpTextId} className="helpText">
|
||||
{help}
|
||||
</div>
|
||||
)}
|
||||
{settingElement}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of extension-defined custom setting components to be available.
|
||||
*
|
||||
* The ItemList key represents the value for the `type` attribute.
|
||||
* All attributes passed are provided as arguments to the function added to the ItemList.
|
||||
*
|
||||
* ItemList priority has no effect here.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* extend(AdminPage.prototype, 'customFieldComponents', function (items) {
|
||||
* // You can access the AdminPage instance with `this` to access its `settings` property.
|
||||
*
|
||||
* // Prefixing the key with your extension ID is recommended to avoid collisions.
|
||||
* items.add('my-ext.setting-component', (attrs) => {
|
||||
* return (
|
||||
* <div className={attrs.className}>
|
||||
* <label>{attrs.label}</label>
|
||||
* {attrs.help && <p className="helpText">{attrs.help}</p>}
|
||||
*
|
||||
* My setting component!
|
||||
* </div>
|
||||
* );
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
customFieldComponents(): ItemList<(attributes: CustomAttrs) => Mithril.Children> {
|
||||
const items = new ItemList<(attributes: CustomAttrs) => Mithril.Children>();
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
@@ -12,7 +12,6 @@ namespace Flarum\Api;
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -28,8 +27,6 @@ use Illuminate\Support\Str;
|
||||
*/
|
||||
class ApiKey extends AbstractModel
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Api;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ApiKeyFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'key' => $this->faker->sha256,
|
||||
'allowed_ips' => null,
|
||||
'scopes' => null,
|
||||
'user_id' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
'last_activity_at' => null,
|
||||
];
|
||||
}
|
||||
}
|
@@ -9,25 +9,17 @@
|
||||
|
||||
namespace Flarum\Database;
|
||||
|
||||
use Faker\Factory as FakerFactory;
|
||||
use Faker\Generator as FakerGenerator;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Illuminate\Container\Container as ContainerImplementation;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Database\Capsule\Manager;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Illuminate\Database\ConnectionResolverInterface;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DatabaseServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
protected static array $fakers = [];
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
$this->registerEloquentFactory();
|
||||
|
||||
$this->container->singleton(Manager::class, function (ContainerImplementation $container) {
|
||||
$manager = new Manager($container);
|
||||
|
||||
@@ -71,33 +63,11 @@ class DatabaseServiceProvider extends AbstractServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
protected function registerEloquentFactory(): void
|
||||
{
|
||||
$this->app->singleton(FakerGenerator::class, function ($app, $parameters) {
|
||||
$locale = $parameters['locale'] ?? 'en_US';
|
||||
|
||||
if (! isset(static::$fakers[$locale])) {
|
||||
static::$fakers[$locale] = FakerFactory::create($locale);
|
||||
}
|
||||
|
||||
static::$fakers[$locale]->unique(true);
|
||||
|
||||
return static::$fakers[$locale];
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(Container $container): void
|
||||
{
|
||||
AbstractModel::setConnectionResolver($container->make(ConnectionResolverInterface::class));
|
||||
AbstractModel::setEventDispatcher($container->make('events'));
|
||||
|
||||
Factory::guessFactoryNamesUsing(function (string $modelName) {
|
||||
return $modelName.'Factory';
|
||||
});
|
||||
Factory::guessModelNamesUsing(function (Factory $factory) {
|
||||
return Str::replaceLast('Factory', '', $factory::class);
|
||||
});
|
||||
|
||||
foreach ($container->make('flarum.database.model_private_checkers') as $modelClass => $checkers) {
|
||||
$modelClass::saving(function ($instance) use ($checkers) {
|
||||
foreach ($checkers as $checker) {
|
||||
|
@@ -24,7 +24,6 @@ use Flarum\Post\Post;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -61,7 +60,6 @@ class Discussion extends AbstractModel
|
||||
{
|
||||
use EventGeneratorTrait;
|
||||
use ScopeVisibilityTrait;
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* An array of posts that have been modified during this request.
|
||||
|
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Discussion;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class DiscussionFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->sentence,
|
||||
'comment_count' => 1,
|
||||
'participant_count' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => User::factory(),
|
||||
'first_post_id' => null,
|
||||
'last_posted_at' => null,
|
||||
'last_posted_user_id' => null,
|
||||
'last_post_id' => null,
|
||||
'last_post_number' => null,
|
||||
'hidden_at' => null,
|
||||
'hidden_user_id' => null,
|
||||
'slug' => $this->faker->slug,
|
||||
'is_private' => 0
|
||||
];
|
||||
}
|
||||
}
|
@@ -18,6 +18,8 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
||||
/**
|
||||
* Used to copy JS files from a package directory to the assets' directory.
|
||||
* Without concatenating them. Primarily used for lazy loading JS modules.
|
||||
*
|
||||
* @method DirectorySource[] getSources()
|
||||
*/
|
||||
class JsDirectoryCompiler implements CompilerInterface
|
||||
{
|
||||
@@ -51,10 +53,6 @@ class JsDirectoryCompiler implements CompilerInterface
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
foreach ($this->getSources() as $source) {
|
||||
$this->eachFile($source, fn (JsCompiler $compiler) => $compiler->getUrl());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,6 @@ use Flarum\Group\Event\Created;
|
||||
use Flarum\Group\Event\Deleted;
|
||||
use Flarum\Group\Event\Renamed;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
@@ -34,7 +33,6 @@ class Group extends AbstractModel
|
||||
{
|
||||
use EventGeneratorTrait;
|
||||
use ScopeVisibilityTrait;
|
||||
use HasFactory;
|
||||
|
||||
const ADMINISTRATOR_ID = 1;
|
||||
const GUEST_ID = 2;
|
||||
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Group;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class GroupFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name_singular' => $singular = $this->faker->word,
|
||||
'name_plural' => $singular.'(s)',
|
||||
'color' => $this->faker->hexColor,
|
||||
'icon' => null,
|
||||
'is_hidden' => false,
|
||||
];
|
||||
}
|
||||
}
|
@@ -14,7 +14,6 @@ use Flarum\Database\AbstractModel;
|
||||
use Flarum\Database\ScopeVisibilityTrait;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -35,7 +34,6 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
class AccessToken extends AbstractModel
|
||||
{
|
||||
use ScopeVisibilityTrait;
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'access_tokens';
|
||||
|
||||
@@ -73,8 +71,6 @@ class AccessToken extends AbstractModel
|
||||
*/
|
||||
private const LAST_ACTIVITY_UPDATE_DIFF = 90;
|
||||
|
||||
public ?array $uniqueKeys = ['token'];
|
||||
|
||||
/**
|
||||
* Generate an access token for the specified user.
|
||||
*/
|
||||
|
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Http;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AccessTokenFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'token' => Str::random(40),
|
||||
'user_id' => User::factory(),
|
||||
'last_activity_at' => null,
|
||||
'type' => 'developer',
|
||||
'title' => $this->faker->sentence,
|
||||
'last_ip_address' => null,
|
||||
'last_user_agent' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -17,7 +17,6 @@ use Flarum\Notification\Notification;
|
||||
use Flarum\Post\Event\Deleted;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Staudenmeir\EloquentEagerLimit\HasEagerLimit;
|
||||
@@ -46,7 +45,6 @@ class Post extends AbstractModel
|
||||
use EventGeneratorTrait;
|
||||
use ScopeVisibilityTrait;
|
||||
use HasEagerLimit;
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'posts';
|
||||
|
||||
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Post;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PostFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'discussion_id' => Discussion::factory(),
|
||||
'number' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => User::factory(),
|
||||
'type' => CommentPost::$type,
|
||||
'content' => $this->faker->paragraph,
|
||||
'edited_at' => null,
|
||||
'edited_user_id' => null,
|
||||
'hidden_at' => null,
|
||||
'hidden_user_id' => null,
|
||||
'ip_address' => null,
|
||||
'is_private' => 0
|
||||
];
|
||||
}
|
||||
}
|
@@ -35,7 +35,6 @@ use Illuminate\Contracts\Filesystem\Factory;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -73,7 +72,6 @@ class User extends AbstractModel
|
||||
use EventGeneratorTrait;
|
||||
use ScopeVisibilityTrait;
|
||||
use HasEagerLimit;
|
||||
use HasFactory;
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\User;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'username' => $this->faker->userName,
|
||||
'email' => $this->faker->safeEmail,
|
||||
'is_email_confirmed' => 1,
|
||||
'password' => $this->faker->password,
|
||||
'avatar_url' => $this->faker->imageUrl,
|
||||
'preferences' => [],
|
||||
'joined_at' => null,
|
||||
'last_seen_at' => null,
|
||||
'marked_all_as_read_at' => null,
|
||||
'read_notifications_at' => null,
|
||||
'discussion_count' => 0,
|
||||
'comment_count' => 0,
|
||||
];
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ namespace Flarum\Tests\integration\admin;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class IndexTest extends TestCase
|
||||
{
|
||||
@@ -23,7 +22,7 @@ class IndexTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser()
|
||||
]
|
||||
]);
|
||||
|
@@ -27,7 +27,7 @@ class AccessTokenLifecycleTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
AccessToken::class => [
|
||||
'access_tokens' => [
|
||||
['token' => 'a', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session'],
|
||||
['token' => 'b', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session_remember'],
|
||||
['token' => 'c', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
|
@@ -9,10 +9,8 @@
|
||||
|
||||
namespace Flarum\Tests\integration\api\access_tokens;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
{
|
||||
@@ -26,11 +24,12 @@ class CreateTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'normal3', 'password' => '$2y$10$LO59tiT7uggl6Oe23o/O6.utnF6ipngYjvMvaxo1TciKqBttDNKim', 'email' => 'normal3@machine.local', 'is_email_confirmed' => 1]
|
||||
],
|
||||
Group::class => [
|
||||
'access_tokens' => [],
|
||||
'groups' => [
|
||||
['id' => 10, 'name_plural' => 'Acme', 'name_singular' => 'Acme']
|
||||
],
|
||||
'group_user' => [
|
||||
|
@@ -10,14 +10,12 @@
|
||||
namespace Flarum\Tests\integration\api\access_tokens;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\DeveloperAccessToken;
|
||||
use Flarum\Http\RememberAccessToken;
|
||||
use Flarum\Http\SessionAccessToken;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class DeleteTest extends TestCase
|
||||
{
|
||||
@@ -31,12 +29,12 @@ class DeleteTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'normal3', 'email' => 'normal3@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'normal4', 'email' => 'normal4@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
AccessToken::class => [
|
||||
'access_tokens' => [
|
||||
['id' => 1, 'token' => 'a', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session'],
|
||||
['id' => 2, 'token' => 'b', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session_remember'],
|
||||
['id' => 3, 'token' => 'c', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
@@ -44,7 +42,7 @@ class DeleteTest extends TestCase
|
||||
['id' => 5, 'token' => 'e', 'user_id' => 2, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session'],
|
||||
['id' => 6, 'token' => 'f', 'user_id' => 3, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 100, 'name_singular' => 'test', 'name_plural' => 'test']
|
||||
],
|
||||
'group_user' => [
|
||||
|
@@ -10,11 +10,9 @@
|
||||
namespace Flarum\Tests\integration\api\access_tokens;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -29,12 +27,12 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'normal3', 'email' => 'normal3@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'normal4', 'email' => 'normal4@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
AccessToken::class => [
|
||||
'access_tokens' => [
|
||||
['id' => 1, 'token' => 'a', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session'],
|
||||
['id' => 2, 'token' => 'b', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session_remember'],
|
||||
['id' => 3, 'token' => 'c', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
@@ -42,7 +40,7 @@ class ListTest extends TestCase
|
||||
['id' => 5, 'token' => 'e', 'user_id' => 2, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
['id' => 6, 'token' => 'f', 'user_id' => 3, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'developer'],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 100, 'name_singular' => 'test', 'name_plural' => 'test']
|
||||
],
|
||||
'group_user' => [
|
||||
|
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Tests\integration\api\access_tokens;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
|
||||
@@ -26,7 +25,7 @@ class RemembererTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
AccessToken::class => [
|
||||
'access_tokens' => [
|
||||
['token' => 'a', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session'],
|
||||
['token' => 'b', 'user_id' => 1, 'last_activity_at' => Carbon::parse('2021-01-01 02:00:00'), 'type' => 'session_remember'],
|
||||
],
|
||||
|
@@ -13,7 +13,6 @@ use Carbon\Carbon;
|
||||
use Flarum\Api\ApiKey;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class WithApiKeyTest extends TestCase
|
||||
{
|
||||
@@ -27,10 +26,10 @@ class WithApiKeyTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
ApiKey::class => [
|
||||
'api_keys' => [
|
||||
['key' => 'mastertoken', 'user_id' => null, 'created_at' => Carbon::now()->toDateTimeString()],
|
||||
['key' => 'personaltoken', 'user_id' => 2, 'created_at' => Carbon::now()->toDateTimeString()],
|
||||
]
|
||||
|
@@ -12,7 +12,6 @@ namespace Flarum\Tests\integration\api\authentication;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class WithTokenTest extends TestCase
|
||||
{
|
||||
@@ -26,7 +25,7 @@ class WithTokenTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
namespace Flarum\Tests\integration\api\csrf_protection;
|
||||
|
||||
use Flarum\Api\ApiKey;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
|
||||
@@ -26,7 +24,7 @@ class RequireCsrfTokenTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
ApiKey::class => [
|
||||
'api_keys' => [
|
||||
['user_id' => 1, 'key' => 'superadmin'],
|
||||
]
|
||||
]);
|
||||
@@ -194,7 +192,7 @@ class RequireCsrfTokenTest extends TestCase
|
||||
public function access_token_does_not_need_csrf_token()
|
||||
{
|
||||
$this->database()->table('access_tokens')->insert(
|
||||
AccessToken::factory()->raw(['token' => 'myaccesstoken', 'user_id' => 1, 'type' => 'developer'])
|
||||
['token' => 'myaccesstoken', 'user_id' => 1, 'type' => 'developer']
|
||||
);
|
||||
|
||||
$response = $this->send(
|
||||
|
@@ -12,7 +12,6 @@ namespace Flarum\Tests\integration\api\discussions;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
@@ -27,7 +26,7 @@ class CreateTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class DeletionTest extends TestCase
|
||||
{
|
||||
@@ -28,13 +25,13 @@ class DeletionTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
@@ -54,7 +51,7 @@ class DeletionTest extends TestCase
|
||||
|
||||
$this->assertEquals(204, $response->getStatusCode());
|
||||
|
||||
// Ensure both the discussion and the corresponding post are deleted
|
||||
// Ensure both the database and the corresponding post are deleted
|
||||
$this->assertNull($this->database()->table('discussions')->find(1), 'Discussion exists in the DB');
|
||||
$this->assertNull($this->database()->table('posts')->find(1), 'Post exists in the DB');
|
||||
}
|
||||
|
@@ -10,8 +10,6 @@
|
||||
namespace Flarum\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
@@ -29,19 +27,19 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'last_posted_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'lightsail in title', 'created_at' => Carbon::createFromDate(1985, 5, 21)->toDateTimeString(), 'last_posted_at' => Carbon::createFromDate(1985, 5, 21)->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'not in title', 'created_at' => Carbon::createFromDate(1995, 5, 21)->toDateTimeString(), 'last_posted_at' => Carbon::createFromDate(1995, 5, 21)->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => 'hidden', 'created_at' => Carbon::createFromDate(2005, 5, 21)->toDateTimeString(), 'last_posted_at' => Carbon::createFromDate(2005, 5, 21)->toDateTimeString(), 'hidden_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::createFromDate(1985, 5, 21)->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1995, 5, 21)->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||
['id' => 4, 'discussion_id' => 4, 'created_at' => Carbon::createFromDate(2005, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -10,8 +10,6 @@
|
||||
namespace Flarum\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -32,24 +30,24 @@ class ListWithFulltextSearchTest extends TestCase
|
||||
// We need to insert these outside of a transaction, because FULLTEXT indexing,
|
||||
// which is needed for search, doesn't happen in transactions.
|
||||
// We clean it up explcitly at the end.
|
||||
$this->database()->table('discussions')->insert($this->rowsThroughFactory(Discussion::class, [
|
||||
['id' => 1, 'title' => 'lightsail in title', 'user_id' => 1],
|
||||
['id' => 2, 'title' => 'lightsail in title too', 'created_at' => Carbon::createFromDate(2020, 01, 01)->toDateTimeString(), 'user_id' => 1],
|
||||
['id' => 3, 'title' => 'not in title either', 'user_id' => 1],
|
||||
['id' => 4, 'title' => 'not in title or text', 'user_id' => 1],
|
||||
['id' => 5, 'title' => 'తెలుగు', 'user_id' => 1],
|
||||
['id' => 6, 'title' => '支持中文吗', 'user_id' => 1],
|
||||
]));
|
||||
$this->database()->table('discussions')->insert([
|
||||
['id' => 1, 'title' => 'lightsail in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'lightsail in title too', 'created_at' => Carbon::createFromDate(2020, 01, 01)->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'not in title either', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => 'not in title or text', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 5, 'title' => 'తెలుగు', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 6, 'title' => '支持中文吗', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
]);
|
||||
|
||||
$this->database()->table('posts')->insert($this->rowsThroughFactory(Post::class, [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'content' => '<t><p>not in text</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 1, 'content' => '<t><p>lightsail in text</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 2, 'user_id' => 1, 'content' => '<t><p>another lightsail for discussion 2!</p></t>'],
|
||||
['id' => 4, 'discussion_id' => 3, 'user_id' => 1, 'content' => '<t><p>just one lightsail for discussion 3.</p></t>'],
|
||||
['id' => 5, 'discussion_id' => 4, 'user_id' => 1, 'content' => '<t><p>not in title or text</p></t>'],
|
||||
['id' => 6, 'discussion_id' => 4, 'user_id' => 1, 'content' => '<t><p>తెలుగు</p></t>'],
|
||||
['id' => 7, 'discussion_id' => 2, 'user_id' => 1, 'content' => '<t><p>支持中文吗</p></t>'],
|
||||
]));
|
||||
$this->database()->table('posts')->insert([
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>another lightsail for discussion 2!</p></t>'],
|
||||
['id' => 4, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>just one lightsail for discussion 3.</p></t>'],
|
||||
['id' => 5, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>not in title or text</p></t>'],
|
||||
['id' => 6, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>తెలుగు</p></t>'],
|
||||
['id' => 7, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>支持中文吗</p></t>'],
|
||||
]);
|
||||
|
||||
// We need to call these again, since we rolled back the transaction started by `::app()`.
|
||||
$this->database()->beginTransaction();
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Tests\integration\api\discussions;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ShowTest extends TestCase
|
||||
@@ -29,17 +26,17 @@ class ShowTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'Empty discussion', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => null, 'comment_count' => 0, 'is_private' => 0],
|
||||
['id' => 2, 'title' => 'Discussion with post', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 1, 'is_private' => 0],
|
||||
['id' => 3, 'title' => 'Private discussion', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => null, 'comment_count' => 0, 'is_private' => 1],
|
||||
['id' => 4, 'title' => 'Discussion with hidden post', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 2, 'comment_count' => 1, 'is_private' => 0],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>a normal reply - too-obscure</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>a hidden reply - too-obscure</p></t>', 'hidden_at' => Carbon::now()->toDateTimeString()],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -11,7 +11,6 @@ namespace Flarum\Tests\integration\api\forum;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ShowTest extends TestCase
|
||||
@@ -26,7 +25,7 @@ class ShowTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -12,7 +12,6 @@ namespace Flarum\Tests\integration\api\groups;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
@@ -27,7 +26,7 @@ class CreateTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Flarum\Tests\integration\api\groups;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -26,7 +25,7 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
$this->hiddenGroup(),
|
||||
],
|
||||
]);
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Flarum\Tests\integration\api\groups;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -26,7 +25,7 @@ class ShowTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
$this->hiddenGroup(),
|
||||
],
|
||||
]);
|
||||
|
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Tests\integration\api\notifications;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
@@ -27,20 +26,20 @@ class DeleteTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'Test Discussion', 'user_id' => 2, 'comment_count' => 1],
|
||||
['id' => 2, 'title' => 'Test Discussion', 'user_id' => 2, 'comment_count' => 1],
|
||||
['id' => 3, 'title' => 'Test Discussion', 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => 'Test Discussion', 'user_id' => 1, 'comment_count' => 1],
|
||||
],
|
||||
'notifications' => [
|
||||
['id' => 1, 'user_id' => 1, 'type' => 'discussionRenamed', 'subject_id' => 1, 'from_user_id' => 2, 'read_at' => Carbon::now(), 'created_at' => Carbon::now()],
|
||||
['id' => 2, 'user_id' => 1, 'type' => 'discussionRenamed', 'subject_id' => 2, 'from_user_id' => 2, 'read_at' => null, 'created_at' => Carbon::now()],
|
||||
['id' => 3, 'user_id' => 2, 'type' => 'discussionRenamed', 'subject_id' => 3, 'from_user_id' => 1, 'read_at' => Carbon::now(), 'created_at' => Carbon::now()],
|
||||
['id' => 4, 'user_id' => 2, 'type' => 'discussionRenamed', 'subject_id' => 4, 'from_user_id' => 1, 'read_at' => null, 'created_at' => Carbon::now()],
|
||||
['id' => 1, 'user_id' => 1, 'type' => 'discussionRenamed', 'subject_id' => 1, 'from_user_id' => 2, 'read_at' => Carbon::now()],
|
||||
['id' => 2, 'user_id' => 1, 'type' => 'discussionRenamed', 'subject_id' => 2, 'from_user_id' => 2, 'read_at' => null],
|
||||
['id' => 3, 'user_id' => 2, 'type' => 'discussionRenamed', 'subject_id' => 3, 'from_user_id' => 1, 'read_at' => Carbon::now()],
|
||||
['id' => 4, 'user_id' => 2, 'type' => 'discussionRenamed', 'subject_id' => 4, 'from_user_id' => 1, 'read_at' => null],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ namespace Flarum\Tests\integration\api\notifications;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class ListTest extends TestCase
|
||||
{
|
||||
@@ -25,7 +24,7 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -10,12 +10,9 @@
|
||||
namespace Flarum\Tests\integration\api\posts;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
{
|
||||
@@ -29,19 +26,19 @@ class CreateTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 1],
|
||||
// Discussion with deleted first post.
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => null],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'number' => 1, 'created_at' => Carbon::now()->subDay()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t></t>'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'restricted', 'email' => 'restricted@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
['id' => 40, 'name_singular' => 'tess', 'name_plural' => 'tess'],
|
||||
],
|
||||
'group_user' => [
|
||||
|
@@ -10,12 +10,9 @@
|
||||
namespace Flarum\Tests\integration\api\posts;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Discussion\UserState;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class DeleteTest extends TestCase
|
||||
{
|
||||
@@ -29,14 +26,14 @@ class DeleteTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'acme2', 'email' => 'acme2@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 5, 'last_post_number' => 5, 'last_post_id' => 10],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 5, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 1],
|
||||
['id' => 6, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 2],
|
||||
['id' => 7, 'discussion_id' => 3, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 3],
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Tests\integration\api\posts;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -26,18 +23,18 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 2],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 2],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'number' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 2, 'number' => 1, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 3, 'number' => 2, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 4, 'number' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>something</p></t>'],
|
||||
['id' => 5, 'number' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now(), 'user_id' => 2, 'type' => 'discussionRenamed', 'content' => '<t><p>something</p></t>'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -10,11 +10,8 @@
|
||||
namespace Flarum\Tests\integration\api\posts;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class ShowTest extends TestCase
|
||||
{
|
||||
@@ -28,14 +25,14 @@ class ShowTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
Discussion::class => [
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => 'Discussion with post', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 1, 'is_private' => 0],
|
||||
],
|
||||
Post::class => [
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>valid</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<tMALFORMED'],
|
||||
],
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
]
|
||||
]);
|
||||
|
@@ -11,7 +11,6 @@ namespace Flarum\Tests\integration\api\settings;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class SetTest extends TestCase
|
||||
{
|
||||
@@ -25,7 +24,7 @@ class SetTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
@@ -22,7 +22,7 @@ class DeleteTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'ken', 'is_email_confirmed' => 1],
|
||||
],
|
||||
|
@@ -9,10 +9,8 @@
|
||||
|
||||
namespace Flarum\Tests\integration\api\users;
|
||||
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class GroupSearchTest extends TestCase
|
||||
{
|
||||
@@ -23,7 +21,7 @@ class GroupSearchTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
@@ -245,7 +243,7 @@ class GroupSearchTest extends TestCase
|
||||
private function createMultipleUsersAndGroups()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
[
|
||||
'id' => 4,
|
||||
'username' => 'normal4',
|
||||
@@ -268,7 +266,7 @@ class GroupSearchTest extends TestCase
|
||||
'is_email_confirmed' => 1,
|
||||
],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
[
|
||||
'id' => 5,
|
||||
'name_singular' => 'test1 user',
|
||||
@@ -302,7 +300,7 @@ class GroupSearchTest extends TestCase
|
||||
private function createHiddenUser()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
[
|
||||
'id' => 3,
|
||||
'username' => 'normal2',
|
||||
@@ -311,7 +309,7 @@ class GroupSearchTest extends TestCase
|
||||
'is_email_confirmed' => 1,
|
||||
],
|
||||
],
|
||||
Group::class => [
|
||||
'groups' => [
|
||||
[
|
||||
'id' => 99,
|
||||
'name_singular' => 'hidden user',
|
||||
|
@@ -11,7 +11,6 @@ namespace Flarum\Tests\integration\api\users;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListTest extends TestCase
|
||||
@@ -26,7 +25,7 @@ class ListTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
User::class => [
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
],
|
||||
]);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user