forked from GNUsocial/gnu-social
Moved shareLocation preference check to Profile class
This commit is contained in:
@@ -955,7 +955,7 @@ class Profile extends Managed_DataObject
|
||||
|
||||
// XXX: identical to Notice::getLocation.
|
||||
|
||||
function getLocation()
|
||||
public function getLocation()
|
||||
{
|
||||
$location = null;
|
||||
|
||||
@@ -978,6 +978,29 @@ class Profile extends Managed_DataObject
|
||||
return $location;
|
||||
}
|
||||
|
||||
public function shareLocation()
|
||||
{
|
||||
$cfg = common_config('location', 'share');
|
||||
|
||||
if ($cfg == 'always') {
|
||||
return true;
|
||||
} else if ($cfg == 'never') {
|
||||
return false;
|
||||
} else { // user
|
||||
$share = common_config('location', 'sharedefault');
|
||||
|
||||
// Check if user has a personal setting for this
|
||||
$prefs = User_location_prefs::getKV('user_id', $this->id);
|
||||
|
||||
if (!empty($prefs)) {
|
||||
$share = $prefs->share_location;
|
||||
$prefs->free();
|
||||
}
|
||||
|
||||
return $share;
|
||||
}
|
||||
}
|
||||
|
||||
function hasRole($name)
|
||||
{
|
||||
$has_role = false;
|
||||
|
||||
Reference in New Issue
Block a user