Commit Graph

93 Commits

Author SHA1 Message Date
Kevin Mehall 8c7f1ecffa bugdown: Don't generate garbage on invalid links.
LinkPattern returned a string which contained a placeholder if the URL was
considered invalid. AtomicLinkPattern wrapped this in an AtomicString,
where the placeholder doesn't get removed properly.

m.group(0) is always incorrect because python-markdown modifies your regex
to include more than you specified (this is why part of the message got
duplicated).

(imported from commit 576bdf09c2b677cf4bc56484c363eb05f2110158)
2013-09-18 16:22:13 -04:00
Kevin Mehall 63cff6eb71 Make populate_db set the is_bot flag on bot accounts.
(imported from commit 93a507faa2b19fde05376fd73ed3a65149cfce68)
2013-09-18 16:16:17 -04:00
Leo Franchi d88266b41d Warn bot owners when a bot sends a message to a nonexistent stream
(imported from commit 2499d7bd9d176a7ab43f751eb855813d0a479bd4)
2013-09-18 15:54:13 -04:00
Leo Franchi 5441e36167 Bulk update messages in deprecated cache when updating message
(imported from commit 5e68e4eec83c0ed02b9997b0cb3f93ce8f0a7fdd)
2013-09-18 13:27:58 -04:00
Leo Franchi c588c7938c Allow message topic changing to propagate backwards
(imported from commit 470178ef5f7aaf09d4528c88ae6e33f17538fcaf)
2013-09-18 13:27:58 -04:00
Steve Howell 30b6f54a36 Don't cache UserPresence info.
(imported from commit ff590bdf5d84bb9b3cedc561c2f2fbf7f7592a66)
2013-09-17 14:51:56 -04:00
Jessica McKellar 97e6709d49 uploads: have upload_image_to_s3 take file data instead of a file object.
We have to read the data anyway, and we don't have a convenient file
handle for uploads from attachments sent through the e-mail gateway.

(imported from commit 86260a4eaceef85c82707929a80558e11dc54ef6)
2013-09-17 10:00:01 -04:00
Jessica McKellar 8a40fb346c Be able to upload images to S3 from outside the web client.
We'll need this to upload attachments sent through the email gateway.

(imported from commit b2f5eb736b65f1478189c3aebd4cb37f1ad540fb)
2013-09-17 10:00:01 -04:00
Jessica McKellar cfeaa2be9b Add backend support for realm admins to rename streams.
(imported from commit eaf419f1f68dfd350b8c99e8a5089ec316f0c409)
2013-09-16 16:16:13 -04:00
Steve Howell 1836d8958e Add comment about sending presence updates
(imported from commit da9c521a6ad652e4dbcaabcc3a24b3e23376f545)
2013-09-16 11:29:13 -04:00
Steve Howell 83e517fcf9 Flush cache on all user presence updates.
(imported from commit 130eac36f9932350a29ed88f11dd3e2f6bf3f979)
2013-09-16 11:29:13 -04:00
Steve Howell 7868787ae0 Fix indentation level in cache_save_user_profile().
(imported from commit d4dff41fa7913b15a65e10fbafb5b7b49d6b6837)
2013-09-16 11:29:13 -04:00
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 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 b7ef86bc34 Added /json/set_muted_topics
(imported from commit e9072cd273fabf0e072b6a5e9ed80b07142f1013)
2013-09-11 16:47:37 -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
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
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
Scott Feeney b8dc9cc198 Send you the subscribers list when you add a subscription
(imported from commit 810de1f03c6765ef1c5476df30aff4c467783cab)
2013-09-06 23:13:47 -04:00
Scott Feeney f9cfa6b5f7 Include subscriber list in page_params.stream_list
(imported from commit 7f03eec37c7cbdcdefb590c39a76444bd1b55230)
2013-09-06 23:13:47 -04:00
Scott Feeney c46007e08e When a user subscribes to a stream, notify other stream subscribers
This is a backend-only change. No frontend code that uses this is
included.

(imported from commit 4bc379de3bbfc0975ff939fa5895d716a4d1ff1b)
2013-09-06 23:13:47 -04:00
Scott Feeney 65ed20469e Split out get_subscribers method on backend
(imported from commit b5941ff90bbf5b31a9fa31aa83e5d1856d483dcc)
2013-09-06 23:13:47 -04:00
Leo Franchi cf59f07fed Replace alert_words as event contains full list
(imported from commit 489975f8bcbd0c3bcec07dd5ed62de5cae686140)
2013-09-06 16:05:08 -04:00
Leo Franchi a67d461139 Hoist joining of message content in alert_words processor
(imported from commit 5025b7108839ddc04d6d9e575a9a288223526fe8)
2013-09-06 16:05:08 -04:00
Leo Franchi 7d76c47321 Re-enable alert word bugdown processor for staging
(imported from commit a9fb8284a47d18b97b84d3ce37482132b21d3885)
2013-09-06 14:51:40 -04:00
Leo Franchi 8ad6a0daa9 Cache realm alert_words to avoid database hits when rendering
We found that since bugdown processes are threaded, the cost of
doing a db query in a markdown processor is quite high---each
thread must start up a new db connection including a SSL handshake
etc. We should strive to keep our rendering pipeline free of mandatory
DB queries.

