diff --git a/app/Auth/Permissions/PermissionService.php b/app/Auth/Permissions/PermissionService.php index d858a7c18..89c8a5fbb 100644 --- a/app/Auth/Permissions/PermissionService.php +++ b/app/Auth/Permissions/PermissionService.php @@ -533,7 +533,8 @@ class PermissionService $allPermission = $this->currentUser() && $this->currentUser()->can($permission . '-all'); $ownPermission = $this->currentUser() && $this->currentUser()->can($permission . '-own'); $this->currentAction = 'view'; - $isOwner = $this->currentUser() && $this->currentUser()->id === $ownable->created_by; + $ownerField = ($ownable instanceof Entity) ? 'owned_by' : 'created_by'; + $isOwner = $this->currentUser() && $this->currentUser()->id === $ownable->$ownerField; return ($allPermission || ($isOwner && $ownPermission)); } diff --git a/app/Entities/Repos/PageRepo.php b/app/Entities/Repos/PageRepo.php index 721485b11..9ca254f1e 100644 --- a/app/Entities/Repos/PageRepo.php +++ b/app/Entities/Repos/PageRepo.php @@ -210,10 +210,10 @@ class PageRepo } $pageContent = new PageContent($page); - if (isset($input['html'])) { - $pageContent->setNewHTML($input['html']); - } else { + if (isset($input['markdown'])) { $pageContent->setNewMarkdown($input['markdown']); + } else { + $pageContent->setNewHTML($input['html']); } } diff --git a/resources/lang/es_AR/entities.php b/resources/lang/es_AR/entities.php index d88bea1ab..093641a36 100644 --- a/resources/lang/es_AR/entities.php +++ b/resources/lang/es_AR/entities.php @@ -210,7 +210,7 @@ return [ 'pages_revisions' => 'Revisiones de página', 'pages_revisions_named' => 'Revisiones de página para :pageName', 'pages_revision_named' => 'Revisión de ágina para :pageName', - 'pages_revision_restored_from' => 'Restored from #:id; :summary', + 'pages_revision_restored_from' => 'Restaurado de #:id; :summary', 'pages_revisions_created_by' => 'Creado por', 'pages_revisions_date' => 'Fecha de revisión', 'pages_revisions_number' => '#', diff --git a/resources/lang/fr/entities.php b/resources/lang/fr/entities.php index 54f204d58..72711bcb5 100644 --- a/resources/lang/fr/entities.php +++ b/resources/lang/fr/entities.php @@ -22,7 +22,7 @@ return [ 'meta_created_name' => 'Créé :timeLength par :user', 'meta_updated' => 'Mis à jour :timeLength', 'meta_updated_name' => 'Mis à jour :timeLength par :user', - 'meta_owned_name' => 'Owned by :user', + 'meta_owned_name' => 'Possédé par :user', 'entity_select' => 'Sélectionner l\'entité', 'images' => 'Images', 'my_recent_drafts' => 'Mes brouillons récents', @@ -40,7 +40,7 @@ return [ 'permissions_intro' => 'Une fois activées ces permissions prendront la priorité sur tous les sets de permissions préexistants.', 'permissions_enable' => 'Activer les permissions personnalisées', 'permissions_save' => 'Enregistrer les permissions', - 'permissions_owner' => 'Owner', + 'permissions_owner' => 'Propriétaire', // Search 'search_results' => 'Résultats de recherche', @@ -210,7 +210,7 @@ return [ 'pages_revisions' => 'Révisions de la page', 'pages_revisions_named' => 'Révisions pour :pageName', 'pages_revision_named' => 'Révision pour :pageName', - 'pages_revision_restored_from' => 'Restored from #:id; :summary', + 'pages_revision_restored_from' => 'Restauré à partir de #:id; :summary', 'pages_revisions_created_by' => 'Créé par', 'pages_revisions_date' => 'Date de révision', 'pages_revisions_number' => '#', diff --git a/resources/lang/fr/settings.php b/resources/lang/fr/settings.php index 9f6eca9ea..89e2f0ca5 100644 --- a/resources/lang/fr/settings.php +++ b/resources/lang/fr/settings.php @@ -175,10 +175,10 @@ return [ 'users_delete_named' => 'Supprimer l\'utilisateur :userName', 'users_delete_warning' => 'Ceci va supprimer \':userName\' du système.', 'users_delete_confirm' => 'Êtes-vous sûr(e) de vouloir supprimer cet utilisateur ?', - 'users_migrate_ownership' => 'Migrate Ownership', - 'users_migrate_ownership_desc' => 'Select a user here if you want another user to become the owner of all items currently owned by this user.', - 'users_none_selected' => 'No user selected', - 'users_delete_success' => 'User successfully removed', + 'users_migrate_ownership' => 'Migré propriété', + 'users_migrate_ownership_desc' => 'Sélectionnez un utilisateur ici si vous voulez qu\'un autre utilisateur devienne le propriétaire de tous les éléments actuellement détenus par cet utilisateur.', + 'users_none_selected' => 'Aucun utilisateur n\'a été séléctionné', + 'users_delete_success' => 'Utilisateur supprimé avec succès', 'users_edit' => 'Modifier l\'utilisateur', 'users_edit_profile' => 'Modifier le profil', 'users_edit_success' => 'Utilisateur mis à jour avec succès', @@ -239,7 +239,7 @@ return [ 'ja' => '日本語', 'ko' => '한국어', 'nl' => 'Nederlands', - 'nb' => 'Norsk (Bokmål)', + 'nb' => 'Norvegien', 'pl' => 'Polski', 'pt_BR' => 'Português do Brasil', 'ru' => 'Русский', diff --git a/resources/lang/zh_CN/entities.php b/resources/lang/zh_CN/entities.php index 40bd546f2..986476119 100644 --- a/resources/lang/zh_CN/entities.php +++ b/resources/lang/zh_CN/entities.php @@ -22,7 +22,7 @@ return [ 'meta_created_name' => '由 :user 创建于 :timeLength', 'meta_updated' => '更新于 :timeLength', 'meta_updated_name' => '由 :user 更新于 :timeLength', - 'meta_owned_name' => 'Owned by :user', + 'meta_owned_name' => '拥有者 :user', 'entity_select' => '实体选择', 'images' => '图片', 'my_recent_drafts' => '我最近的草稿', @@ -40,7 +40,7 @@ return [ 'permissions_intro' => '本设置优先于每个用户角色本身所具有的权限。', 'permissions_enable' => '启用自定义权限', 'permissions_save' => '保存权限', - 'permissions_owner' => 'Owner', + 'permissions_owner' => '拥有者', // Search 'search_results' => '搜索结果', @@ -210,7 +210,7 @@ return [ 'pages_revisions' => '页面修订', 'pages_revisions_named' => '“:pageName”页面修订', 'pages_revision_named' => '“:pageName”页面修订', - 'pages_revision_restored_from' => 'Restored from #:id; :summary', + 'pages_revision_restored_from' => '从 #:id; :summary 恢复', 'pages_revisions_created_by' => '创建者', 'pages_revisions_date' => '修订日期', 'pages_revisions_number' => '#', @@ -308,7 +308,7 @@ return [ 'comment_deleted_success' => '评论已删除', 'comment_created_success' => '评论已添加', 'comment_updated_success' => '评论已更新', - 'comment_delete_confirm' => '你确定要删除这条评论?', + 'comment_delete_confirm' => '您确定要删除这条评论?', 'comment_in_reply_to' => '回复 :commentId', // Revision diff --git a/resources/lang/zh_CN/settings.php b/resources/lang/zh_CN/settings.php index 0b8e0d587..5d58ace2c 100755 --- a/resources/lang/zh_CN/settings.php +++ b/resources/lang/zh_CN/settings.php @@ -79,13 +79,13 @@ return [ 'maint_send_test_email_success' => '电子邮件已发送至 :address', 'maint_send_test_email_mail_subject' => '测试电子邮件', 'maint_send_test_email_mail_greeting' => '邮件发送功能看起来工作正常!', - 'maint_send_test_email_mail_text' => '恭喜!您收到了此邮件通知,你的电子邮件设置看起来配置正确。', - 'maint_recycle_bin_desc' => '被删除的书架、书籍、章节和页面会被存入回收站,你可以还原或永久删除它们。回收站中的较旧项目可能会在系统设置的一段时间后自动删除。', + 'maint_send_test_email_mail_text' => '恭喜!您收到了此邮件通知,您的电子邮件设置看起来已配置正确。', + 'maint_recycle_bin_desc' => '被删除的书架、书籍、章节和页面会被存入回收站,您可以还原或永久删除它们。回收站中较旧的项目可能会在系统设置的一段时间后被自动删除。', 'maint_recycle_bin_open' => '打开回收站', // Recycle Bin 'recycle_bin' => '回收站', - 'recycle_bin_desc' => '在这里,您可以还原已删除的项目,或选择将其从系统中永久删除。与系统中应用了权限过滤器的类似活动列表不同,这个表是未经过滤的。', + 'recycle_bin_desc' => '在这里,您可以还原已删除的项目,或选择将其从系统中永久删除。与系统中过滤过的类似的活动记录不同,这个表会显示所有操作。', 'recycle_bin_deleted_item' => '被删除的项目', 'recycle_bin_deleted_by' => '删除者', 'recycle_bin_deleted_at' => '删除时间', @@ -104,7 +104,7 @@ return [ // Audit Log 'audit' => '审核日志', - 'audit_desc' => '该审核日志显示系统中跟踪的活动列表。与系统中应用了权限过滤器的类似活动列表不同,这个表是未经过滤的。', + 'audit_desc' => '这份审核日志显示所有被系统跟踪的活动。与系统中过滤过的类似的活动记录不同,这个表会显示所有操作。', 'audit_event_filter' => '事件过滤器', 'audit_event_filter_no_filter' => '无过滤器', 'audit_deleted_item' => '被删除的项目', @@ -175,10 +175,10 @@ return [ 'users_delete_named' => '删除用户 :userName', 'users_delete_warning' => '这将从系统中完全删除名为 \':userName\' 的用户。', 'users_delete_confirm' => '您确定要删除这个用户?', - 'users_migrate_ownership' => 'Migrate Ownership', - 'users_migrate_ownership_desc' => 'Select a user here if you want another user to become the owner of all items currently owned by this user.', - 'users_none_selected' => 'No user selected', - 'users_delete_success' => 'User successfully removed', + 'users_migrate_ownership' => '迁移拥有权', + 'users_migrate_ownership_desc' => '如果您想要当前用户拥有的全部项目转移到另一个用户(更改拥有者),请在此处选择一个用户。', + 'users_none_selected' => '没有选中用户', + 'users_delete_success' => '已成功移除用户', 'users_edit' => '编辑用户', 'users_edit_profile' => '编辑资料', 'users_edit_success' => '用户更新成功', @@ -239,7 +239,7 @@ return [ 'ja' => '日本語', 'ko' => '한국어', 'nl' => 'Nederlands', - 'nb' => 'Norsk (Bokmål)', + 'nb' => '挪威语 (Bokmål)', 'pl' => 'Polski', 'pt_BR' => 'Português do Brasil', 'ru' => 'Русский', diff --git a/resources/sass/_tables.scss b/resources/sass/_tables.scss index f41ebd0c4..315f979f3 100644 --- a/resources/sass/_tables.scss +++ b/resources/sass/_tables.scss @@ -28,6 +28,7 @@ table.table { padding: $-s $-s; vertical-align: middle; margin: 0; + overflow: visible; } th { font-weight: bold; diff --git a/resources/views/settings/recycle-bin/index.blade.php b/resources/views/settings/recycle-bin/index.blade.php index 657b45af9..7713945f0 100644 --- a/resources/views/settings/recycle-bin/index.blade.php +++ b/resources/views/settings/recycle-bin/index.blade.php @@ -41,10 +41,10 @@ - - - - + + + + @if(count($deletions) === 0) diff --git a/tests/Entity/PageTest.php b/tests/Entity/PageTest.php index 887dfe8af..a49c8af20 100644 --- a/tests/Entity/PageTest.php +++ b/tests/Entity/PageTest.php @@ -1,10 +1,40 @@ setSettings(['app-editor' => 'markdown']); + $book = Book::query()->first(); + + $this->asEditor()->get($book->getUrl('/create-page')); + $draft = Page::query()->where('book_id', '=', $book->id) + ->where('draft', '=', true)->first(); + + $details = [ + 'markdown' => '# a title', + 'html' => '

a title

', + 'name' => 'my page', + ]; + $resp = $this->post($book->getUrl("/draft/{$draft->id}"), $details); + $resp->assertRedirect(); + + $this->assertDatabaseHas('pages', [ + 'markdown' => $details['markdown'], + 'name' => $details['name'], + 'id' => $draft->id, + 'draft' => false + ]); + + $draft->refresh(); + $resp = $this->get($draft->getUrl("/edit")); + $resp->assertSee("# a title"); + } + public function test_page_delete() { $page = Page::query()->first(); diff --git a/tests/Permissions/RolesTest.php b/tests/Permissions/RolesTest.php index 3397ef429..8398d0828 100644 --- a/tests/Permissions/RolesTest.php +++ b/tests/Permissions/RolesTest.php @@ -216,15 +216,23 @@ class RolesTest extends BrowserKitTest { $otherUsersPage = Page::first(); $content = $this->createEntityChainBelongingToUser($this->user); + + // Set a different creator on the page we're checking to ensure + // that the owner fields are checked + $page = $content['page']; /** @var Page $page */ + $page->created_by = $otherUsersPage->id; + $page->owned_by = $this->user->id; + $page->save(); + // Check can't restrict other's content $this->actingAs($this->user)->visit($otherUsersPage->getUrl()) ->dontSee('Permissions') ->visit($otherUsersPage->getUrl() . '/permissions') ->seePageIs('/'); // Check can't restrict own content - $this->actingAs($this->user)->visit($content['page']->getUrl()) + $this->actingAs($this->user)->visit($page->getUrl()) ->dontSee('Permissions') - ->visit($content['page']->getUrl() . '/permissions') + ->visit($page->getUrl() . '/permissions') ->seePageIs('/'); $this->giveUserPermissions($this->user, ['restrictions-manage-own']); @@ -235,10 +243,10 @@ class RolesTest extends BrowserKitTest ->visit($otherUsersPage->getUrl() . '/permissions') ->seePageIs('/'); // Check can restrict own content - $this->actingAs($this->user)->visit($content['page']->getUrl()) + $this->actingAs($this->user)->visit($page->getUrl()) ->see('Permissions') ->click('Permissions') - ->seePageIs($content['page']->getUrl() . '/permissions'); + ->seePageIs($page->getUrl() . '/permissions'); } /**
{{ trans('settings.recycle_bin_deleted_item') }}{{ trans('settings.recycle_bin_deleted_by') }}{{ trans('settings.recycle_bin_deleted_at') }}{{ trans('settings.recycle_bin_deleted_item') }}{{ trans('settings.recycle_bin_deleted_by') }}{{ trans('settings.recycle_bin_deleted_at') }}