Make sure when a note has no content, null is saved to the db, not ''
This commit is contained in:
parent
56d180729e
commit
ae2dc99069
3 changed files with 8 additions and 1 deletions
|
@ -132,7 +132,11 @@ class Note extends Model
|
||||||
*/
|
*/
|
||||||
public function setNoteAttribute($value)
|
public function setNoteAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['note'] = normalizer_normalize($value, Normalizer::FORM_C);
|
$normalized = normalizer_normalize($value, Normalizer::FORM_C);
|
||||||
|
if ($normalized === '') { //we don’t want to save empty strings to the db
|
||||||
|
$normalized = null;
|
||||||
|
}
|
||||||
|
$this->attributes['note'] = $normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## Version {next}
|
## Version {next}
|
||||||
- Update dependencies and recompile frontend assets, fix tests
|
- Update dependencies and recompile frontend assets, fix tests
|
||||||
- Only normalise tags in the URL, not in the actual link text
|
- Only normalise tags in the URL, not in the actual link text
|
||||||
|
- Make sure when a note has no content, null is saved to the db, not `''`
|
||||||
|
|
||||||
## Version 0.15 (2017-12-24)
|
## Version 0.15 (2017-12-24)
|
||||||
- Add simple checkins, i.e. checkins with no note content, for now add a default note for these
|
- Add simple checkins, i.e. checkins with no note content, for now add a default note for these
|
||||||
|
|
|
@ -146,12 +146,14 @@ class SwarmTest extends TestCase
|
||||||
$response
|
$response
|
||||||
->assertStatus(201)
|
->assertStatus(201)
|
||||||
->assertJson(['response' => 'created']);
|
->assertJson(['response' => 'created']);
|
||||||
|
//dump($response->__get('headers')->get('location'));
|
||||||
$this->assertDatabaseHas('places', [
|
$this->assertDatabaseHas('places', [
|
||||||
'external_urls' => '{"foursquare": "https://foursquare.com/v/654321"}'
|
'external_urls' => '{"foursquare": "https://foursquare.com/v/654321"}'
|
||||||
]);
|
]);
|
||||||
$this->assertDatabaseHas('notes', [
|
$this->assertDatabaseHas('notes', [
|
||||||
'swarm_url' => 'https://www.swarmapp.com/checkin/def'
|
'swarm_url' => 'https://www.swarmapp.com/checkin/def'
|
||||||
]);
|
]);
|
||||||
|
$this->get($response->__get('headers')->get('location'))->assertSee('round pushpin');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_faked_ownyourswarm_request_saves_just_post_when_error_in_checkin_data()
|
public function test_faked_ownyourswarm_request_saves_just_post_when_error_in_checkin_data()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue