Commit Graph

37873 Commits

Author SHA1 Message Date
Gittenburg 0b4568d249 message_header: Fix overlap on mobile with flex.
Previously .recipient_row_date was positioned absolutely, allowing it to
overlap with the topic name on narrow screens. This can be solved by
using flexbox. To implement the empty space between the bar controls and
the date on wider screens we move the date outside of the bar controls
(which also makes more sense semantically since the date isn't a
control).

Fixes #15501.
2020-07-09 13:13:38 -07:00
sahil839 67ea4bd937 stream: Fix incorrect dispaly of stream notifications settings.
The stream notification settings checkboxes were not checked
even when the notifications were turned on for the stream.
This was happening because we were passing stream name to
receives_notifications instead of stream id.

This commit fixes the bug by passing stream id to
receives_notifications. This change should have been done
in f3604fb while refactoring receives_notifications to use
stream id instead of name.
2020-07-09 12:46:44 -07:00
Vinit Singh bf31d92fa7 emoji_picker: Fix keys not working if search yields no results.
As a consequence of commit 1113589b9d the backspace key and some other
keys did not respond if the search yielded no results.
This change fixes that bug.
2020-07-09 11:55:13 -07:00
Steve Howell 9662af842f export: Remove stream sanity check.
We also remove the post_process_data option.

The sanity check is just overkill at this point,
since the mechanism to find streams is very
direct due to a recent commit.
2020-07-09 11:34:00 -07:00
Steve Howell 54c596cfc4 export: Just export all streams in a realm.
Before this change we would only export streams
that had actual subscribers, which is usually
harmless, but it was mostly a relic of a one
time migration that we did when we were cleaning
up some dirty data in some of our very early
databases (circa 2016).

Now we work down the table hierarchy in a
more natural way:

    - get Streams in Realm
    - get Recipients matching above Streams
    - get Subscriptions matching above Recipients

Note that for per-user exports, I kept the
same logic (users -> subscriptions -> recipients ->
streams) we had before.

One subtle detail here is that we make our
final Config blocks--which build the final
version of Recipient/Subscription--now hang
off of realm_config.

Fixes #15146.
2020-07-09 11:33:55 -07:00
Aman Agrawal 18bebbf290 recent_topics: Set correct container as scrolling container.
This fixes the bug of extra topics not being rendered on scrolling.
list_render uses `max-height` to determine which container is being
scrolled upon. Set the `max-height` on the scrolling container of
recent topics to help list_render identify it.
2020-07-08 17:51:27 -07:00
Mohit Gupta 79243f7d52 tests: Move test_near_pm_message_url to test_message_fetch.py. 2020-07-08 14:00:05 -07:00
Mohit Gupta 16c3121bc8 tests: Move test_is_private_flag_not_leaked to test_message_flags.py. 2020-07-08 14:00:05 -07:00
Mohit Gupta b0b3cf86ce tests: Move test_auto_subbed_to_personals test to test_signup.py.
This is really a test about account creation.
2020-07-08 13:59:56 -07:00
Mohit Gupta 478956ff0b tests: Move MiscMessageTest to test_audit_log.py. 2020-07-08 13:53:56 -07:00
Mohit Gupta f03c5e35e4 tests: Move NoRecipientIDsTest to test_subs.py. 2020-07-08 13:51:32 -07:00
Vinit Singh 8b54cce833 emoji_picker: Improve emoji picker search results.
This sorts the emoji picker's search results using the same
`typehead.sort_emojis` function as the compose typehead.

Resolves #15694.
2020-07-08 13:47:03 -07:00
Gittenburg 6e5fb85ade refactor: Improve method name in emoji_picker. 2020-07-08 13:25:49 -07:00
Gittenburg 9f20fdc87a refactor: Replace getter with const in emoji_picker. 2020-07-08 13:25:49 -07:00
Gittenburg 08b9aacb88 hotkey: Detect arrow keys while holding shift.
This is useful for the emoji-picker where holding down shift lets you
select multiple emojis. Otherwise when selecting multiple emojis with
the keyboard shortcuts you would need to release shift everytime you
wanted to navigate with the arrow keys.
2020-07-08 13:25:49 -07:00
Gittenburg 5bb10036b5 emoji_picker: Allow selecting multiple while holding Shift.
We detect shift with event.shiftKey so we need to pass the event around.

Fixes #8465.
2020-07-08 13:25:49 -07:00
Gittenburg 1113589b9d emoji_picker: Move enter handling into picker.
This means the picker no longer has to export
is_composition(emoji) and toggle_selected_emoji().
2020-07-08 13:22:24 -07:00
Gittenburg 42f20e81be emoji_picker: Fix inconsistency in edge case.
Previously clicking on an existing message reaction (outside of the
emoji picker) while having the emoji picker open, removed the reaction
without updating the highlighting of the reacted emoji in the emoji
picker.

The emoji picker already is already closed when clicking outside.
The message reaction click handler however previously stopped the event
propagation, leaving the picker open, allowing the inconsistency.
2020-07-08 13:21:53 -07:00
Tim Abbott 92d33070dd docs: Improve explanation of running master.
It's a bit annoying we haven't renamed master yet, but we'll do that
in a bulk pass.
2020-07-08 12:17:59 -07:00
Priyank Patel 61955ecf41 github-actions: Don't run code scanning workflow every week.
Since we already run this on every push we don't need to run it as a
cron job every week for no reason. While we are touching this code
block, we convert it to on: [push, pull_request] since the previous
format felt weird. It was only written that way because we had the
cron job declared there.
2020-07-07 17:26:16 -07:00
Priyank Patel 711943a3ab github-actions: Use include_frontend_test check.
Uses the include_frontend_test instead of platfrom specific check.
2020-07-07 17:26:16 -07:00
Priyank Patel 4938d6ab6b minor: Rename codeql workflow names.
This makes it so the GitHub displays the runs as "Code Scanning / CodeQL"
instead of "Code scanning - actions / CodeQL-Build".
2020-07-07 17:26:16 -07:00
Mohit Gupta 086e9e281b models: Remove to_log_dict method of Message model as it's unused. 2020-07-07 17:14:10 -07:00
Mohit Gupta de81b92dee tests: Move MessageVisibilityTest to test_message_fetch.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 012622aa4a tests: Move CheckMessageTest to test_message_send.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 4ae6cc7328 tests: Move MessageHasKeywordsTest to test_message_fetch.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta ce948e4a80 tests: Move MessageAccessTests to test_message_flags.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 096ed90ac2 tests: Rename test_unread.py to test_message_flags.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta aa7dc6bf83 tests: Move SewMessageAndReactionTest to test_message_dict.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 228fb9f80d tests: Move TestAddressee to test_message_send.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 329265b1bf tests: Move TestCrossRealmPMs to test_message_send.py. 2020-07-07 17:14:10 -07:00
Mohit Gupta 308643cace tests: Rename test_narrow.py to test_message_fetch.py.
This commit renames test_narrow.py and also all its references to
test_message_fetch.py.
2020-07-07 17:14:10 -07:00
sahil839 9ccb33a894 subs: Fix bug of subscribing/unsubscribing user by clicking on stream row.
There is a bug when clicking on the stream row in stream settings page
subscribes/unsubscribes the user from stream. The ideal behaviour
should be that user should be subscribed/unsubscribed only
when user clicks on tick icon. The buggy behaviour is visible only after
clicking the tick icon once.

This is because clicking on tick is adding sub_unsub_button class to the
stream row, while it should be added only to the ".check" element to
re-enable the button to handle requests.

This commit fixes the bug by adding the "sub_unsub_button" class to
".check" element only and not to the stream row and same change
is done for removing the "sub_unsub_button" class also.
2020-07-07 17:12:01 -07:00
sahil839 48eba187bb stream_edit: Fix bug in subscribing/unsubscribing from stream settings.
Subscribe/Unsubscribe button in the right section of stream settings
page is not working because the target element in click handler was
changed to 'check.sub_unsub_button' in c234b4f2 and the button in
the right section with class 'sub_unsub_button' also uses the same
click handler.

