From b4dcc025207439ee205cca5349cf4e3ceace59f8 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 24 Jun 2015 09:13:54 +0930 Subject: [PATCH] Give author permission to delete discussion if there are no replies Forgot to commit this part in 64e5d505332c6ba1569bbb9140107b1afd19e334 :3 --- src/Core/CoreServiceProvider.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Core/CoreServiceProvider.php b/src/Core/CoreServiceProvider.php index 6f63cd6de..5799d140b 100644 --- a/src/Core/CoreServiceProvider.php +++ b/src/Core/CoreServiceProvider.php @@ -247,5 +247,12 @@ class CoreServiceProvider extends ServiceProvider // @todo add limitations to time etc. according to a config setting } }); + + Discussion::allow('delete', function ($discussion, $user) { + if ($discussion->start_user_id == $user->id && $discussion->participants_count == 1) { + return true; + // @todo add limitations to time etc. according to a config setting + } + }); } }