X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/712ccd23c4738e6a59a10f31ff654743fbc61879..refs/pull/2393/head:/app/Actions/Activity.php diff --git a/app/Actions/Activity.php b/app/Actions/Activity.php index 63eda5917..9d256c9b2 100644 --- a/app/Actions/Activity.php +++ b/app/Actions/Activity.php @@ -3,9 +3,10 @@ namespace BookStack\Actions; use BookStack\Auth\User; -use BookStack\Entities\Entity; +use BookStack\Entities\Models\Entity; use BookStack\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Support\Str; /** * @property string $type @@ -46,6 +47,16 @@ class Activity extends Model return trans('activities.' . $this->type); } + /** + * Check if this activity is intended to be for an entity. + */ + public function isForEntity(): bool + { + return Str::startsWith($this->type, [ + 'page_', 'chapter_', 'book_', 'bookshelf_' + ]); + } + /** * Checks if another Activity matches the general information of another. */