try to clean up user-without-profile errors

darcs-hash:20080926145008-5ed1f-8a60ed3c5adbfe75aa044732e8d10dbdb9b93089.gz
This commit is contained in:
Evan Prodromou 2008-09-26 10:50:08 -04:00
parent cb265a2d8d
commit 7ff02bb7d4
8 changed files with 35 additions and 0 deletions

View File

@ -68,6 +68,9 @@ class AllrssAction extends Rss10Action {
function get_image() {
$user = $this->user;
$profile = $user->getProfile();
if (!$profile) {
return NULL;
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
return ($avatar) ? $avatar->url : NULL;
}

View File

@ -92,6 +92,7 @@ class NoticesearchAction extends SearchAction {
$profile = $notice->getProfile();
if (!$profile) {
common_log_db_error($notice, 'SELECT', __FILE__);
$this->server_error(_('Notice without matching profile'));
return;
}
# XXX: RDFa

View File

@ -110,6 +110,12 @@ class ProfilesettingsAction extends SettingsAction {
$user = common_current_user();
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
$this->server_error(_('User without matching profile'));
return;
}
$original = $profile->getOriginalAvatar();

View File

@ -313,7 +313,14 @@ class RemotesubscribeAction extends Action {
$req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname));
$req->set_parameter('omb_listenee_nickname', $user->nickname);
$req->set_parameter('omb_listenee_license', $config['license']['url']);
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
$this->server_error(_('User without matching profile'));
return;
}
if ($profile->fullname) {
$req->set_parameter('omb_listenee_fullname', $profile->fullname);
}

View File

@ -84,6 +84,9 @@ class RepliesrssAction extends Rss10Action {
function get_image() {
$user = $this->user;
$profile = $user->getProfile();
if (!$profile) {
return NULL;
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
return ($avatar) ? $avatar->url : NULL;
}

View File

@ -252,6 +252,11 @@ class ShowstreamAction extends StreamAction {
$other = Profile::staticGet($subs->subscribed);
if (!$other) {
common_log_db_error($subs, 'SELECT', __FILE__);
continue;
}
common_element_start('li');
common_element_start('a', array('title' => ($other->fullname) ?
$other->fullname :

View File

@ -154,6 +154,11 @@ class UserauthorizationAction extends Action {
$params['omb_version'] = OMB_VERSION_01;
$user = User::staticGet('uri', $req->get_parameter('omb_listener'));
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
$this->server_error(_('User without matching profile'));
return;
}
$params['omb_listener_nickname'] = $user->nickname;
$params['omb_listener_profile'] = common_local_url('showstream',
array('nickname' => $user->nickname));

View File

@ -74,6 +74,11 @@ class UserrssAction extends Rss10Action {
function get_image() {
$user = $this->user;
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
$this->server_error(_('User without matching profile'));
return NULL;
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
return ($avatar) ? $avatar->url : NULL;
}