Commit Graph

6515 Commits

Author SHA1 Message Date
Steve Howell eb299bf5c8 Extract Message.build_message_dict()
(imported from commit 03395ea8fbffd0a52f85127c9a24f0cc3f4a6969)
2013-09-30 18:22:07 -04:00
Steve Howell 2a3747e21f Isolate message side effects in Message.to_dict_uncached().
Only call a function on the message object in the unfortunate
situation that we are rendering new content in to_dict_uncached().
Long term, it would be nice if this function didn't have side
effects, and we had a better strategy for upgrading rendered
content when bugdown versions change.

(imported from commit 2a323f52af37a6d651c171cb8234fbfa3d25d561)
2013-09-30 18:22:07 -04:00
Steve Howell f65462c891 Extract Message.need_to_render_content()
(imported from commit 466fa133ed1e8fb13b7222ba3bdcd5773d63de14)
2013-09-30 18:22:07 -04:00
Steve Howell 95254398f2 Extract get_avatar_url().
This function doesn't require the whole UserProfile object to
create the avatar url, and we call it from Message.to_dict_uncached().

(imported from commit e814caab101c4fedd1ba66df041a3408014e4085)
2013-09-30 18:22:06 -04:00
Steve Howell e4fb66fdf8 Isolate self-dot use in Message.to_dict_uncached().
For a bunch of self-dot references, move them to the top.  (This
is kind of funny out of context, but it sets us up for future
refactorings.)

(imported from commit 4ebc1c44a633d86772df1828c51180707769c3dc)
2013-09-30 18:20:55 -04:00
Steve Howell 005ad9c8e0 Kill off dead code in Message.to_dict_uncached().
If this line of code were ever called, it would crash anyway,
because it would be an unknown type, and Recipient.type_name()
would raise a KeyError.

(imported from commit db38c5f71fb2f0b044a832eb88e53fceb0d8a9cf)
2013-09-30 18:14:12 -04:00
Steve Howell dc077a708f Call get_display_recipient_by_id() in Message.to_dict_uncached().
This starts to make us less dependent on having full objects.

(imported from commit 5fb9504b077b676ecb697a909f4a0d2737f51efb)
2013-09-30 18:13:53 -04:00
Steve Howell a9fd6ddfce Extract get_display_recipient_by_id().
This is a variation of get_display_recipient that takes
values instead of an object, so that it is decoupled from
the Django object system.

(imported from commit 25bed43ecd62f1fe0176d517b7003e7f4c78bc37)
2013-09-30 18:11:29 -04:00
Steve Howell 3c802e1b02 Add MessageExtractorTest.test_applying_markdown()
(imported from commit 0e88f999a871e93ae14d157e0087a75ae81d60a3)
2013-09-30 18:08:32 -04:00
Steve Howell 8ae789eaf8 Add test_message_extractor_basics().
(imported from commit 37e64cd4db1850e04bd9fdc37de1f38400436736)
2013-09-30 18:08:32 -04:00
Steve Howell 515130396c Remove TEST_SUITE exception for get_display_recipient().
If it's ok for the tests to use memcached, it should be ok
for them to use the in-process cache too.

(imported from commit be43879c3c48f3780317fd5b4139b44d4a1f0ed3)
2013-09-30 18:08:31 -04:00
Steve Howell 826dffbbb4 Extracted Message.save_rendered_content().
This is a harmless extraction designed to allow subclasses override
the behavior of how rendered content gets saved.

(imported from commit 9df4ed9f86c857897fcb5f2b6781bfc5a0813766)
2013-09-30 18:08:31 -04:00
Steve Howell f36938c2f5 Extract Message.extractor
(imported from commit e6ee015cacdb0f6e1f725b7113f750e8b33d316b)
2013-09-30 18:08:29 -04:00
Leo Franchi 2614716fca Log slow queries to zulip so we notice them
(imported from commit 23f311ad881edda4c4495089ea3b55213470a059)
2013-09-30 17:41:56 -04:00
Tim Abbott 002e28d838 Display user's email in logs for requesting hitting /.
(imported from commit d272f22b8b4de9640a86b66d7833336cc8a9822a)
2013-09-30 17:14:05 -04:00
Tim Abbott e9ee05b2b2 gather_subscriptions: Avoid extra queries fetching realm objects.
(imported from commit 591083cfaff454b8ce48aacb5da7913b8fe0a38f)
2013-09-30 17:14:05 -04:00
Tim Abbott 5e420dc5c3 gather_subscriptions: Fetch subscribers using a bulk query.
(imported from commit 13c085d0ec55779279d31d3e301311ef1c9fd2c4)
2013-09-30 17:14:05 -04:00
Tim Abbott 3a3954a8c4 Extract validation for whether the user can access subscribers.
(imported from commit 4bff4c26f98a9c2ebdd11d931c977aae8e4ebffe)
2013-09-30 17:14:05 -04:00
Tim Abbott 4de0ad29b3 Remove confusing realm optional argument to get_subscribers.
The realm should always be the realm of the stream, and we should
always pass in a stream rather than sometimes passing in a stream name
and other times passing in a stream.

(imported from commit a098d6ed3db218a37c1b6b7c956e847c316c2d13)
2013-09-30 17:14:05 -04:00
Tim Abbott 543ba03ff6 gather_subscriptions: Fix confusing overwriting of local variable stream.
(imported from commit cfe369869de5f13579ff0e0b91ec0a735e2fe81c)
2013-09-30 17:14:05 -04:00
Steve Howell d437f6602f Add muted_topic style to the topics stylebar.
If you mute a topic, it will show with opacity 0.25.

(imported from commit 72517550cc9f1daa779b3aac6cacd39831d5aa20)
2013-09-30 16:52:19 -04:00
Steve Howell 45434d3f89 Fix bug with muting topics that are all integers.
It's a bit of a contrived use case, but you could make a topic
called "12345" and then mute it from the sidebar, and it would
crash inside Dict.  We now call attr(), not data(), to avoid
string-to-integer conversions.

(imported from commit 89666f40d624df154d41077546e1c13a23ee7e67)
2013-09-30 16:52:19 -04:00
Steve Howell d94d2d71c5 Always show narrowed topic in the topic sidebar.
Before this change, you could narrow to an old topic, and it would
not show up in the sidebar unless it had unread messages.

(imported from commit f177a7378dac064e46a6417357cc86ada4475936)
2013-09-30 16:52:19 -04:00
Steve Howell fcb6a9b572 Use "topic_name" var/field in rebuild_recent_subjects().
This is part of nibbling away at deprecating "subject."

(imported from commit fbd26b5f1386a174de76e04298a68b3a7b18606e)
2013-09-30 16:52:18 -04:00
Steve Howell 10145c0e83 Simplified setting active topic.
The old code was looping through recent_subjects to find the
original subject name, but we already have logic in get_subject_filter_li()
to be case-insensitive.  I tried this with various casings of topics,
narrowing to topics, as well as narrowing to a stream (so no active topic)
and narrowing to an old topic.

(imported from commit 1decde13477cb742fd4bc82798f1afb282182bdf)
2013-09-30 16:52:18 -04:00
Steve Howell 6b8013c631 Don't mutate global recent_subjects when creating subject sidebar.
Create our own objects for handlebars, so that we can add transient
flags like is_zero without worrying about side effects to other
code.

(imported from commit b351a369cb3f36233e108e270c7abdd4ab8c5860)
2013-09-30 16:52:18 -04:00
Steve Howell ec1c82d6d7 Select closest id in MessageList.rerender().
When we call rerender() on MessageList, it is usually because
something big has happened, so it's reasonable that the pointer
may now be invalid.  As an example, the old pointed-to message
may been removed from the home view.  We have always just
moved the pointer under the hood, but now we do it in a way
that doesn't generate spurious blueslip errors.

(imported from commit d399a101f36b744a423ea7da80dda8352440c6c9)
2013-09-30 16:18:18 -04:00
Tim Abbott 0e23b2240d queue: Log how long it takes to connect to rabbitmq.
(imported from commit be3cd9da5e7c213cfed62feda2e676038ade57a6)
2013-09-30 13:48:48 -04:00
Jessica McKellar 3d1fd4a1e9 Add Redmine integration documentation.
(imported from commit ef68b6e1e97b26b2ba47e6811403c338f93e41af)
2013-09-30 11:30:04 -04:00
Zev Benjamin a906890b4d install-server: Run resize2fs
This allows us to have larger root filesystems than the AMI image.

(imported from commit 4e9698432b0c154a0bc635df07abd278c08a4905)
2013-09-30 11:09:26 -04:00
Steve Howell 3ff0ee6b21 Turn off collapsing on staging.
For now, I am just turning off the feature.  I will remove
the code in a couple days.

(imported from commit e9988fb2ead6e711274b60d6402326ec4c344cce)
2013-09-30 10:42:58 -04:00
Steve Howell cdb7737a78 Turn on muting for Iceland (customer8.invalid)
(imported from commit ab587777cf20947160dd8fa900151ca2800ffd01)
2013-09-29 22:44:09 -04:00
Steve Howell 8f1498c766 [important] Fix stacktrace in unread.js.
There is a scenario where we call process_read_message()
for a message that we haven't recorded as unread before.
I'm not sure how it happens, but I put back code to
guard against crashing.  The regression happened in
5752458c821.

(imported from commit 5ce15d2e236b738b445ed88f1733aa0612be0ff3)
2013-09-29 22:42:33 -04:00
Steve Howell bbfc8c886a Remove force_minify flag for min/activity.js.
This has been deployed, so the current code is now properly
minified, and we don't need the force_minify flag any more.

(The flag is needed when you remove a JS file from JS_SPECS.)

