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