summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php17
-rw-r--r--classes/Subscription.php22
2 files changed, 32 insertions, 7 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 2d02a9a19..3702dbcfa 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -282,12 +282,6 @@ class Notice extends Memcached_DataObject
$notice->content = $final;
- if (!empty($rendered)) {
- $notice->rendered = $rendered;
- } else {
- $notice->rendered = common_render_content($final, $notice);
- }
-
$notice->source = $source;
$notice->uri = $uri;
$notice->url = $url;
@@ -315,6 +309,12 @@ class Notice extends Memcached_DataObject
$notice->location_ns = $location_ns;
}
+ if (!empty($rendered)) {
+ $notice->rendered = $rendered;
+ } else {
+ $notice->rendered = common_render_content($final, $notice);
+ }
+
if (Event::handle('StartNoticeSave', array(&$notice))) {
// XXX: some of these functions write to the DB
@@ -973,7 +973,10 @@ class Notice extends Memcached_DataObject
$sender = Profile::staticGet($this->profile_id);
- $mentions = common_find_mentions($this->profile_id, $this->content);
+ // @todo ideally this parser information would only
+ // be calculated once.
+
+ $mentions = common_find_mentions($this->content, $this);
$replied = array();
diff --git a/classes/Subscription.php b/classes/Subscription.php
index d6fb3fcbd..9cef2df1a 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -172,6 +172,28 @@ class Subscription extends Memcached_DataObject
assert(!empty($sub));
+ // @todo: move this block to EndSubscribe handler for
+ // OMB plugin when it exists.
+
+ if (!empty($sub->token)) {
+
+ $token = new Token();
+
+ $token->tok = $sub->token;
+
+ if ($token->find(true)) {
+
+ $result = $token->delete();
+
+ if (!$result) {
+ common_log_db_error($token, 'DELETE', __FILE__);
+ throw new Exception(_('Couldn\'t delete subscription OMB token.'));
+ }
+ } else {
+ common_log(LOG_ERR, "Couldn't find credentials with token {$token->tok}");
+ }
+ }
+
$result = $sub->delete();
if (!$result) {