This commit reverts c234b4f2 and the bug of subscribing/unsubscribing
the user by clicking on stream row in the stream settings page, which
c234b4f2 intended to fix will be fixed in next commit.
2020-07-07 17:12:01 -07:00
Tim Abbott 8672805ddf compose: Use rendered_markdown.update_elements for previews.
As we add more features where rendered_markdown.update_elements does
something useful, it'll become important to run this code everywhere
we render markdown in the DOM.

One can see in this case that we had actually copied one hunk of
rendered_markdown.update_elements years ago, before we extracted it as
an independent function; we get to delete that copy.

Fixes #15500.
2020-07-07 14:37:09 -07:00
arpit551 4f6cd6577c http_headers: Substitute Nginx version based on OS.
success-http-headers-bionic.txt and success-http-headers-focal.txt
differ only in the nginx version so this substitution will allow
us to have single file for both of them. Also this change helps
to avoid CI failure if Nginx version is updated in the OS.
2020-07-07 11:20:05 -07:00
sahil839 04ef6ba63a compose: Set wildcard_mention for message before further validation.
We do not show the warning while sending messages to announce
stream if there is a wildcard mention in the message (i.e.
when wildcard_mention != null)

There are two cases where we should ideally show the warning
but we don't-

 - When there is no wildcard mention in the message and
   wildcard_mention is set to undefined (initial value of
   wildcard_mention).
   This is because "wildcard_mention != null" returns true for
   this case and thus the warning is not shown, assuming the
   message to have wildcard mention.

 - When previous message had a wildcard mention and now a message
   is being sent with no wildcard mention.
   This is because the condition "wildcard_mention != null" is
   checked with the previous value of wildcard_mention and not
   with the value according to current message content, and thus
   the warning is not shown, assuming the message to have wildcard
   mention.

This commit changes the code to set wildcard_mention from the
latest message content before performing other validations and
thus solves the problems described above.
2020-07-07 10:42:55 -07:00
Rohitt Vashishtha 912e372c4e markdown: Remove !avatar() and !gravatar() syntax.
This particular commit has been a long time coming. For reference,
!avatar(email) was an undocumented syntax that simply rendered an
inline 50px avatar for a user in a message, essentially allowing
you to create a user pill like:

`!avatar(alice@example.com) Alice: hey!`

---

Reimplementation

If we decide to reimplement this or a similar feature in the future,
we could use something like `<avatar:userid>` syntax which is more
in line with creating links in markdown. Even then, it would not be
a good idea to add this instead of supporting inline images directly.

Since any usecases of such a syntax are in automation, we do not need
to make it userfriendly and something like the following is a better
implementation that doesn't need a custom syntax:

`![avatar for Alice](/avatar/1234?s=50) Alice: hey!`

---

History

We initially added this syntax back in 2012 and it was 'deprecated'
from the get go. Here's what the original commit had to say about
the new syntax:

> We'll use this internally for the commit bot.  We might eventually
> disable it for external users.

We eventually did start using this for our github integrations in 2013
but since then, those integrations have been neglected in favor of
our GitHub webhooks which do not use this syntax.

When we copied `!gravatar` to add the `!avatar` syntax, we also noted
that we want to deprecate the `!gravatar` syntax entirely - in 2013!

Since then, we haven't advertised either of these syntaxes anywhere
in our docs, and the only two places where this syntax remains is
our game bots that could easily do without these, and the git commit
integration that we have deprecated anyway.

We do not have any evidence of someone asking about this syntax on
chat.zulip.org when developing an integration and rightfully so- only
the people who work on Zulip (and specifically, markdown) are likely
to stumble upon it and try it out.

This is also the only peice of code due to which we had to look up
emails -> userid mapping in our backend markdown. By removing this,
we entirely remove the backend markdown's dependency on user emails
to render messages.

---

Relevant commits:

