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')) {