1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Organised activity types and moved most to repos

Repos are generally better since otherwise we end up duplicating
things between front-end and API.

Types moved to by CONST values within a class for better visibilty
of usage and listing of types.
This commit is contained in:
Dan Brown
2020-11-07 22:37:27 +00:00
parent 4824ef2760
commit c157dc3490
19 changed files with 76 additions and 73 deletions

View File

@ -1,5 +1,6 @@
<?php namespace Tests;
use BookStack\Actions\ActivityType;
use BookStack\Actions\Comment;
use BookStack\Actions\CommentRepo;
use BookStack\Auth\Permissions\JointPermission;
@ -37,7 +38,7 @@ class CommandsTest extends TestCase
{
$this->asEditor();
$page = Page::first();
\Activity::add($page, 'page_update', $page->book->id);
\Activity::add($page, ActivityType::PAGE_UPDATE, $page->book->id);
$this->assertDatabaseHas('activities', [
'key' => 'page_update',

View File

@ -1,6 +1,7 @@
<?php namespace Tests\User;
use Activity;
use BookStack\Actions\ActivityType;
use BookStack\Auth\User;
use BookStack\Entities\Bookshelf;
use Tests\BrowserKitTest;
@ -60,8 +61,8 @@ class UserProfileTest extends BrowserKitTest
$newUser = $this->getNewBlankUser();
$this->actingAs($newUser);
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
Activity::add($entities['book'], 'book_update', $entities['book']->id);
Activity::add($entities['page'], 'page_create', $entities['book']->id);
Activity::add($entities['book'], ActivityType::BOOK_UPDATE, $entities['book']->id);
Activity::add($entities['page'], ActivityType::PAGE_CREATE, $entities['book']->id);
$this->asAdmin()->visit('/user/' . $newUser->id)
->seeInElement('#recent-user-activity', 'updated book')
@ -74,8 +75,8 @@ class UserProfileTest extends BrowserKitTest
$newUser = $this->getNewBlankUser();
$this->actingAs($newUser);
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
Activity::add($entities['book'], 'book_update', $entities['book']->id);
Activity::add($entities['page'], 'page_create', $entities['book']->id);
Activity::add($entities['book'], ActivityType::BOOK_UPDATE, $entities['book']->id);
Activity::add($entities['page'], ActivityType::PAGE_CREATE, $entities['book']->id);
$this->asAdmin()->visit('/')->clickInElement('#recent-activity', $newUser->name)
->seePageIs('/user/' . $newUser->id)