- Oct 2012, Initial commit        c31462c278
- Nov 2013, Update commit bot     968c393826
- Nov 2013, Add avatar syntax     761c0a0266
- Sep 2017, Avoid email use       c3032a7fe8
- Apr 2019, Remove from webhook   674fcfcce1
2020-07-07 10:39:44 -07:00
Aman Agrawal f1cc2ab926 delete_event_notify_user_ids: Fix UnboundLocalError. 2020-07-07 10:33:50 -07:00
Rohitt Vashishtha 4a62cae0b7 node-tests: Log file name and test label on failure. 2020-07-07 10:38:11 -04:00
Rohitt Vashishtha 1d3234b6c6 timerender: Make moment() return static date.
The previous iteration of the test was flaky when we could get
off by one errors between two moment() calls.
2020-07-07 08:04:50 -04:00
sahil839 7079897119 docs: Add steps for configuring message retention policy in the docs.
This commits adds the steps for configuring message retention policy
for an organization and for individual streams in message retention
policy docs.

Fixes #15495.
2020-07-06 18:55:02 -07:00
Alex Vandiver d49e73e087 test-install: Do not install rabbitmq in base install.
The installer does not adjust the node name if the rabbitmq already
exists, and the default node name bakes in the
`zulip-install-bionic-base` hostname.  As such, the resulting LXC
image does not properly start rabbitmq.

Remove rabbitmq, allowing the installer to install and configure it
with a nodename of `zulip@localhost`.  This also lets the installed
image be successfully copied and booted under a new hostname without
breaking rabbitmq.
2020-07-06 18:53:38 -07:00
Anders Kaseorg 5693f63bf8 settings: Convert variable type annotations to Python 3.6 style.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-06 18:44:58 -07:00
Anders Kaseorg ebf7f4d0f6 zthumbor: Rename thumbor.conf to thumbor_settings.py.
So we can apply all our lint checks to it.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-06 18:44:58 -07:00
Anders Kaseorg 9900298315 zthumbor: Remove Python 2 residue.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-06 18:44:58 -07:00
Sanskar Bajpai bd6fe786cf date_row: Update color via update_table_stream_color.
Previously, the function update_table_stream_color did not update the
color of the date_row when it appeared within a topic.  This was
incorrect because it meant that a small piece of the border to the
left of the message box would be left to the previous color when the
stream color was updated.  This commit resolves the issue by adding an
update.

Fixes #15197.
2020-07-06 18:37:35 -07:00
Alex Vandiver 0d7dbd1b07 puppet: Apply basic PostgreSQL configuration before pg_upgradecluster.
Running `pg-upgradecluster` runs the `CREATE TEXT SEARCH DICTIONARY`
and `CREATE TEXT SEARCH CONFIGURATION` from
`zerver/migrations/0001_initial.py` on the new PostgreSQL cluster;
this requires that the stopwords file and dictionary exist _prior_
to `pg_upgradecluster` being run.

This causes a minor dependency conflict -- we do not wish to duplicate
the functionality from `zulip::postgres_appdb_base` which configures
those files, but installing all of `zulip::postgres_appdb_tuned` will
attempt to restart PostgreSQL -- which has not configured the cluster
for the new version yet.

In order to split out configuration of the prerequisites for the
application database, and the steps required to run it, we need to be
able to apply only part of the puppet configuration.  Use the
newly-added `--config` argument to provide a more limited `zulip.conf`
which only applies `zulip::postgres_appdb_base` to the new version of
Postgres, creating the required tsearch data files.

This also preserves the property that a failure at any point prior to
the `pg_upgradecluster` is easily recoverable, by re-running
`zulip-puppet-apply`.
2020-07-06 18:30:16 -07:00
Alex Vandiver 17002f2a0e puppet: Allow passing an alternate config path to zulip-puppet-apply.
When temporary configuration changes are desired, this lets one set up
an alternate `zulip.conf` to apply while leaving the true one in place.
2020-07-06 18:30:16 -07:00
Alex Vandiver efe2b6e5cd puppet: Switch `zulip-puppet-apply` to argparse.
This allows additional arguments other than `-f` or `--force`.
2020-07-06 18:30:16 -07:00