We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit c1e3b2f0 authored by Evan Prodromou's avatar Evan Prodromou

remove namespace setting from location; it's unused

parent 33786b2c
......@@ -164,19 +164,6 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
$lat = $this->trimmed('lat');
$lon = $this->trimmed('lon');
$location_id = $this->trimmed('location_id');
$location_ns = $this->trimmed('location_ns');
if (!empty($lat) && !empty($lon) && empty($location_id)) {
$location = Location::fromLatLon($lat, $lon);
if (!empty($location)) {
$location_id = $location->location_id;
$location_ns = $location->location_ns;
}
}
$upload = null;
$upload = MediaFile::fromUpload('attach');
......@@ -195,12 +182,30 @@ class NewnoticeAction extends Action
}
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web',
array('reply_to' => ($replyto == 'false') ? null : $replyto,
'lat' => $lat,
'lon' => $lon,
'location_id' => $location_id,
'location_ns' => $location_ns));
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
if ($user->shareLocation()) {
$lat = $this->trimmed('lat');
$lon = $this->trimmed('lon');
$location_id = $this->trimmed('location_id');
$location_ns = $this->trimmed('location_ns');
if (!empty($lat) && !empty($lon) && empty($location_id)) {
$location = Location::fromLatLon($lat, $lon);
if (!empty($location)) {
$location_id = $location->location_id;
$location_ns = $location->location_ns;
}
}
$options['lat'] = $lat;
$options['lon'] = $lon;
$options['location_id'] = $location_id;
$options['location_ns'] = $location_ns;
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
if (isset($upload)) {
$upload->attachToNotice($notice);
......
......@@ -133,6 +133,11 @@ class ProfilesettingsAction extends AccountSettingsAction
($this->arg('location')) ? $this->arg('location') : $profile->location,
_('Where you are, like "City, State (or Region), Country"'));
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('sharelocation', _('Share my current location when posting notices'),
($this->arg('sharelocation')) ?
$this->arg('sharelocation') : $user->shareLocation());
$this->elementEnd('li');
Event::handle('EndProfileFormData', array($this));
$this->elementStart('li');
$this->input('tags', _('Tags'),
......
......@@ -996,4 +996,20 @@ class User extends Memcached_DataObject
return $ids;
}
function shareLocation()
{
$share = true;
$prefs = User_location_prefs::staticGet('user_id', $this->id);
if (empty($prefs)) {
$share = common_config('location', 'share');
} else {
$share = $prefs->share_location;
$prefs->free();
}
return $share;
}
}
......@@ -226,7 +226,7 @@ $default =
'message' =>
array('contentlimit' => null),
'location' =>
array('namespace' => 1), // 1 = geonames, 2 = Yahoo Where on Earth
array(),
'omb' =>
array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates
'logincommand' =>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment