Skip to content

Commit

Permalink
Merge pull request Silvanite#70 from SGS-Optimisation/fix/60-content-…
Browse files Browse the repository at this point in the history
…editor

fix for some stags being stripped in rule content
  • Loading branch information
yayann authored Jul 29, 2021
2 parents 67733c3 + a42f35f commit 95bcce5
Show file tree
Hide file tree
Showing 5 changed files with 14,515 additions and 44 deletions.
51 changes: 28 additions & 23 deletions app/Http/Controllers/PMs/RuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class RuleController extends Controller
/**
* TODO: Fix attachments not created in db
*
* @param Request $request
* @param Rule $rule
* @param Request $request
* @param Rule $rule
*/
protected function parseContent($request, $rule)
{
Expand All @@ -47,7 +47,7 @@ protected function parseContent($request, $rule)
}

if ($request->state && $rule->state != $request->state) {
logger('transitioning rule '.$rule->id.' to '.$request->state);
logger('transitioning rule ' . $rule->id . ' to ' . $request->state);
$rule->state->transitionTo($request->state, $request->user());
}
}
Expand All @@ -65,15 +65,15 @@ protected static function buildStates(Rule $rule)
if (!$transitionClass
|| (new $transitionClass($rule, auth()->user()))->canTransition()
) {
$shown_states[] = $state;
$shown_states[] = $state;
}
}

return $shown_states;
}

/**
* @param Request $request
* @param Request $request
* @param $client_account_slug
* @return \Inertia\Response
*/
Expand All @@ -100,7 +100,7 @@ public function index(Request $request, $client_account_slug)
/**
* Show the form for creating a new resource.
*
* @param Request $request
* @param Request $request
* @param $client_account_slug
* @return \Inertia\Response
*/
Expand All @@ -126,7 +126,7 @@ public function create(Request $request, $client_account_slug)
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return Application|JsonResponse|RedirectResponse|Redirector
*/
public function store(CreateRuleRequest $request, $client_account_slug)
Expand All @@ -139,7 +139,7 @@ public function store(CreateRuleRequest $request, $client_account_slug)
$rule = $client_account->rules()->create($rule_fields);
$this->parseContent($request, $rule);

logger('rule added: '.$rule->id);
logger('rule added: ' . $rule->id);
event(new Updated($rule));

$request->session()->flash('success', 'Rule successfully created!');
Expand All @@ -153,7 +153,7 @@ public function store(CreateRuleRequest $request, $client_account_slug)
/**
* Display the specified resource.
*
* @param int $id
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
Expand All @@ -164,9 +164,9 @@ public function show($id)
/**
* Show the form for editing the specified resource.
*
* @param Request $request
* @param Request $request
* @param $client_account_slug
* @param int $id
* @param int $id
* @return \Inertia\Response
*/
public function edit(Request $request, $client_account_slug, $id)
Expand All @@ -182,14 +182,19 @@ public function edit(Request $request, $client_account_slug, $id)
'<div>&nbsp;</div>',
'<p></p>',
'<p><br></p>',
'<ul>',
'</ul>',
'<li>',
'</li>',
'</span>',
],
['', '', '', '', '', '', '', '', '', '</span><br/>'],
strip_tags($rule->content, '<p><img><a><span><br><i><strong><b>')
['', '', '', '', '', '</span><br/>'],
strip_tags(
$rule->content,
[
'p', 'img', 'a', 'span', 'br',
'i', 'strong', 'b', 'u', 's',
'ul', 'ol', 'li',
'blockquote', 'pre',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
]
)
);


Expand All @@ -207,8 +212,8 @@ public function edit(Request $request, $client_account_slug, $id)
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return JsonResponse|RedirectResponse
*/
public function update(Request $request, $client_account_slug, $id)
Expand All @@ -230,9 +235,9 @@ public function update(Request $request, $client_account_slug, $id)
/**
* Remove the specified resource from storage.
*
* @param Request $request
* @param Request $request
* @param $client_account_slug
* @param int $id
* @param int $id
* @return JsonResponse|RedirectResponse
* @throws \Exception
*/
Expand All @@ -252,9 +257,9 @@ public function destroy(Request $request, $client_account_slug, $id)
/**
* Restore deleted resource
*
* @param Request $request
* @param Request $request
* @param $client_account_slug
* @param int $id
* @param int $id
* @return JsonResponse|RedirectResponse
* @throws \Exception
*/
Expand Down
1 change: 1 addition & 0 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
'database' => env('MYSGS_DB_DATABASE', 'forge'),
'username' => env('MYSGS_DB_USERNAME', 'forge'),
'password' => env('MYSGS_DB_PASSWORD', ''),
'unix_socket' => env('MYSGS_DB_SOCKET', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
Expand Down
Loading

0 comments on commit 95bcce5

Please sign in to comment.