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 App;
use View; use View;
use Utils; use Utils;
use Parsedown;
use App\Models\User; use App\Models\User;
use App\Models\Texture; use App\Models\Texture;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -23,7 +24,8 @@ class UserController extends Controller
'statistics' => [ 'statistics' => [
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')), 'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')) '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('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class); $this->app->singleton('users', \App\Services\Repositories\UserRepository::class);
$this->app->singleton('parsedown', \Parsedown::class);
Blade::if('admin', function (User $user) { Blade::if('admin', function (User $user) {
return $user->isAdmin(); 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')) { if (! function_exists('bs_nickname')) {
function bs_nickname(User $user = null) function bs_nickname(User $user = null)

View File

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

View File

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