summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-27 16:06:46 -0500
committerEvan Prodromou <evan@status.net>2010-02-27 16:06:46 -0500
commit4d9daf21493e75354190667e5c1ab3140b46dee1 (patch)
tree9888358c25c1aba5eb2804bdf52a6dd5c9e2275d /classes
parent45a6ecf26dae0dfc2ba4f9f968794e87cdf68ecb (diff)
Use notice for context when deciding who @nickname refers to
In a federated system, "@nickname" is insufficient to uniquely identify a user. However, it's a very convenient idiom. We need to guess from context who 'nickname' refers to. Previously, we were using the sender's profile (or what we knew about them) as the only context. So, we assumed that they'd be mentioning to someone they followed, or someone who followed them, or someone on their own server. Now, we include the notice information for context. We check to see if the notice is a reply to another notice, and if the author of the original notice has the nickname 'nickname', then the mention is probably for them. Alternately, if the original notice mentions someone with nickname 'nickname', then this notice is probably referring to _them_. Doing this kind of context sleuthing means we have to render the content very late in the notice-saving process.
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 2d02a9a19..6614f3d55 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