aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorMikael Nordfeldth <mmn@hethane.se>2016-02-25 15:48:37 +0100
committerMikael Nordfeldth <mmn@hethane.se>2016-02-25 20:13:00 +0100
commit6336248d718fa35bc6766d6fcf031bfd1f8457c2 (patch)
treebf05633f7ff7d9f06234652d3a2847c4ded2de17 /classes
parent67aff528f526a5fcbec5544b1bb32da6ebce5886 (diff)
downloadgnu-social-6336248d718fa35bc6766d6fcf031bfd1f8457c2.tar
gnu-social-6336248d718fa35bc6766d6fcf031bfd1f8457c2.zip
Notice getRendered() can now be called on uninserted notices
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index ccd398003d..07406cc2fd 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -260,7 +260,8 @@ class Notice extends Managed_DataObject
public function getRendered()
{
- if (is_null($this->rendered) || $this->rendered === '') {
+ // we test $this->id because if it's not inserted yet, we can't update the field
+ if (!empty($this->id) && (is_null($this->rendered) || $this->rendered === '')) {
// update to include rendered content on-the-fly, so we don't have to have a fix-up script in upgrade.php
common_debug('Rendering notice '.$this->getID().' as it had no rendered HTML content.');
$orig = clone($this);
@@ -854,8 +855,7 @@ class Notice extends Managed_DataObject
}
// Strip out any bad HTML
$stored->rendered = common_purify($content);
- // yeah, just don't use getRendered() here since it's not inserted yet ;)
- $stored->content = common_strip_html($stored->rendered);
+ $stored->content = common_strip_html($stored->getRendered(), true, true);
if (trim($stored->content) === '') {
// TRANS: Error message when the plain text content of a notice has zero length.
throw new ClientException(_('Empty notice content, will not save this.'));