Squashed commit of the following:

commit c835e6e220950dd2f95976eae2a50f71a1c532d1
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 7 11:49:26 2016 +0000

    Change visibilty of a method

commit e67d6bfd54cb677e738f934544e0c45c3de59891
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Nov 6 19:42:07 2016 +0000

    Edit method to send webmentions using the new job method

commit fe9839572148b644c5e0e0f32f639650ffbb968c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Nov 6 19:10:32 2016 +0000

    Updated changelog

commit 1b09744404459e7a6a164788f09ebcc6468b7055
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Nov 6 19:08:45 2016 +0000

    Allow notes to be deleted
This commit is contained in:
Jonny Barnes 2016-11-07 11:50:02 +00:00
parent 6dc7c8da42
commit cb465f027a
7 changed files with 58 additions and 5 deletions

View file

@ -6,6 +6,7 @@ use App\Note;
use Validator;
use Illuminate\Http\Request;
use App\Services\NoteService;
use App\Jobs\SendWebMentions;
class NotesAdminController extends Controller
{
@ -41,6 +42,17 @@ class NotesAdminController extends Controller
return view('admin.listnotes', ['notes' => $notes]);
}
/**
* The delete note page.
*
* @param int id
* @return view
*/
public function deleteNotePage($id)
{
return view('admin.deletenote', ['id' => $id]);
}
/**
* Display the form to edit a specific note.
*
@ -92,16 +104,29 @@ class NotesAdminController extends Controller
public function editNote($noteId, Request $request)
{
//update note data
$note = Note::find($noteId);
$note = Note::findOrFail($noteId);
$note->note = $request->input('content');
$note->in_reply_to = $request->input('in-reply-to');
$note->save();
if ($request->input('webmentions')) {
$wmc = new WebMentionsController();
$wmc->send($note);
dispatch(new SendWebMentions($note));
}
return view('admin.editnotesuccess', ['id' => $noteId]);
}
/**
* Delete the note.
*
* @param int id
* @return view
*/
public function deleteNote($id)
{
$note = Note::findOrFail($id);
$note->delete();
return view('admin.deletenotesuccess');
}
}

View file

@ -58,7 +58,7 @@ class SendWebMentions implements ShouldQueue
* @param \GuzzleHttp\Client $guzzle
* @return string The webmention endpoint URL
*/
private function discoverWebmentionEndpoint($url, $guzzle)
public function discoverWebmentionEndpoint($url, $guzzle)
{
//lets not send webmentions to myself
if (parse_url($url, PHP_URL_HOST) == env('LONG_URL', 'localhost')) {

View file

@ -2,6 +2,7 @@
## Version {next}
- Add a reply icon in note metadata
- Allow notes to be deleted
## Version 0.0.15.6 (2016-11-03)
- Remove reply/like/repost links, not needed without indie-action

View file

@ -0,0 +1,16 @@
@extends('master')
@section('title')
Delete Note « Admin CP
@stop
@section('content')
<form action="/admin/note/delete/{{ $id }}" method="post" accept-charset="utf-8">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<fieldset class="note-ui">
<legend>Delete Note</legend>
<p>Are you sure you want to delete the note?
<label for="kludge"></label><input type="submit" value="Submit">
</fieldset>
</form>
@stop

View file

@ -0,0 +1,9 @@
@extends('master')
@section('title')
Delete Note Success « Admin CP
@stop
@section('content')
<p>The note was successfully deleted.</p>
@stop

View file

@ -12,7 +12,7 @@ Edit Note « Admin CP
<label for="in-reply-to" accesskey="r">Reply-to: </label><input type="text" name="in-reply-to" id="in-reply-to" placeholder="in-reply-to-1 in-reply-to-2 …" tabindex="1" value="{{ $note->in_reply_to }}"><br>
<label for="content" accesskey="n">Note: </label><textarea name="content" id="content" placeholder="Note" tabindex="2">{{ $note->originalNote }}</textarea><br>
<label for="webmentions" accesskey="w">Send webmentions: </label><input type="checkbox" name="webmentions" id="webmentions" checked="checked" tabindex="3"><br>
<label for="kludge"></label><input type="submit" value="Submit" tabindex="6"><br>
<label for="kludge"></label><input type="submit" value="Submit" tabindex="6"> <a href="/admin/note/delete/{{ $id }}">Delete note?</a>
</fieldset>
</form>
@stop

View file

@ -45,8 +45,10 @@ Route::group(['domain' => config('url.longurl')], function () {
Route::get('admin/note/new', 'NotesAdminController@newNotePage');
Route::get('admin/note/edit', 'NotesAdminController@listNotesPage');
Route::get('admin/note/edit/{id}', 'NotesAdminController@editNotePage');
Route::get('admin/note/delete/{id}', 'NotesAdminController@deleteNotePage');
Route::post('admin/note/new', 'NotesAdminController@createNote');
Route::post('admin/note/edit/{id}', 'NotesAdminController@editNote');
Route::post('admin/note/delete/{id}', 'NotesAdminController@deleteNote');
//Tokens
Route::get('admin/tokens', 'TokensController@showTokens');