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:
parent
6dc7c8da42
commit
cb465f027a
7 changed files with 58 additions and 5 deletions
|
@ -6,6 +6,7 @@ use App\Note;
|
||||||
use Validator;
|
use Validator;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Services\NoteService;
|
use App\Services\NoteService;
|
||||||
|
use App\Jobs\SendWebMentions;
|
||||||
|
|
||||||
class NotesAdminController extends Controller
|
class NotesAdminController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,17 @@ class NotesAdminController extends Controller
|
||||||
return view('admin.listnotes', ['notes' => $notes]);
|
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.
|
* Display the form to edit a specific note.
|
||||||
*
|
*
|
||||||
|
@ -92,16 +104,29 @@ class NotesAdminController extends Controller
|
||||||
public function editNote($noteId, Request $request)
|
public function editNote($noteId, Request $request)
|
||||||
{
|
{
|
||||||
//update note data
|
//update note data
|
||||||
$note = Note::find($noteId);
|
$note = Note::findOrFail($noteId);
|
||||||
$note->note = $request->input('content');
|
$note->note = $request->input('content');
|
||||||
$note->in_reply_to = $request->input('in-reply-to');
|
$note->in_reply_to = $request->input('in-reply-to');
|
||||||
$note->save();
|
$note->save();
|
||||||
|
|
||||||
if ($request->input('webmentions')) {
|
if ($request->input('webmentions')) {
|
||||||
$wmc = new WebMentionsController();
|
dispatch(new SendWebMentions($note));
|
||||||
$wmc->send($note);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.editnotesuccess', ['id' => $noteId]);
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class SendWebMentions implements ShouldQueue
|
||||||
* @param \GuzzleHttp\Client $guzzle
|
* @param \GuzzleHttp\Client $guzzle
|
||||||
* @return string The webmention endpoint URL
|
* @return string The webmention endpoint URL
|
||||||
*/
|
*/
|
||||||
private function discoverWebmentionEndpoint($url, $guzzle)
|
public function discoverWebmentionEndpoint($url, $guzzle)
|
||||||
{
|
{
|
||||||
//let’s not send webmentions to myself
|
//let’s not send webmentions to myself
|
||||||
if (parse_url($url, PHP_URL_HOST) == env('LONG_URL', 'localhost')) {
|
if (parse_url($url, PHP_URL_HOST) == env('LONG_URL', 'localhost')) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Version {next}
|
## Version {next}
|
||||||
- Add a reply icon in note metadata
|
- Add a reply icon in note metadata
|
||||||
|
- Allow notes to be deleted
|
||||||
|
|
||||||
## Version 0.0.15.6 (2016-11-03)
|
## Version 0.0.15.6 (2016-11-03)
|
||||||
- Remove reply/like/repost links, not needed without indie-action
|
- Remove reply/like/repost links, not needed without indie-action
|
||||||
|
|
16
resources/views/admin/deletenote.blade.php
Normal file
16
resources/views/admin/deletenote.blade.php
Normal 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
|
9
resources/views/admin/deletenotesuccess.blade.php
Normal file
9
resources/views/admin/deletenotesuccess.blade.php
Normal 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
|
|
@ -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="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="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="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>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
@stop
|
@stop
|
||||||
|
|
|
@ -45,8 +45,10 @@ Route::group(['domain' => config('url.longurl')], function () {
|
||||||
Route::get('admin/note/new', 'NotesAdminController@newNotePage');
|
Route::get('admin/note/new', 'NotesAdminController@newNotePage');
|
||||||
Route::get('admin/note/edit', 'NotesAdminController@listNotesPage');
|
Route::get('admin/note/edit', 'NotesAdminController@listNotesPage');
|
||||||
Route::get('admin/note/edit/{id}', 'NotesAdminController@editNotePage');
|
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/new', 'NotesAdminController@createNote');
|
||||||
Route::post('admin/note/edit/{id}', 'NotesAdminController@editNote');
|
Route::post('admin/note/edit/{id}', 'NotesAdminController@editNote');
|
||||||
|
Route::post('admin/note/delete/{id}', 'NotesAdminController@deleteNote');
|
||||||
|
|
||||||
//Tokens
|
//Tokens
|
||||||
Route::get('admin/tokens', 'TokensController@showTokens');
|
Route::get('admin/tokens', 'TokensController@showTokens');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue