Merge branch 'release/0.0.2'

This commit is contained in:
Jonny Barnes 2016-05-25 22:54:28 +01:00
commit a510ef4c13
3 changed files with 17 additions and 3 deletions

View file

@ -155,6 +155,15 @@ class NotesController extends Controller
*/ */
public function taggedNotes($tag) public function taggedNotes($tag)
{ {
$tag = mb_strtolower(
preg_replace(
'/&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);/i',
'$1',
htmlentities($tag)
),
'UTF-8'
);
$tagId = Tag::where('tag', $tag)->pluck('id'); $tagId = Tag::where('tag', $tag)->pluck('id');
$notes = Tag::find($tagId)->notes()->orderBy('updated_at', 'desc')->get(); $notes = Tag::find($tagId)->notes()->orderBy('updated_at', 'desc')->get();
foreach ($notes as $note) { foreach ($notes as $note) {

View file

@ -1,4 +1,7 @@
# Changelog # Changelog
## Version 0.0.2 (2016-05-25)
- Fix issue#1: tagged notes page needs the tag from the URL normalizing.
## Version 0.0.1 (2016-05-25) ## Version 0.0.1 (2016-05-25)
Initial release - Initial release

View file

@ -43,10 +43,10 @@ class MicropubClientTest extends TestCase
/** /**
* This currently creates a new note that stays in the database. * This currently creates a new note that stays in the database.
*/ */
public function testClientCreatesNewNote() public function testClientCreatesNewNoteWithTag()
{ {
$faker = \Faker\Factory::create(); $faker = \Faker\Factory::create();
$note = 'Fake note from PHPUnit: ' . $faker->text; $note = 'Fake note from #PHPUnit: ' . $faker->text;
$this->withSession([ $this->withSession([
'me' => $this->appurl, 'me' => $this->appurl,
'token' => $this->getToken() 'token' => $this->getToken()
@ -54,6 +54,8 @@ class MicropubClientTest extends TestCase
->type($note, 'content') ->type($note, 'content')
->press('Submit'); ->press('Submit');
$this->seeInDatabase('notes', ['note' => $note]); $this->seeInDatabase('notes', ['note' => $note]);
$this->visit($this->appurl . '/notes/tagged/PHPUnit')
->see('PHPUnit');
} }