Skip to content

Commit 371033a

Browse files
committed
Merge branch 'master' into docker-tests
2 parents a0c605f + 06706a2 commit 371033a

File tree

313 files changed

+8830
-2826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+8830
-2826
lines changed

.env.example.complete

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ LDAP_DN=false
195195
LDAP_PASS=false
196196
LDAP_USER_FILTER=false
197197
LDAP_VERSION=false
198+
LDAP_START_TLS=false
198199
LDAP_TLS_INSECURE=false
199200
LDAP_ID_ATTRIBUTE=uid
200201
LDAP_EMAIL_ATTRIBUTE=mail
@@ -245,10 +246,15 @@ AVATAR_URL=
245246
DRAWIO=true
246247

247248
# Default item listing view
248-
# Used for public visitors and user's without a preference
249-
# Can be 'list' or 'grid'
249+
# Used for public visitors and user's without a preference.
250+
# Can be 'list' or 'grid'.
250251
APP_VIEWS_BOOKS=list
251252
APP_VIEWS_BOOKSHELVES=grid
253+
APP_VIEWS_BOOKSHELF=grid
254+
255+
# Use dark mode by default
256+
# Will be overriden by any user/session preference.
257+
APP_DEFAULT_DARK_MODE=false
252258

253259
# Page revision limit
254260
# Number of page revisions to keep in the system before deleting old revisions.

.github/workflows/phpunit.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- master
77
- release
8+
- gh_actions_update
89
pull_request:
910
branches:
1011
- '*'
@@ -13,13 +14,19 @@ on:
1314

1415
jobs:
1516
build:
16-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1718
strategy:
1819
matrix:
19-
php: [7.2, 7.4]
20+
php: ['7.3', '7.4', '8.0']
2021
steps:
2122
- uses: actions/checkout@v1
2223

24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: gd, mbstring, json, curl, xml, mysql, ldap
29+
2330
- name: Get Composer Cache Directory
2431
id: composer-cache
2532
run: |
@@ -38,7 +45,7 @@ jobs:
3845
- name: Setup Database
3946
run: |
4047
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS `bookstack-test`;'
41-
mysql -uroot -proot -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED BY 'bookstack-test';"
48+
mysql -uroot -proot -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bookstack-test';"
4249
mysql -uroot -proot -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';"
4350
mysql -uroot -proot -e 'FLUSH PRIVILEGES;'
4451

.github/workflows/test-migrations.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- master
77
- release
8+
- gh_actions_update
89
pull_request:
910
branches:
1011
- '*'
@@ -13,13 +14,19 @@ on:
1314

1415
jobs:
1516
build:
16-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1718
strategy:
1819
matrix:
19-
php: [7.2, 7.4]
20+
php: ['7.3', '7.4', '8.0']
2021
steps:
2122
- uses: actions/checkout@v1
2223

24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: gd, mbstring, json, curl, xml, mysql, ldap
29+
2330
- name: Get Composer Cache Directory
2431
id: composer-cache
2532
run: |
@@ -38,7 +45,7 @@ jobs:
3845
- name: Create database & user
3946
run: |
4047
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS `bookstack-test`;'
41-
mysql -uroot -proot -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED BY 'bookstack-test';"
48+
mysql -uroot -proot -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bookstack-test';"
4249
mysql -uroot -proot -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';"
4350
mysql -uroot -proot -e 'FLUSH PRIVILEGES;'
4451

app/Actions/Activity.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use BookStack\Entities\Models\Entity;
77
use BookStack\Model;
88
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9+
use Illuminate\Database\Eloquent\Relations\MorphTo;
910
use Illuminate\Support\Str;
1011

1112
/**
@@ -23,7 +24,7 @@ class Activity extends Model
2324
/**
2425
* Get the entity for this activity.
2526
*/
26-
public function entity()
27+
public function entity(): MorphTo
2728
{
2829
if ($this->entity_type === '') {
2930
$this->entity_type = null;

app/Actions/ActivityService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function removeEntity(Entity $entity)
7878
public function latest(int $count = 20, int $page = 0): array
7979
{
8080
$activityList = $this->permissionService
81-
->filterRestrictedEntityRelations($this->activity, 'activities', 'entity_id', 'entity_type')
81+
->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')
8282
->orderBy('created_at', 'desc')
8383
->with(['user', 'entity'])
8484
->skip($count * $page)
@@ -131,7 +131,7 @@ public function entityActivity(Entity $entity, int $count = 20, int $page = 1):
131131
public function userActivity(User $user, int $count = 20, int $page = 0): array
132132
{
133133
$activityList = $this->permissionService
134-
->filterRestrictedEntityRelations($this->activity, 'activities', 'entity_id', 'entity_type')
134+
->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')
135135
->orderBy('created_at', 'desc')
136136
->where('user_id', '=', $user->id)
137137
->skip($count * $page)

app/Actions/ActivityType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ class ActivityType
4848
const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update';
4949
const AUTH_LOGIN = 'auth_login';
5050
const AUTH_REGISTER = 'auth_register';
51-
}
51+
}

app/Actions/TagRepo.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function __construct(Tag $tag, PermissionService $ps)
2626
*/
2727
public function getNameSuggestions(?string $searchTerm): Collection
2828
{
29-
$query = $this->tag->select('*', DB::raw('count(*) as count'))->groupBy('name');
29+
$query = $this->tag->newQuery()
30+
->select('*', DB::raw('count(*) as count'))
31+
->groupBy('name');
3032

3133
if ($searchTerm) {
3234
$query = $query->where('name', 'LIKE', $searchTerm . '%')->orderBy('name', 'desc');
@@ -45,7 +47,9 @@ public function getNameSuggestions(?string $searchTerm): Collection
4547
*/
4648
public function getValueSuggestions(?string $searchTerm, ?string $tagName): Collection
4749
{
48-
$query = $this->tag->select('*', DB::raw('count(*) as count'))->groupBy('value');
50+
$query = $this->tag->newQuery()
51+
->select('*', DB::raw('count(*) as count'))
52+
->groupBy('value');
4953

5054
if ($searchTerm) {
5155
$query = $query->where('value', 'LIKE', $searchTerm . '%')->orderBy('value', 'desc');

app/Actions/ViewService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getPopular(int $count = 10, int $page = 0, array $filterModels =
6565
{
6666
$skipCount = $count * $page;
6767
$query = $this->permissionService
68-
->filterRestrictedEntityRelations($this->view, 'views', 'viewable_id', 'viewable_type', $action)
68+
->filterRestrictedEntityRelations($this->view->newQuery(), 'views', 'viewable_id', 'viewable_type', $action)
6969
->select('*', 'viewable_id', 'viewable_type', DB::raw('SUM(views) as view_count'))
7070
->groupBy('viewable_id', 'viewable_type')
7171
->orderBy('view_count', 'desc');

app/Api/ApiDocsGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,4 @@ protected function getFlatApiRoutes(): Collection
142142
];
143143
});
144144
}
145-
146-
}
145+
}

app/Api/ApiTokenGuard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ public function logout()
163163
{
164164
$this->user = null;
165165
}
166-
}
166+
}

0 commit comments

Comments
 (0)