Brion Vibber [Thu, 4 Nov 2010 00:25:29 +0000 (17:25 -0700)]
Fix for ticket #2804: bad non-cache fallback code for dupe checks of prolific posters
The old code attempted to compare the value of the notice.created field against now() directly, which tends to explode in our current systems. now() comes up as the server/connection local timezone generally, while the created field is currently set as hardcoded UTC from the web servers. This would lead to breakage when we got a difference in seconds that's several hours off in either direction (depending on the local timezone). New code calculates a threshold by subtracting the number of seconds from the current UNIX timestamp and passing that in in correct format for a simple comparison. As a bonus, this should also be more efficient, as it should be able to follow the index on profile_id and created.
Brion Vibber [Wed, 3 Nov 2010 21:04:08 +0000 (14:04 -0700)]
UserFlagPlugin fix for ticket #2118 and ticket #2847: flagged state wasn't reflected in profile lists such as group members page and profile search .
Pulled common code for the profile page and profile list cases to give them the same logic on checking. Also fixes the problem that you'd get a flag button for yourself in profile lists, while we explicitly exclude that from the profile page -- it's now skipped in both places.
Brion Vibber [Wed, 3 Nov 2010 20:11:34 +0000 (13:11 -0700)]
Use Profile->getBestName() in PersonalGroupNav instead of manually picking nickname vs fullname. Logic should still work the same when no nickname is provided, but it doesn't make any sense -- probably needs cleanup. :)
Brion Vibber [Wed, 3 Nov 2010 20:10:42 +0000 (13:10 -0700)]
Migrate some more code from manually constructing "fullname (nickname)" to using Profile->getFancyName(). Encapsulates common logic and allows for localization of the parens.
Brion Vibber [Wed, 3 Nov 2010 19:59:19 +0000 (12:59 -0700)]
General cleanup & part of ticket #2864: use User_group->getFancyName() instead of replicating the logic in various places. Encapsulates and allows for localization of parens.
Brion Vibber [Wed, 3 Nov 2010 19:53:51 +0000 (12:53 -0700)]
Add getFancyName() to User_group to match the one on Profile: encapsulates the "fullname (nickname)" vs "nickname" logic and allows for localization of the parentheses in a common place.
Brion Vibber [Wed, 3 Nov 2010 19:32:11 +0000 (12:32 -0700)]
Fix for ticket #2168: if we've already flagged a profile from another window, let the 'Flag' form submission gracefully show the updated state instead of throwing an error (error message isn't even exposed properly in AJAX submissions)
Brion Vibber [Wed, 3 Nov 2010 19:20:25 +0000 (12:20 -0700)]
UserFlag fixes to prevent PHP notices breaking AJAX submissions when display_errors is on. Key & seq defs weren't quite right, which caused accesses to unset array indices in DB_DataObject.
Brion Vibber [Tue, 2 Nov 2010 20:05:16 +0000 (13:05 -0700)]
Tossing in a basic i18n message export to script code. Plugins can hook StartScriptMessage/EndScriptMessage, or directly add needed mappings in Action::getScriptMessages(). Exported entries are accessible as SN.msg(key) at runtime.
StatusNet core code now sets the tooltip text on .attachment.more links when they receive their attachment-expansion magic; this will override the hardcoded tooltip text saved from OStatus plugin when displaying timelines in the web UI.
Brion Vibber [Tue, 2 Nov 2010 18:39:38 +0000 (11:39 -0700)]
Starting on making Realtime plugin's UI messages localizable: pause/play, popup button text and tooltip text are now loaded from PHP code where we can get at gettext.
Brion Vibber [Fri, 29 Oct 2010 01:26:48 +0000 (18:26 -0700)]
Work in progress: starting on new TwitterDaemon using the Site Streams API -- code is incomplete, pulling bits from streamtest.php pending a chance to test the actual site-streams mode
Brion Vibber [Thu, 28 Oct 2010 19:58:30 +0000 (12:58 -0700)]
Kill a ping queue item if we get an error on loading up the notice's poster's profile, rather than letting the item be retried over and over as if it were a transitory error.
This shouldn't generally happen as it's an indicator of database inconsistency, but it's a condition we know happens.
Fields:
* action: case-normalized name of the action class we're acting on
* method: GET, POST, HEAD, etc
* ssl: Are we on HTTPS? 'yes' or 'no'
* query: Were we sent a query string? 'yes', 'no', or 'since_id' if the only parameter is a since_id
* cookie: Were we sent any cookies? 'yes' or 'no'
* auth: Were we sent an HTTP Authorization header? 'yes' or 'no'
* ifmatch: Were we sent an HTTP If-Match header for an ETag? 'yes' or 'no'
* ifmod: Were we sent an HTTP If-Modified-Since header? 'yes' or 'no'
* agent: User-agent string, to aid in figuring out what these things are
The most shared-cache-friendly requests will be non-SSL GET requests with no or very predictable
query parameters, no cookies, and no authorization headers. Private caching (eg within a supporting
user-agent) could still be friendly to SSL and auth'd GET requests.
We kind of expect that the most frequent hits from clients will be GETs for a few common timelines,
with auth headers, a since_id-only query, and no cookies. These should at least be amenable to
returning 304 matches for etags or last-modified headers with private caching, but it's very
possible that most clients won't actually think to save and send them. That would leave us expecting
to handle a lot of timeline since_id hits that return a valid API response with no notices.
At this point we don't expect to actually see if-match or if-modified-since a lot since most of our
API responses are marked as uncacheable; so even if we output them they're not getting sent back to
us.
Random subsampling can be enabled by setting the 'frequency' parameter smaller than 1.0:
addPlugin('ApiLogger', array(
'frequency' => 0.5 // Record 50% of API hits
));