$notice->getProfile will ALWAYS return a Profile
otherwise it throws an exception
This commit is contained in:
parent
04d4b62dff
commit
3d807c812d
@ -143,6 +143,10 @@ class Notice extends Managed_DataObject
|
|||||||
|
|
||||||
protected $_profile = array();
|
protected $_profile = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will always return a profile, if anything fails it will
|
||||||
|
* (through _setProfile) throw a NoProfileException.
|
||||||
|
*/
|
||||||
public function getProfile()
|
public function getProfile()
|
||||||
{
|
{
|
||||||
if (!isset($this->_profile[$this->profile_id])) {
|
if (!isset($this->_profile[$this->profile_id])) {
|
||||||
@ -1317,19 +1321,17 @@ class Notice extends Managed_DataObject
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sender = Profile::getKV($this->profile_id);
|
$sender = $this->getProfile();
|
||||||
|
|
||||||
$replied = array();
|
$replied = array();
|
||||||
|
|
||||||
// If it's a reply, save for the replied-to author
|
// If it's a reply, save for the replied-to author
|
||||||
try {
|
try {
|
||||||
$parent = $this->getParent();
|
$parent = $this->getParent();
|
||||||
$author = $parent->getProfile();
|
$parentauthor = $parent->getProfile();
|
||||||
if ($author instanceof Profile) {
|
$this->saveReply($parentauthor->id);
|
||||||
$this->saveReply($author->id);
|
$replied[$parentauthor->id] = 1;
|
||||||
$replied[$author->id] = 1;
|
self::blow('reply:stream:%d', $parentauthor->id);
|
||||||
self::blow('reply:stream:%d', $author->id);
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Not a reply, since it has no parent!
|
// Not a reply, since it has no parent!
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user