(imported from commit 8b3c7ffdbc875011d59c2560034750f0077db616)
2013-09-29 11:00:26 -04:00
Steve Howell f67acb3157 Filter duplicate messages more aggresively.
This fixes a blueslip error where we were trying to add the same
message into a MessageList twice.  Muting complicates our duplicate
detection, because empty() can return true even when we already
are storing messages that just aren't shown (because of muting).

The name empty() should probably be fixed in light of muting,
but filtering with self.get() is not really a problem here.

(imported from commit 83b0890471c9a0aa21996f3d0d3be4a238f23e65)
2013-09-28 15:48:38 -04:00
Steve Howell ea7fda59d3 Reset _all_items in MessageList.clear
(imported from commit 3e319578500480ebfe0da6c4541628a61f8b5ff9)
2013-09-28 15:48:37 -04:00
Steve Howell 49232d9173 Preserve muting preferences across reloads.
We have been persisting muting preferences on the back end for
a while, but we haven't been adding them to page_params for the
client to have at reload/startup time.

(imported from commit d9ca68aa0e4d22bfb0e6ce67fc0bc63981175c8b)
2013-09-28 15:48:37 -04:00
Steve Howell c79e3a95b1 Avoid selecting hidden message ids.
With the muting/hiding features, it has become the case that
this._hash can have entries that don't map to actually visible
rows, so this.get() can return true on an id that shouldn't
actually be selected, causing downstream code to explode.  Now
we call this.closest_id() regardless of whether the hash is
populated, to be safe, but then we still call blueslip.error
if the pointer moved.

(imported from commit 348e8ff67ce3a6d61aaeb31f80549386518af2d0)
2013-09-28 15:48:36 -04:00
Steve Howell a48af3bd6c Make muting rerender properly when getting updates.
If you have two browsers open for the same account, muting in one
browser will now be reflected in the other browser.  This got
regressed when changing the approach from collapsing to hiding.
The new code should be less brittle, as we encapsulate re-rendering
in muting.rerender().

(imported from commit 4e65e265b64513d38f518770453b7436cb92b4ca)
2013-09-28 15:48:36 -04:00
Steve Howell 2a4cd3c69a Exclude muted topics from stream/home unread counts.
Update get_counts() so that it ignores counts for muted topics
when calculating stream/home unread counts.

(imported from commit 9b4e4da4346c225c535e97d709d3dee032603cc5)
2013-09-28 14:53:11 -04:00
Steve Howell c7b7f8d79a Inlined unread_hashkey() function.
The indirection was more confusing than helpful, especially
since the function had side effects, despite its getter-like
name.

(imported from commit 85d9cf642b4177f62488136f0e0f7f6c9304942e)
2013-09-28 14:53:11 -04:00
Steve Howell 8d3f4366f8 Collapse unread_counts.private to unread_privates.
After killing off unread_counts.stream, the only field of
unread_counts was "private", so I just made unread_privates.

(imported from commit 9678f5b03524afb883ec4fa638b059e698888e78)
2013-09-28 14:53:11 -04:00
Steve Howell 664cb2460d Clean up references to unread_counts.stream.
The prior commit makes it so that we no longer use unread_counts.stream
in get_counts().  This commit removes the code that updates the
data structure.

(imported from commit 5752458c8212bf02cf9c8733ce349fc35b204a9b)
2013-09-28 14:53:10 -04:00
Steve Howell 534edfaf33 Compute stream/home unread counts from unread.unread_subjects.
These two data structures are kind of redundant:

  unread_counts['stream']
  unread_subjects

We are deprecating the former.  The latter is more flexible for
features like muting.

Now, in get_counts(), we compute home counts and stream counts
in the same loop that computes subject counts.

(imported from commit c8d0ea12a56d0128811e0aa165de9882546906a5)
2013-09-28 14:53:10 -04:00
Jessica McKellar bbdf18b106 Remove the redmine URL and webhook.
The plugin will use the standard send_message path.

(imported from commit 36aba7298c07d77785b3cc19499519c1423ca8f1)
2013-09-27 16:35:14 -04:00
Leo Franchi 31d8513657 Use a one-week bound instead of sender bound to optimize query
(imported from commit 5c13f3f3a5f2a54b6645cb7f2304a6b54b759cea)
2013-09-27 16:27:35 -04:00
Jessica McKellar ed0fd51160 [schema] Add a date_created field to zerver_stream.
(imported from commit 1360da91b81fad59d49068fdf05205eef982e64a)
2013-09-27 16:23:56 -04:00
Leo Franchi c5183427f3 Respect enter-to-send in edit box
(imported from commit 6e3fc6495b7012aa12728a78b8bdd95701bb21e1)
2013-09-27 13:52:14 -04:00
Leo Franchi d9dba41767 Add some tests for composebox_typeahead.compose_content_begins_typeahead
(imported from commit 01e71ebe87da6e866817dc56555a7e6ee61cb003)
2013-09-27 13:52:13 -04:00
Leo Franchi 87858a6050 Don't autocomplete mentions while message editing
(imported from commit c4b402d5c0e50a7dd85f658f660633f3a3df5d54)
2013-09-27 13:32:02 -04:00