#111: User feed now displays a "user created" event logged via the register/activation controllers
This commit is contained in:
parent
e59311244a
commit
80a7824f22
@ -47,6 +47,7 @@ class ActivateController extends Controller
|
|||||||
|
|
||||||
$request->session()->flash('info', trans('auth.account_activated_message'));
|
$request->session()->flash('info', trans('auth.account_activated_message'));
|
||||||
|
|
||||||
|
$this->logActivatedActivity($user);
|
||||||
$this->sendUserActivatedEmails($user);
|
$this->sendUserActivatedEmails($user);
|
||||||
|
|
||||||
return redirect($this->redirectPath());
|
return redirect($this->redirectPath());
|
||||||
|
@ -128,6 +128,7 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
if ($user->is_activated)
|
if ($user->is_activated)
|
||||||
{
|
{
|
||||||
|
$this->logActivatedActivity($user);
|
||||||
$this->sendUserActivatedEmails($user);
|
$this->sendUserActivatedEmails($user);
|
||||||
$this->guard()->login($user);
|
$this->guard()->login($user);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,15 @@ class UserController extends Controller
|
|||||||
$params['album_url'] = $activity->album->url();
|
$params['album_url'] = $activity->album->url();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other activity-specific parameters
|
||||||
|
switch (strtolower($activity->type))
|
||||||
|
{
|
||||||
|
case 'user.created':
|
||||||
|
$params['app_name'] = UserConfig::get('app_name');
|
||||||
|
$params['app_url'] = route('home');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$newItem['params'] = $params;
|
$newItem['params'] = $params;
|
||||||
|
|
||||||
$result[] = $newItem;
|
$result[] = $newItem;
|
||||||
@ -310,6 +319,15 @@ class UserController extends Controller
|
|||||||
$params['album_url'] = $activity->album->url();
|
$params['album_url'] = $activity->album->url();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other activity-specific parameters
|
||||||
|
switch (strtolower($activity->type))
|
||||||
|
{
|
||||||
|
case 'user.created':
|
||||||
|
$params['app_name'] = UserConfig::get('app_name');
|
||||||
|
$params['app_url'] = route('home');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$newItem['params'] = $params;
|
$newItem['params'] = $params;
|
||||||
|
|
||||||
$result[] = $newItem;
|
$result[] = $newItem;
|
||||||
@ -492,7 +510,7 @@ class UserController extends Controller
|
|||||||
private function loadUserProfilePage($idOrAlias)
|
private function loadUserProfilePage($idOrAlias)
|
||||||
{
|
{
|
||||||
// If a user has a profile alias set, their profile page cannot be accessed by the ID
|
// If a user has a profile alias set, their profile page cannot be accessed by the ID
|
||||||
$user = User::where(DB::raw('COALESCE(profile_alias, id)'), strtolower($idOrAlias))->first();
|
$user = User::where(DB::raw('COALESCE(NULLIF(profile_alias, \'\'), id)'), strtolower($idOrAlias))->first();
|
||||||
|
|
||||||
if (is_null($user))
|
if (is_null($user))
|
||||||
{
|
{
|
||||||
|
@ -4,10 +4,25 @@ namespace App\Traits;
|
|||||||
|
|
||||||
use App\Mail\UserSelfActivated;
|
use App\Mail\UserSelfActivated;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use App\UserActivity;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
trait ActivatesUsers
|
trait ActivatesUsers
|
||||||
{
|
{
|
||||||
|
private function logActivatedActivity(User $createdUser, $activityDateTime = null)
|
||||||
|
{
|
||||||
|
if (is_null($activityDateTime))
|
||||||
|
{
|
||||||
|
$activityDateTime = new \DateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
$userActivity = new UserActivity();
|
||||||
|
$userActivity->user_id = $createdUser->id;
|
||||||
|
$userActivity->activity_at = $activityDateTime;
|
||||||
|
$userActivity->type = 'user.created';
|
||||||
|
$userActivity->save();
|
||||||
|
}
|
||||||
|
|
||||||
private function sendUserActivatedEmails(User $createdUser)
|
private function sendUserActivatedEmails(User $createdUser)
|
||||||
{
|
{
|
||||||
$adminUsers = User::where('is_admin', true)->get();
|
$adminUsers = User::where('is_admin', true)->get();
|
||||||
|
@ -41727,6 +41727,16 @@ function UserViewModel(urls)
|
|||||||
'<a href="' + data[i].params.album_url + '">' + data[i].params.album_name + '</a>'
|
'<a href="' + data[i].params.album_url + '">' + data[i].params.album_name + '</a>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// App name
|
||||||
|
if (data[i].params.app_name && data[i].params.app_url)
|
||||||
|
{
|
||||||
|
data[i].description = data[i].description
|
||||||
|
.replace(
|
||||||
|
':app_name',
|
||||||
|
'<a href="' + data[i].params.app_url + '">' + data[i].params.app_name + '</a>'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.feed_items = data;
|
self.feed_items = data;
|
||||||
|
2
public/js/blue-twilight.min.js
vendored
2
public/js/blue-twilight.min.js
vendored
File diff suppressed because one or more lines are too long
@ -191,6 +191,16 @@ function UserViewModel(urls)
|
|||||||
'<a href="' + data[i].params.album_url + '">' + data[i].params.album_name + '</a>'
|
'<a href="' + data[i].params.album_url + '">' + data[i].params.album_name + '</a>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// App name
|
||||||
|
if (data[i].params.app_name && data[i].params.app_url)
|
||||||
|
{
|
||||||
|
data[i].description = data[i].description
|
||||||
|
.replace(
|
||||||
|
':app_name',
|
||||||
|
'<a href="' + data[i].params.app_url + '">' + data[i].params.app_name + '</a>'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.feed_items = data;
|
self.feed_items = data;
|
||||||
|
@ -102,6 +102,9 @@ return [
|
|||||||
'edited' => ':user_name edited the :photo_name photo.',
|
'edited' => ':user_name edited the :photo_name photo.',
|
||||||
'taken' => ':user_name took the :photo_name photo.',
|
'taken' => ':user_name took the :photo_name photo.',
|
||||||
'uploaded' => ':user_name uploaded the :photo_name photo.'
|
'uploaded' => ':user_name uploaded the :photo_name photo.'
|
||||||
|
],
|
||||||
|
'user' => [
|
||||||
|
'created' => ':user_name created their account at :app_name.'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'user_profile' => [
|
'user_profile' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user