Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements, bug fixes and support markdown in activity comments #1145

Merged
merged 6 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App;

use Parsedown;
use Carbon\Carbon;
use App\Traits\Hasher;
use App\Traits\Journalable;
Expand Down Expand Up @@ -86,6 +87,20 @@ public function journalEntries()
return $this->morphMany('App\JournalEntry', 'journalable');
}

/**
* Return the markdown parsed body.
*
* @return string
*/
public function getParsedContentAttribute()
{
if (is_null($this->description)) {
return;
}

return (new Parsedown())->text($this->description);
}

/**
* Get the date_it_happened field according to user's timezone.
*
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Auth;
use App\Debt;
use App\User;
use App\Contact;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
Expand All @@ -23,6 +24,10 @@ public function index()
)->with('debts.contact')
->first();

if ($account->contacts()->count() === 0) {
return view('dashboard.blank');
}

// Fetch last updated contacts
$lastUpdatedContactsCollection = collect([]);
$lastUpdatedContacts = $account->contacts()->where('is_partial', false)->latest('updated_at')->limit(10)->get();
Expand All @@ -38,11 +43,6 @@ public function index()
$lastUpdatedContactsCollection->push(json_encode($data));
}

// Latest statistics
if ($account->contacts()->count() === 0) {
return view('dashboard.blank');
}

$debt = $account->debts->where('status', 'inprogress');

$debt_due = $debt->where('in_debt', 'yes')
Expand All @@ -57,7 +57,7 @@ public function index()

$data = [
'lastUpdatedContacts' => $lastUpdatedContactsCollection,
'number_of_contacts' => $account->contacts_count,
'number_of_contacts' => $account->contacts()->real()->count(),
'number_of_reminders' => $account->reminders_count,
'number_of_notes' => $account->notes_count,
'number_of_activities' => $account->activities_count,
Expand Down
39 changes: 39 additions & 0 deletions database/migrations/2018_04_10_205655_fix_production_error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use App\User;
use App\Account;
use Illuminate\Database\Migrations\Migration;

class FixProductionError extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// this migration fixes a weird issue where we have a bunch of users
// who don't have an account_id
$usersWithoutAccount = collect();
User::chunk(200, function ($users) use ($usersWithoutAccount) {
foreach ($users as $user) {
$account = $user->account;
if (is_null($account)) {
$usersWithoutAccount->push($user);
}
}
});

foreach ($usersWithoutAccount as $user) {
// creation of a new account
$account = new Account;
$account->api_key = str_random(30);
$account->created_at = now();
$account->save();

$user->account_id = $account->id;
$user->save();
}
}
}
2 changes: 1 addition & 1 deletion public/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/app.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/app.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/langs/en.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/manifest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/manifest.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/vendor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/vendor.js.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"/js/app.js": "/js/app.js?id=bae79009a95d4a40a6e2",
"/css/app.css": "/css/app.css?id=ce61f35432352117b85f",
"/js/app.js": "/js/app.js?id=1ab4b85e1a35dfc7674c",
"/css/app.css": "/css/app.css?id=6bafaeec98fc3610d2bb",
"/css/stripe.css": "/css/stripe.css?id=956554a2e96db30fafa3",
"/js/app.js.map": "/js/app.js.map?id=e071b342a4003d19814f",
"/css/app.css.map": "/css/app.css.map?id=68f4f4b1e73b2fab974b",
"/js/app.js.map": "/js/app.js.map?id=4bbb54f57755fafc69ff",
"/css/app.css.map": "/css/app.css.map?id=8d90b382cdc159348661",
"/css/stripe.css.map": "/css/stripe.css.map?id=80d7af9d49b0922d35e6",
"/js/vendor.js": "/js/vendor.js?id=a49a2fa050af3f4fa573",
"/js/vendor.js.map": "/js/vendor.js.map?id=edb69044ca60083c254e",
"/js/vendor.js": "/js/vendor.js?id=27d50887c20a5b335d52",
"/js/vendor.js.map": "/js/vendor.js.map?id=3fb51c262c8efe3582c1",
"/js/stripe.js": "/js/stripe.js?id=53bdff9014c2f8618542",
"/js/stripe.js.map": "/js/stripe.js.map?id=f0f557c67621a3a7e628",
"/js/manifest.js": "/js/manifest.js?id=762d9e2e684fedba1433",
"/js/manifest.js.map": "/js/manifest.js.map?id=1bb379ff13f49b9499d2"
"/js/manifest.js": "/js/manifest.js?id=986277f41177e12a72bd",
"/js/manifest.js.map": "/js/manifest.js.map?id=ab4a4ab4bf59661a2f2f"
}
12 changes: 11 additions & 1 deletion resources/assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ a {
}

a[hreflang]:after {
content: " (" attr(hreflang) ")";
content: " (" attr(hreflang) ")";
}

ul {
Expand All @@ -193,6 +193,16 @@ ul {
}
}

.markdown {
ul {
list-style-type: disc;
margin-left: 15px;
padding-left: 0;
margin-top: 10px;
margin-bottom: 10px;
}
}

.hidden {
display: none;
}
Expand Down
Loading