(imported from commit 555066bd03da6c681b74ce6137acc264eb41c55d)
2013-09-06 14:50:25 -04:00
Leo Franchi 7b375634f9 Temporarily disable alert_words markdown processor on staging
(imported from commit ab3eed4ce36ebcd3d928d2d92fc34c9ebacc11f9)
2013-09-06 13:39:26 -04:00
acrefoot 592e1ead6b Actually use the realm specified by the email mirror when doing the markdown
(imported from commit 00b909b1d0c70a3523ab53d2f91815ab14ba2a6f)
2013-09-05 18:24:55 -04:00
Zev Benjamin cb78014eef bugdown: Allow block-level block quotes
It is triggered by specifying the "language" of a code block to
"quote" or "quoted":
    Hamlet said:
    ~~~ quote
    To be or **not** to be.

    That is the question
    ~~~

(imported from commit 847a0602e335e9f2955e32d9955adf8ac8de068c)
2013-09-05 17:34:28 -04:00
Zev Benjamin dd26260884 bugdown: Clarify variable name
(imported from commit 27968536bd6a3fcda6d26d8dde7f82d9f0990dd2)
2013-09-05 17:34:28 -04:00
Zev Benjamin 2f1551e745 Replace comment references to trac.humbughq.com with trac.zulip.net
(imported from commit 231d0884345be525d58ce51f48a76bba6960f09d)
2013-09-05 15:43:08 -04:00
Zev Benjamin 5c81148839 Switch our trac realm filter to use trac.zulip.net
(imported from commit 19163f5be01a1d9370d9ed45c55bedd670772dac)
2013-09-05 15:43:07 -04:00
Tim Abbott ce710292ca Always use external-content.zulipcdn.net for mit.edu realm.
(imported from commit 21d1101185bf52f21fcc345e791217311e9c0a13)
2013-09-05 14:35:42 -04:00
Tim Abbott b557b94d0b bugdown: Rewrite image urls to avoid mixed-content warnings.
(imported from commit fc0a41befb04f2a8aad2937a856366ac3cadb192)
2013-09-05 14:35:29 -04:00
Tim Abbott cdfc6dc10a bugdown: Fetch youtube preview images over HTTPS.
(imported from commit 9dbf3c21083cbbcf1288789f400c33ec735d4416)
2013-09-05 14:35:29 -04:00
Leo Franchi b2ddd670e4 [schema] Add backend support for per-user alert words
(imported from commit 7a9c596a010cbedbddf594c5d9c68bb9ed46d122)
2013-09-05 10:18:40 -04:00
Kevin Mehall 19a835e7d5 Add a checkbox that propagates topic edits to subsequent messages.
Trac #1348

(imported from commit 28e2a8cb3ecda5ec50d17501f4ccbd8644212065)
2013-09-04 14:51:46 -04:00
Leo Franchi 7e6af0a5d0 Mark messages from the desktop app as sent_by_human
(imported from commit 001073221387cbbaa541b17f9a377490562a28f1)
2013-09-04 11:00:11 -04:00
Tim Abbott eeb04ed78e deactivate_user: Only delete sessions that aren't expired.
(imported from commit e3d844a55581a7e7faab8ea9ed6703480fae8f51)
2013-09-03 11:40:42 -04:00
Scott Feeney e3247de572 Factor out get_active_user_profiles_by_realm()
(imported from commit 634ebf265b02303a938f7595de3622e25bc22b49)
2013-08-29 10:28:20 -04:00
Tim Abbott ac1f9b5128 check_message: Allow zephyr mirroring bot to send to invite-only streams.
(imported from commit d45c75915cc4e29328768f1ed0e0ec972e5b7269)
2013-08-28 19:07:05 -04:00
Tim Abbott 5b62101a5f check_message: Clean up confusing and redundant authorization checks.
(imported from commit 1b756c89ec740f988e8f15d21fb413de9947d658)
2013-08-28 19:07:05 -04:00
Tim Abbott 591b42bb1c bugdown: Clarify code around inline_interesting_links processor.
(imported from commit a1d734230135ab9099fafea7814bfec25754ea4e)
2013-08-28 18:56:53 -04:00
Jessica McKellar f67f5b7619 Allow superusers to send messages to even private streams.
(imported from commit b7253174fa25d61b5bda056a5e5353e3b8ea918b)
2013-08-28 16:43:40 -04:00
Jessica McKellar d72ed33dc6 Be more verbose and explicit in the checks on who can send a message.
It was getting hard to follow and is going to get more complicated
with a new super user check in a later commit.

(imported from commit 8d5cfa960824519d87ce0f09aab3a120ba9ef357)
2013-08-28 16:43:40 -04:00
Steve Howell 5b598a6d9c Avoid churning the cache for stream name changes that don't change the cache key.
(imported from commit 1cc1ed01eaaaec4e6ddd6901fb5b877f831b604c)
2013-08-28 13:34:26 -04:00