Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly

This commit is contained in:
abjectio 2015-05-26 22:25:49 +02:00
commit 0200b1d784
4 changed files with 27 additions and 12 deletions

View File

@ -108,7 +108,13 @@ class Conversation extends Managed_DataObject
static public function getUrlFromNotice(Notice $notice, $anchor=true)
{
$conv = self::getKV('id', $notice->conversation);
$conv = new Conversation();
$conv->id = $notice->conversation;
$conv->find(true);
if (!$conv instanceof Conversation) {
common_debug('Conversation does not exist for notice ID: '.$notice->id);
throw new NoResultException($conv);
}
return $conv->getUrl($anchor ? $notice->id : null);
}

View File

@ -40,16 +40,19 @@ class Local_group extends Managed_DataObject
public function getProfile()
{
$group = $this->getGroup();
if (!$group instanceof User_group) {
return null; // TODO: Throw exception when other code is ready
}
return $group->getProfile();
return $this->getGroup()->getProfile();
}
public function getGroup()
{
return User_group::getKV('id', $this->group_id);
$group = new User_group();
$group->id = $this->group_id;
$group->find(true);
if (!$group instanceof User_group) {
common_log(LOG_ERR, 'User_group does not exist for Local_group: '.$this->group_id);
throw new NoResultException($group);
}
return $group;
}
function setNickname($nickname)

View File

@ -45,9 +45,11 @@
</IfModule>
<FilesMatch "\.(ini)">
# For mod_access_compat in Apache <2.4
#Order allow,deny
# Use this instead for Apache >2.4 (mod_authz_host)
# Require all denied
<IfVersion < 2.3>
Order allow,deny
Deny from all
</IfVersion>
<IfVersion >= 2.3>
Require all denied
</IfVersion>
</FilesMatch>

View File

@ -66,6 +66,10 @@ abstract class ProfileAction extends ManagedAction
$this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
$group = Local_group::getKV('nickname', $nickname);
if ($group instanceof Local_group) {
common_redirect($group->getProfile()->getUrl());
}
// TRANS: Client error displayed when calling a profile action without specifying a user.
$this->clientError(_('No such user.'), 404);
}