diff --git a/app/Models/Note.php b/app/Models/Note.php index 256ed639..678e7a3f 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -143,12 +143,14 @@ class Note extends Model */ public function getNoteAttribute($value) { - $emoji = new EmojiModifier(); + if ($value === null && $this->place !== null) { + $value = '📍: ' . $this->place->name . ''; + } $hcards = $this->makeHCards($value); $hashtags = $this->autoLinkHashtag($hcards); $html = $this->convertMarkdown($hashtags); - $modified = $emoji->makeEmojiAccessible($html); + $modified = resolve(EmojiModifier::class)->makeEmojiAccessible($html); return $modified; } diff --git a/app/Observers/NoteObserver.php b/app/Observers/NoteObserver.php index 945a02c9..bf618edb 100644 --- a/app/Observers/NoteObserver.php +++ b/app/Observers/NoteObserver.php @@ -14,7 +14,7 @@ class NoteObserver */ public function created(Note $note) { - $tags = $this->getTagsFromNote($note->getAttributes()['note']); + $tags = $this->getTagsFromNote($note->getAttributes()['note'] ?? null); if (count($tags) === 0) { return; diff --git a/app/Services/NoteService.php b/app/Services/NoteService.php index d4c95034..2680ec29 100644 --- a/app/Services/NoteService.php +++ b/app/Services/NoteService.php @@ -35,9 +35,6 @@ class NoteService if ($this->getCheckin($request)) { $note->place()->associate($this->getCheckin($request)); $note->swarm_url = $this->getSwarmUrl($request); - if ($note->note === null || $note->note == '') { - $note->note = 'I’ve just checked in with Swarm'; - } } $note->instagram_url = $this->getInstagramUrl($request); diff --git a/changelog.md b/changelog.md index 9598159a..ae1aada9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog +## Version {next} + - Add simple checkins, i.e. checkins with no note content, for now add a default note for these + ## Version 0.14 (2017-12-22) - Tests - Refactor diff --git a/database/seeds/NotesTableSeeder.php b/database/seeds/NotesTableSeeder.php index 8b9aeb7c..765bbc73 100644 --- a/database/seeds/NotesTableSeeder.php +++ b/database/seeds/NotesTableSeeder.php @@ -84,6 +84,11 @@ class NotesTableSeeder extends Seeder 'note' => 'I love https://duckduckgo.com 💕' // theres a two-heart emoji at the end of this ]); sleep(1); + $noteJustCheckin = new Note(); + $place = Place::find(1); + $noteJustCheckin->place()->associate($place); + $noteJustCheckin->save(); + sleep(1); $media = new Media(); $media->path = 'media/f1bc8faa-1a8f-45b8-a9b1-57282fa73f87.jpg'; $media->type = 'image'; diff --git a/resources/views/templates/note.blade.php b/resources/views/templates/note.blade.php index e0f33607..e01c730a 100644 --- a/resources/views/templates/note.blade.php +++ b/resources/views/templates/note.blade.php @@ -24,8 +24,8 @@
@if($note->client) via {{ $note->client->client_name }}@endif -@if($note->place) in {{ $note->address }} -@elseif($note->address) in {!! $note->address !!}@endif +@if($note->place)@if($note->getOriginal('note')) in {{ $note->address }}@endif +@elseif($note->address) in {!! $note->address !!}@endif @if($note->replies_count > 0) @include('templates.replies-icon'): {{ $note->replies_count }}@endif