parsedown -> commonmark
This commit is contained in:
parent
d75a7d3ead
commit
8f731e9031
@ -6,7 +6,7 @@ use App\Models\User;
|
|||||||
use App\Notifications;
|
use App\Notifications;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Parsedown;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
|
|
||||||
class NotificationsController extends Controller
|
class NotificationsController extends Controller
|
||||||
{
|
{
|
||||||
@ -63,11 +63,11 @@ class NotificationsController extends Controller
|
|||||||
});
|
});
|
||||||
$notification->markAsRead();
|
$notification->markAsRead();
|
||||||
|
|
||||||
$parsedown = new Parsedown();
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'title' => $notification->data['title'],
|
'title' => $notification->data['title'],
|
||||||
'content' => $parsedown->text($notification->data['content']),
|
'content' => $converter->convertToHtml($notification->data['content']),
|
||||||
'time' => $notification->created_at->toDateTimeString(),
|
'time' => $notification->created_at->toDateTimeString(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use App\Services\Unzip;
|
|||||||
use Composer\CaBundle\CaBundle;
|
use Composer\CaBundle\CaBundle;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Parsedown;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
|
|
||||||
class PluginController extends Controller
|
class PluginController extends Controller
|
||||||
{
|
{
|
||||||
@ -42,8 +42,8 @@ class PluginController extends Controller
|
|||||||
|
|
||||||
$title = trans($plugin->title);
|
$title = trans($plugin->title);
|
||||||
$path = $plugin->getPath().'/'.$readmePath;
|
$path = $plugin->getPath().'/'.$readmePath;
|
||||||
$parsedown = new Parsedown();
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
$content = $parsedown->text(file_get_contents($path));
|
$content = $converter->convertToHtml(file_get_contents($path));
|
||||||
|
|
||||||
return view('admin.plugin.readme', compact('content', 'title'));
|
return view('admin.plugin.readme', compact('content', 'title'));
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Parsedown;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
||||||
class SkinlibController extends Controller
|
class SkinlibController extends Controller
|
||||||
@ -169,7 +169,7 @@ class SkinlibController extends Controller
|
|||||||
];
|
];
|
||||||
$grid = $filter->apply('grid:skinlib.upload', $grid);
|
$grid = $filter->apply('grid:skinlib.upload', $grid);
|
||||||
|
|
||||||
$parsedown = new Parsedown();
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
|
|
||||||
return view('skinlib.upload')
|
return view('skinlib.upload')
|
||||||
->with('grid', $grid)
|
->with('grid', $grid)
|
||||||
@ -186,7 +186,7 @@ class SkinlibController extends Controller
|
|||||||
'scorePrivate' => (int) option('private_score_per_storage'),
|
'scorePrivate' => (int) option('private_score_per_storage'),
|
||||||
'closetItemCost' => (int) option('score_per_closet_item'),
|
'closetItemCost' => (int) option('score_per_closet_item'),
|
||||||
'award' => (int) option('score_award_per_texture'),
|
'award' => (int) option('score_award_per_texture'),
|
||||||
'contentPolicy' => $parsedown->text(option_localized('content_policy')),
|
'contentPolicy' => $converter->convertToHtml(option_localized('content_policy')),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ use Blessing\Rejection;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Parsedown;
|
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class UserController extends Controller
|
|||||||
];
|
];
|
||||||
$grid = $filter->apply('grid:user.index', $grid);
|
$grid = $filter->apply('grid:user.index', $grid);
|
||||||
|
|
||||||
$parsedown = new Parsedown();
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
|
|
||||||
return view('user.index')->with([
|
return view('user.index')->with([
|
||||||
'score_intro' => $scoreIntro,
|
'score_intro' => $scoreIntro,
|
||||||
@ -67,7 +67,7 @@ class UserController extends Controller
|
|||||||
'player' => option('score_per_player'),
|
'player' => option('score_per_player'),
|
||||||
'closet' => option('score_per_closet_item'),
|
'closet' => option('score_per_closet_item'),
|
||||||
],
|
],
|
||||||
'announcement' => $parsedown->text(option_localized('announcement')),
|
'announcement' => $converter->convertToHtml(option_localized('announcement')),
|
||||||
'grid' => $grid,
|
'grid' => $grid,
|
||||||
'extra' => ['unverified' => option('require_verification') && !$user->verified],
|
'extra' => ['unverified' => option('require_verification') && !$user->verified],
|
||||||
]);
|
]);
|
||||||
|
@ -5,7 +5,7 @@ namespace Tests;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications;
|
use App\Notifications;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Parsedown;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
|
|
||||||
class NotificationsControllerTest extends TestCase
|
class NotificationsControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -114,10 +114,11 @@ class NotificationsControllerTest extends TestCase
|
|||||||
|
|
||||||
$this->actingAs($user)->get('/user')->assertSee('Hyouka');
|
$this->actingAs($user)->get('/user')->assertSee('Hyouka');
|
||||||
|
|
||||||
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
$this->postJson('/user/notifications/'.$notification->id)
|
$this->postJson('/user/notifications/'.$notification->id)
|
||||||
->assertJson([
|
->assertJson([
|
||||||
'title' => $notification->data['title'],
|
'title' => $notification->data['title'],
|
||||||
'content' => (new Parsedown())->text($notification->data['content']),
|
'content' => $converter->convertToHtml($notification->data['content']),
|
||||||
'time' => $notification->created_at->toDateTimeString(),
|
'time' => $notification->created_at->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
$notification->refresh();
|
$notification->refresh();
|
||||||
|
@ -13,7 +13,7 @@ use Event;
|
|||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Parsedown;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
|
|
||||||
class UserControllerTest extends TestCase
|
class UserControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -35,7 +35,8 @@ class UserControllerTest extends TestCase
|
|||||||
$uid = $user->uid;
|
$uid = $user->uid;
|
||||||
factory(\App\Models\Player::class)->create(['uid' => $uid]);
|
factory(\App\Models\Player::class)->create(['uid' => $uid]);
|
||||||
|
|
||||||
$announcement = (new Parsedown())->text(option_localized('announcement'));
|
$converter = new GithubFlavoredMarkdownConverter();
|
||||||
|
$announcement = $converter->convertToHtml(option_localized('announcement'));
|
||||||
$this->actingAs($user)
|
$this->actingAs($user)
|
||||||
->get('/user')
|
->get('/user')
|
||||||
->assertSee($announcement, false);
|
->assertSee($announcement, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user