Remove bs_announcement function and parsedown

This commit is contained in:
Pig Fang 2018-07-22 16:32:34 +08:00
parent d05cd4aab2
commit e60d73b410
5 changed files with 5 additions and 12 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App;
use View;
use Utils;
use Parsedown;
use App\Models\User;
use App\Models\Texture;
use Illuminate\Http\Request;
@ -23,7 +24,8 @@ class UserController extends Controller
'statistics' => [
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage'))
]
],
'announcement' => (new Parsedown())->text(option_localized('announcement'))
]);
}

View File

@ -59,7 +59,6 @@ class AppServiceProvider extends ServiceProvider
{
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class);
$this->app->singleton('parsedown', \Parsedown::class);
Blade::if('admin', function (User $user) {
return $user->isAdmin();

View File

@ -264,14 +264,6 @@ if (! function_exists('bs_custom_copyright')) {
}
}
if (! function_exists('bs_announcement')) {
function bs_announcement()
{
return app('parsedown')->text(option_localized('announcement'));
}
}
if (! function_exists('bs_nickname')) {
function bs_nickname(User $user = null)

View File

@ -96,7 +96,7 @@
<h3 class="box-title">@lang('user.announcement')</h3>
</div><!-- /.box-header -->
<div class="box-body">
{!! bs_announcement() !!}
{!! $announcement !!}
</div><!-- /.box-body -->
</div>
</div>

View File

@ -22,7 +22,7 @@ class UserControllerTest extends TestCase
->assertViewHas('statistics')
->assertSee((string) (1 / $players_count * 100)) // Players
->assertSee('0') // Storage
->assertSee(bs_announcement())
->assertSee((new Parsedown())->text(option_localized('announcement')))
->assertSee((string) $user->score);
}