Using "post" when deleting, fixing deleting
This commit is contained in:
parent
686785049e
commit
88e276843e
5 changed files with 72 additions and 53 deletions
|
@ -50,7 +50,7 @@ class ScheduledStatuses extends BaseApi
|
||||||
}
|
}
|
||||||
|
|
||||||
$condtion = ['id' => $parameters['id'], 'uid' => $uid];
|
$condtion = ['id' => $parameters['id'], 'uid' => $uid];
|
||||||
$post = DBA::selectFirst('delayed-post', ['id'], $condtion);
|
$post = DBA::selectFirst('delayed-post', ['id', 'wid'], $condtion);
|
||||||
if (empty($post['id'])) {
|
if (empty($post['id'])) {
|
||||||
DI::mstdnError()->RecordNotFound();
|
DI::mstdnError()->RecordNotFound();
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,10 @@ class ScheduledStatuses extends BaseApi
|
||||||
DI::mstdnError()->RecordNotFound();
|
DI::mstdnError()->RecordNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DBA::delete('workerqueue', ['id' => $post['wid']])) {
|
||||||
|
DI::mstdnError()->RecordNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
System::jsonExit([]);
|
System::jsonExit([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,22 @@ use Friendica\Network\HTTPException;
|
||||||
|
|
||||||
class Schedule extends BaseProfile
|
class Schedule extends BaseProfile
|
||||||
{
|
{
|
||||||
public static function content(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($parameters['id'])) {
|
if (empty($_REQUEST['delete'])) {
|
||||||
self::deleteSchedule($parameters['id']);
|
throw new HTTPException\BadRequestException();
|
||||||
|
}
|
||||||
|
self::deleteSchedule($_REQUEST['delete']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function content(array $parameters = [])
|
||||||
|
{
|
||||||
|
if (!local_user()) {
|
||||||
|
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
|
@ -78,6 +86,13 @@ class Schedule extends BaseProfile
|
||||||
|
|
||||||
private static function deleteSchedule($id)
|
private static function deleteSchedule($id)
|
||||||
{
|
{
|
||||||
|
$condtion = ['id' => $id, 'uid' => local_user()];
|
||||||
|
$post = DBA::selectFirst('delayed-post', ['id', 'wid'], $condtion);
|
||||||
|
if (empty($post['id'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DBA::delete('delayed-post', ['id' => $id, 'uid' => local_user()]);
|
DBA::delete('delayed-post', ['id' => $id, 'uid' => local_user()]);
|
||||||
|
DBA::delete('workerqueue', ['id' => $post['wid']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,7 @@ use Friendica\Module;
|
||||||
$profileRoutes = [
|
$profileRoutes = [
|
||||||
'' => [Module\Profile\Index::class, [R::GET]],
|
'' => [Module\Profile\Index::class, [R::GET]],
|
||||||
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
||||||
'/schedule' => [Module\Profile\Schedule::class, [R::GET]],
|
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
|
||||||
'/schedule/delete/{id:\d+}' => [Module\Profile\Schedule::class, [R::GET]],
|
|
||||||
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
|
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
|
||||||
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
|
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
|
||||||
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
|
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
<div class="generic-page-wrapper">
|
<div class="generic-page-wrapper">
|
||||||
<h1>{{$title}}</h1>
|
<h1>{{$title}}</h1>
|
||||||
<form action="profile/{{$nickname}}/schedule" method="post" autocomplete="off">
|
<table id='application-block' class='table table-condensed table-striped'>
|
||||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
<thead>
|
||||||
<table id='application-block' class='table table-condensed table-striped'>
|
<tr>
|
||||||
<thead>
|
<th>{{$scheduled_at}}</th>
|
||||||
<tr>
|
<th>{{$content}}</th>
|
||||||
<th>{{$scheduled_at}}</th>
|
</tr>
|
||||||
<th>{{$content}}</th>
|
</thead>
|
||||||
</tr>
|
<tbody>
|
||||||
</thead>
|
{{foreach $schedule as $entry}}
|
||||||
<tbody>
|
<tr>
|
||||||
{{foreach $schedule as $entry}}
|
<td>{{$entry.scheduled_at}}</td>
|
||||||
<tr>
|
<td>{{$entry.content}}</td>
|
||||||
<td>{{$entry.scheduled_at}}</td>
|
<td>
|
||||||
<td>{{$entry.content}}</td>
|
<form action="{{$baseurl}}/profile/{{$nickname}}/schedule" method="post">
|
||||||
<td><a href="{{$baseurl}}/profile/{{$nickname}}/schedule/delete/{{$entry.id}}?t={{$form_security_token}}" class="icon s22 delete" title="{{$delete}}"> </a></td>
|
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
|
||||||
</tr>
|
<button type="submit" name="delete" value="{{$row.id}}" title="{{$delete}}">
|
||||||
{{/foreach}}
|
<i class="fa fa-trash" aria-hidden="true">
|
||||||
</tbody>
|
</button>
|
||||||
</table>
|
</form>
|
||||||
</form>
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
<div class="generic-page-wrapper">
|
<div class="generic-page-wrapper">
|
||||||
{{* include the title template for the settings title *}}
|
{{* include the title template for the settings title *}}
|
||||||
{{include file="section_title.tpl" title=$title}}
|
{{include file="section_title.tpl" title=$title}}
|
||||||
<form action="profile/{{$nickname}}/schedule" method="post" autocomplete="off">
|
<table id='application-block' class='table table-condensed table-striped'>
|
||||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
<thead>
|
||||||
<table id='application-block' class='table table-condensed table-striped'>
|
<tr>
|
||||||
<thead>
|
<th>{{$scheduled_at}}</th>
|
||||||
<tr>
|
<th>{{$content}}</th>
|
||||||
<th>{{$scheduled_at}}</th>
|
</tr>
|
||||||
<th>{{$content}}</th>
|
</thead>
|
||||||
</tr>
|
<tbody>
|
||||||
</thead>
|
{{foreach $schedule as $row}}
|
||||||
<tbody>
|
<tr>
|
||||||
{{foreach $schedule as $row}}
|
<td>{{$row.scheduled_at}}</td>
|
||||||
<tr>
|
<td>{{$row.content}}</td>
|
||||||
<td>{{$row.scheduled_at}}</td>
|
<td>
|
||||||
<td>{{$row.content}}</td>
|
<form action="{{$baseurl}}/profile/{{$nickname}}/schedule" method="post">
|
||||||
<td>
|
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
|
||||||
<form action="{{$baseurl}}/profile/{{$nickname}}/schedule" method="post">
|
<button type="submit" name="delete" value="{{$row.id}}" title="{{$delete}}">
|
||||||
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
|
<i class="fa fa-trash" aria-hidden="true">
|
||||||
<button type="submit" name="delete" value="{{$row.id}}" title="{{$delete}}">
|
</button>
|
||||||
<i class="fa fa-trash" aria-hidden="true">
|
</form>
|
||||||
</button>
|
</td>
|
||||||
</form>
|
</tr>
|
||||||
</td>
|
{{/foreach}}
|
||||||
</tr>
|
</tbody>
|
||||||
{{/foreach}}
|
</table>
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue