Commit Graph

6320 Commits

Author SHA1 Message Date
Steve Howell 85f9b6695f Optimize user presence/activity query.
The get_status_dict_by_realm helper gets called whenever our
 realm user_presences cache expires, and it used to query these fields:

    "zerver_userpresence"."id", "zerver_userpresence"."user_profile_id", "zerver_userpresence"."client_id", "zerver_userpresence"."timestamp", "zerver_userpresence"."status", "zerver_userprofile"."id", "zerver_userprofile"."password", "zerver_userprofile"."last_login", "zerver_userprofile"."is_superuser", "zerver_userprofile"."email", "zerver_userprofile"."is_staff", "zerver_userprofile"."is_active", "zerver_userprofile"."is_bot", "zerver_userprofile"."date_joined", "zerver_userprofile"."bot_owner_id", "zerver_userprofile"."full_name", "zerver_userprofile"."short_name", "zerver_userprofile"."pointer", "zerver_userprofile"."last_pointer_updater", "zerver_userprofile"."realm_id", "zerver_userprofile"."api_key", "zerver_userprofile"."enable_desktop_notifications", "zerver_userprofile"."enable_sounds", "zerver_userprofile"."enter_sends", "zerver_userprofile"."enable_offline_email_notifications", "zerver_userprofile"."last_reminder", "zerver_userprofile"."rate_limits", "zerver_userprofile"."avatar_source", "zerver_userprofile"."tutorial_status", "zerver_userprofile"."onboarding_steps", "zerver_userprofile"."invites_granted", "zerver_userprofile"."invites_used", "zerver_userprofile"."alert_words", "zerver_userprofile"."muted_topics", "zerver_client"."id", "zerver_client"."name"

Now it queries just the fields it needs:

  "zerver_client"."name", "zerver_userpresence"."status", "zerver_userpresence"."timestamp", "zerver_userprofile"."email" FROM "zerver_userpresence"

Also, get_status_dict_by_realm is now namespaced under UserPresence as a static method.

(imported from commit be1266844b6bd28b6c615594796713c026a850a1)
2013-09-16 11:29:10 -04:00
Steve Howell 0d2c6f756f Remove code to pre-fetch presence objects.
(imported from commit 546e98bedd809e66f506581434402caad5a984de)
2013-09-16 11:28:47 -04:00
Steve Howell e881fdd2ff Change the cache timeout for get_status_dict() back to a minute.
This function gets user presence information, which changes rapidly
and requires a pretty simple query.

(imported from commit f9b9f0f22277335c76eb4371930a4fff2758a240)
2013-09-16 11:24:29 -04:00
Steve Howell 99dd2ed8df Add presences info to the event data for process_new_message().
The do_send_messages() populates the user_presences data structure
for process_new_message(), so that Tornado code never needs to hit
the database or memcached to get the user presence info.

(imported from commit 194aeaead8fa712297a2ee8aff5aa773b92f1207)
2013-09-16 11:24:12 -04:00
Leo Franchi a4744b10ed Better logging for error diagnosis
(imported from commit a2fc108ca1230b671c7e35651e3d53042386b4bd)
2013-09-13 17:56:16 -04:00
Leo Franchi 6e56342cf6 Send missedmessage notifications if user is idle for >1hr
(imported from commit 573f46a77497cb2f73eae3b4a648e466977e6247)
2013-09-13 17:33:34 -04:00
Leo Franchi 7bb96bd36b Extract data from cache in tornado_callbacks with cache_get_many
This reduces the number of memcached calls we make in our time-
slice-limited tornado event handler.

(imported from commit 8903ce4ac754ba82d57e04d1b0356be7533edee2)
2013-09-13 17:33:34 -04:00
Steve Howell 5eaeddea12 Get stream_data.js back to 100% coverage
(imported from commit 5b82a10d50b6599c0c42604fe86275b21f9a6396)
2013-09-12 17:23:52 -04:00
Jessica McKellar 272921800a Open the composebox on sidebar subject selection.
This was requested by CUSTOMER28 and would also bring symmetry with
the user sidebar, which already does this.

(imported from commit 4dca3c957d3a710f00bbb34a7cd7dfe6074da8f7)
2013-09-12 06:04:03 -04:00
Leo Franchi f559d27190 Remove stale new-user and redirect to /hello
(imported from commit e32946dea1512fa2593f3e9023c40a5541289dcd)
2013-09-11 18:10:17 -04:00
Leo Franchi f86c8255bb Safety check for stream_data:[add|remove]_subscriber
Though this should not be common, getting a peer subscribed/
unsubscribed notification to a stream we don't yet know about should
not be fatal

(imported from commit ee28b163e0efc9adfad31e1b321e986dfe56271e)
2013-09-11 18:10:17 -04:00
Steve Howell 0165dc54ad Create blueslip error for undefined keys in Dict.
We create a blueslip error for undefined keys in Dict.  This led
to a straightforward change in the unit tests for Dict.  For the
unread test, to avoid the blueslip error, we had to be more specific
in setting up a user in one place, but this reduced our coverage,
leading to another small test being added.

(imported from commit 33e14795500d9283de2a7c03c4c58aec11cea4b8)
2013-09-11 18:07:37 -04:00
Steve Howell 9eefc8ae62 Test fold_case option of Dict
(imported from commit 630643767a21818c1ef4adb557c794e560783c3e)
2013-09-11 18:07:37 -04:00
Steve Howell e9adaaa0c0 Avoid Dict crashes for undefined keys when fold_case is true.
The exceptions were cryptic before, and they were inconsistent with
the fold_case: false behavior.

(imported from commit a40704d1a22bcdc60d91be832ee3c81eb416c6dd)
2013-09-11 18:07:37 -04:00
Steve Howell a8ebd80c89 Test that vanilla Dict handles undefined keys
(imported from commit 09846eafa55f2321ca10db950ad3785ce78ae2c6)
2013-09-11 18:07:37 -04:00
Jeff Arnold 651aefbe65 Updated top /hello screenshots
(imported from commit c1a4e706dc82d7877bc0b5366fc23c5487619454)
2013-09-11 17:37:24 -04:00
Steve Howell 6c25a70788 Avoid double-rendering muting updates
(imported from commit 359fdc03862d78729c5b5fbe6df277e571c7315c)
2013-09-11 16:47:38 -04:00
Steve Howell a1addad450 Handle muting updates
(imported from commit 219a817c494f7bc27642d96f203f686df28bb361)
2013-09-11 16:47:37 -04:00
Steve Howell b4b6fa14d3 Persist muting preferences to the back end
(imported from commit db2d4362a0601f35a75b798cf6945556e44532fb)
2013-09-11 16:47:37 -04:00
Steve Howell b7ef86bc34 Added /json/set_muted_topics
(imported from commit e9072cd273fabf0e072b6a5e9ed80b07142f1013)
2013-09-11 16:47:37 -04:00
Steve Howell 21456091e4 [schema] Add muted_topics to UserProfile
(imported from commit 5d804259be94ba83dc4f7541e50443dd1a42cc6b)
2013-09-11 16:47:37 -04:00
Steve Howell 042f5bda26 Add unmuting to message actions menu
(imported from commit 5188a36ec73aa2913b0d82f7e7ce12be78f4ccee)
2013-09-11 16:47:37 -04:00
Steve Howell b65f9b678b Add muting to message actions menu
(imported from commit 26568e36f2a41f2b85413ab4d069a689c9901aac)
2013-09-11 16:47:36 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Allen Rabinovich 3560ecf429 Better date separator rendering
Split up long string

(imported from commit 51bab3cbb2d77f0e130d6bb0d486f2d7feba0909)
2013-09-11 11:50:17 -07:00
Steve Howell 8d67fc2775 Add semantic classes for expanding/collapsing messages
(imported from commit 9d71fd46667058ba92d941b79d6e2c822c721efe)
2013-09-11 14:42:25 -04:00
Steve Howell 8cab575854 Add cursor:pointer style for expand/collapse icons
(imported from commit 31b0aa1e3d6a2a4406fbc6e9bad6d436258b9a72)
2013-09-11 14:15:16 -04:00
Steve Howell fcc268b44f Add expectOne() check when clicking to expand/collapse
(imported from commit 7224f618f49de82bd41a5a1f4b0677cf490b5856)
2013-09-11 14:13:17 -04:00
Steve Howell 4bec9dced9 Add expectOne() check when hitting enter to expand
(imported from commit 21b76133c95a4a48873d34ca905a688637cef2b7)
2013-09-11 14:13:17 -04:00
Leo Franchi a408192f92 Don't re-parse alert words more than necessary
(imported from commit 4fee6ad9592c1dc5f844889fcb6586192de6cb35)
2013-09-11 12:00:37 -04:00
Jessica McKellar 171306a37d Don't include not in home view messages towards bankrupcty unread count.
(imported from commit 64c038f1d41c091c88875f2c90e9b4dd695308a3)
2013-09-11 01:29:45 -04:00
Waseem Daher ad66b2244c norman-mailer: Add ability to use multiple templates.
(imported from commit a896ce14408c75c7dcf520439a3e7a6ff463e8a9)
2013-09-10 21:24:03 -05:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00
Jeff Arnold effccb12ab Enable summarizing for CUSTOMER4
(imported from commit ce9f4a50a49a005e4801df73661299e2a8de7abf)
2013-09-10 16:48:47 -04:00
Leo Franchi 2eb8c6aae3 Add documentation and a duration argument to analyze_user_activity.py
(imported from commit 5668ec02a23dcfeb29760b55d8acee17cfdea9cf)
2013-09-10 13:25:59 -04:00
Leo Franchi 9ebb536c2d Use json_to_bool in REQ instead of manually using ujson.loads
(imported from commit 5a607f7aba4a8e4e5920a35df06c375cff98ff55)
2013-09-10 13:25:59 -04:00
Leo Franchi a1d7e6336c Add stub for .on() in activity test
(imported from commit 82727e18739cb8bed7b2c64f8013e7f0fe386b94)
2013-09-10 13:25:59 -04:00
Tim Abbott 9fcca3df4e [schema] Collect data on when users are active on site.
These engagement data will be useful both for making pretty graphs of
how addicted our users are as well as for allowing us to check whether
a new deployment is actually using the product or not.

This measures "number of minutes during which each user had checked
the app within the previous 15 minutes".  It should correctly not
count server-initiated reloads.

It's possible that we should use something less aggressive than
mousemove; I'm a little torn on that because you really can check the
app for new messages without doing anything active.

This is somewhat tested but there are a few outstanding issues:

* Mobile apps don't report these data.  It should be as easy as having
  them send in update_active_status queries with new_user_input=true.

* The semantics of this should be better documented (e.g. the
  management script should print out the spec above)x.

(imported from commit ec8b2dc96b180e1951df00490707ae916887178e)
2013-09-10 13:25:59 -04:00
Steve Howell 5bcc403ea4 Add filter tests for is:alerted predicate
(imported from commit 077fdab5437f498f015da7ed81a77036c9ff6361)
2013-09-10 13:13:18 -04:00
Leo Franchi f70e899518 Use exec to launch unicorn so it dies when we kill the script
(imported from commit 59ca5b28f4d1674a0e904f191cc11dbdbf5fc289)
2013-09-10 10:26:24 -04:00
Leo Franchi e13c94b904 Add aggregation for reading stats
(imported from commit c344b9c2897bf95287c0f0df281b0567261c87f7)
2013-09-10 10:24:15 -04:00
Leo Franchi 7aedfbba14 Include all configuration bits for stats in puppet
(imported from commit 439c062dafd1167f465b6a1a0d8e6767dc6babeb)
2013-09-10 10:24:15 -04:00
Steve Howell 290be4c130 Roll out email forwarding to everybody
(imported from commit 1057272df8390c418890a2ac0939c05e0c1c403c)
2013-09-09 13:19:03 -04:00
Steve Howell 320eddcf6e Remove feature_flags.edit_appears_on_hover.
(imported from commit ff8b820d8f5c1bfe25ccb6856b5f206bd03663e0)
2013-09-09 13:16:11 -04:00
Kevin Mehall 810dd89621 Maintain a list of people in the realm.
people_list and people_dict include the feedback bot and anyone you've
cross-realm PM'd with. Useful for autocomplete, but not for admin and
stream settings views.

Fixes the UI part of Trac #1772.

(imported from commit cdefd4e86980447aad5190e7fc8ae3666d66e3c3)
2013-09-09 12:13:33 -04:00