#19: Added a check for the user.enable_profile_page column when viewing the profile page. Added link to user's profile page (if enabled) in album footers. Tooltips are now enabled globally. Child album's footer now shows the details as tooltips.

This commit is contained in:
2018-08-11 09:20:40 +01:00
parent 7e721966e9
commit a22ce0c57a
10 changed files with 62 additions and 64 deletions
+7
View File
@@ -174,6 +174,8 @@ class Album extends Model
return $this->hasMany(Photo::class);
}
public function redirects()
{
return $this->hasMany(AlbumRedirect::class);
@@ -231,6 +233,11 @@ class Album extends Model
return route('viewAlbum', $this->url_path);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function userPermissions()
{
return $this->belongsToMany(Permission::class, 'album_user_permissions');
+1 -2
View File
@@ -31,7 +31,6 @@ class UserPolicy
public function view(User $user, User $userBeingAccessed)
{
// TODO per-user setting that determines if the page is available
return true;
return $userBeingAccessed->enable_profile_page;
}
}
+13 -1
View File
@@ -16,7 +16,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'is_admin', 'is_activated', 'activation_token'
'name', 'email', 'password', 'is_admin', 'is_activated', 'activation_token', 'profile_alias'
];
/**
@@ -64,4 +64,16 @@ class User extends Authenticatable
{
return $this->id == -1 && $this->name == 'Anonymous';
}
public function profileUrl()
{
return route('viewUser', [
'idOrAlias' => (!empty($this->profile_alias) ? trim(strtolower($this->profile_alias)) : $this->id)
]);
}
public function publicDisplayName()
{
return trim(!empty($this->profile_alias) ? $this->profile_alias : $this->name);
}
}