Commit Graph

36862 Commits

Author SHA1 Message Date
Sharif Naas 17afd460bc docs: Fix typos in contributing/code-style.md. 2020-06-08 11:13:32 -07:00
Anders Kaseorg 139cb8026f auth: Accept next as POST parameter in POST requests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-08 11:07:32 -07:00
Anders Kaseorg ad24eef6ee circleci: Drop -python3.X suffixes from job names.
The workflow names should be sufficient.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-08 11:04:40 -07:00
Anders Kaseorg fcfe8eb49b circleci: Split into four workflows.
This should hopefully give better status output with GitHub Checks
integration enabled.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-08 11:04:40 -07:00
Johannes Hochreiter d78d9099d1 gitlab: added pipeline number to event notification
- link to pipeline now also features the pipeline number
- updated tests accordingly
2020-06-07 14:01:04 -07:00
Johannes Hochreiter 60077f3097 gitlab: Added artifact link to pipeline event body
- if artifact was built file name, download link and browse link will be added to pipeline event body
- added test for pipeline with built artifacts
2020-06-07 14:01:04 -07:00
Sharif Naas 5065ae3637 css: Remove redundant declaration from night mode CSS.
This declaration already exists in the default CSS.

This declaration was present when the edit history modal was first
given a night mode (then called "dark mode") style in November 2017 in
4f81bdd0a6. It also existed in the
default CSS at that time.
2020-06-07 13:57:28 -07:00
Sharif Naas b148c8dbd6 edit_history: Highlight topic edit diffs by using correct CSS selector.
Previously, topic edit diffs in the edit history modal were not
highlighted in the same way as content diffs because the highlighting
CSS rules were inside a .rendered_markdown block. So they affected the
content diffs, which are classed as such, but not the topic diffs.

This commit moves the highlight rules to a
.message_edit_history_content block inside the already existing
 #message-edit-history block. .message_edit_history_content had
already existed in the edit history template message_edit_history.hbs,
and is assigned to both the content and topic diffs.

The ability to see topic edits in the edit history was added in
March 2019 in 38be5ea74394d2fd8586038de6ac447b4bbfbf67; the
highlighting worked at that time. It broke four mounths later in July
2019 in 38ffde37e5 when the highlight
rules were moved into a .rendered_markdown block after having been
global.

(As a further aside, .rendered_markdown was only added to the content
diffs in April 2019 in 5c36918c17.
.message_edit_history_content had been first added, to the content
diffs, in February 2019 in 7d42d7b4dbe6eb144a148135db50ad35efc01295.)

Aside from fixing topic edit diffs, this change is just more correct;
the highlight rules don't belong under .rendered_markdown, and they
don't need to be applied globally.
2020-06-07 13:57:28 -07:00
Sharif Naas 78691b13ad css: Extract message_edit_history.scss.
Note that the .rendered_markdown selector is incorrect, and will be
fixed in a following commit.
2020-06-07 13:57:28 -07:00
Sharif Naas 76c62deae1 edit_history: Respect time format setting (12h/24h).
Previously, the edit history modal did not respect the time format
setting (whether to show times in 12-hour or 24-hour format) when
displaying message edit times (#15171).

This commit fixes that by passing the edit times to
timerender.stringify_time(), which takes that setting into account,
instead of just doing a static string formatting operation.

This bug has existed since February 2017, when the edit history UI
was first added in 1a697b6e02.

Fixes #15171.
2020-06-07 13:57:28 -07:00
Sharif Naas 8451fb6700 edit_history: Refactor how we handle times during modal creation.
Currently, the edit history modal does not respect the time format
setting (whether to show times in 12-hour or 24-hour format) when
displaying message edit times (#15171).

This commit refactors how fetch_and_render_message_history() handles
times in order to make fixing that issue in a reasonable way easier.
It will be fixed in a following commit.
2020-06-07 13:57:28 -07:00
Sharif Naas 3c6c0dbbe2 edit_history: Factor out the calculation of show_date_row. 2020-06-07 13:57:28 -07:00
Sharif Naas 07973d09c9 edit_history: Refactor first entry's calculation of show_date_row.
Previously, the show_date_row flag for the first entry in the edit
history modal was directly set to `true`, while in all other entries
it was calculated with identical code. Though show_date_row for the
first entry should indeed always be true, there's no need for it to be
a special case.

In preparation for factoring out the calculation of show_date_row,
this commit nominally calculates the first entry's show_date_row with
the same code that is used to calculate show_date_row for all other
entries. Nominally, because it will still always end up being true.
2020-06-07 13:57:28 -07:00
Sharif Naas ffe06ad809 edit_history: Don't repeat date rows.
Previously, the logic for when to add a date row to an edit history
entry was checking against the date of the original message (which is
always the first entry in the message history), not the date of the
previous edit. This caused every edit not made on the date of the
original message to show a date row, even if it wasn't the first edit
on that date.

This commit fixes that bug by updating prev_timestamp after processing
each message history entry, whereas before it was only updated after
processing the first one — the original message.

This bug has existed since June 2017, when
84e5fe733c changed how date rows worked;
from only showing one at the top labeled "Earliest" to each entry
having a possibilty of showing one.
2020-06-07 13:57:28 -07:00
Sharif Naas 60d7cdb447 edit_history: Fix topic-only edits never showing a date row.
Previously it was impossible for a topic-only edit to show a date row
in any circumstance; the code that handles topic-only edits didn't
even attempt to set show_date_row, the flag that determines whether a
date row should be rendered. Now a topic-only edit will show a date row
in the same circumstances as any other edit[1].

This bug has existed since March 2019, when rendering of topic-only
edits was first added in 38be5ea743.

[1] Currently, "the same circumstances as any other edit" means
there'll be a date row on the original message, and then on every edit
not made on the same date as the original message, even if it was't
the first edit on the date it was made. This is a bug that will be
fixed in a following commit. This commit is being made first since
it's fixing a lack-of-information bug, whereas the other bug is a
somewhat less important repeating-information bug.
2020-06-07 13:57:28 -07:00
Sharif Naas b0a0ae215f js: Extract message_edit_history.js. 2020-06-07 13:57:28 -07:00
SiddharthVarshney 4eaa62eaa6 navbar: Fix search icon click event.
This block was accidentally deleted in
59be2dcc18.
2020-06-07 13:04:58 -07:00
Priyank Patel f5fbc64aef node_tests: Remove stray assert.
The activity.process_loaded_messages code path was called when these
tests were originally written in f8e0137. We stopped calling that
code path in 43e5b2d (#15118). This assert test code is no longer
relevant; tested by adding console.log in the function. I came
across this when working on removing activity from the window.
2020-06-07 13:01:35 -07:00
SiddharthVarshney b22b1004a8 user-profile: Fix user profile layout for long name. 2020-06-07 12:55:43 -07:00
Dinesh fcebf2905e puppeteer_tests: WaitForNavigation until DOMContentLoaded for log_in().
Waiting till DOMContentLoaded event is triggered helps avoid flakes since
puppeteer is very fast and starts doing another task before
everything on the page is loaded. Adding this to log_in function
as almost all tests depend on this which leads to flaky tests if
the other parts of tests just start without even the page being
loaded.
One example this commit helps is for the test `02-site.js`
which is dependent on a function that runs some jquery on the site.
But because of the page not being loaded, we miss jquery and thus
the test fails. `02-site.js` and related code is added in the next
commit.

Co-authored-by: Priyank Patel <priyankp390@gmail.com>
2020-06-07 12:29:59 -07:00
Dinesh 264513a0be puppeteer_tests: Use default user test credentials for log_in().
When no credentials are sent to `log_in` function we want to
use the default generated test credentials. This saves us the
work of importing test_credentials everytime we run this function
in a different test which doesn't focus on what credentials are sent
to login.
2020-06-07 12:29:59 -07:00
Ryan Rehman ba0f869b3c notifications: Use the correct expression in template.
This fixes a bug where the "mobile" label was disabled
even when push notifications were configured for the server.
2020-06-07 11:43:42 -07:00
Ryan Rehman 3dff6c0de7 subscriptions: Update wildcard mentions notify on stream create.
The `wildcard_mentions_notify` key was missing from the initial
sub data when a new stream was created. Thus `wildcard_mentions_notify`
was undefined and `wildcard_mentions_notify_display` was false.
(This key is used to render the data in the templates)

This caused a bug where the wildcard notifications was unchecked
in the stream personal settings and the newly created stream was
displayed in the stream specific notifications table.
2020-06-07 11:43:42 -07:00
Aman Agrawal e2ed155310 do_update_message: Send old topic with stream edit event.
Old topic of the msg edit event can be used to help the client
calculate useful information such as if a change
in current narrow is required.

This fixes our re narrow logic after a stream edit of a topic, with
no change in topic name itself, since the original topic was not
present in the event received and hence the `orig_topic` was
undefined in this case.
2020-06-07 11:20:34 -07:00
sahil839 c394337118 tests: Refactor 'attempt_unsubscribe_of_principal` to accept list of users.
This adds 'target_users' parameter to 'attempt_unsubscribe_of_principal`
function in test_subs.py, which accepts list of UserProfile objects to be
unsubscribed, instead of defining users in the function itself.

This change makes the code cleaner and more readable.

Also, 'other_user_subbed' parameter is changed to 'target_users_subbed'
to clearly depict the use of this parameter.
2020-06-07 11:18:37 -07:00
Anders Kaseorg 19cc22e5ab queue: Fix types to reflect that Pika channels transmit bytes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:09:24 -07:00
Anders Kaseorg cf60493f8e install-shellcheck: Upgrade ShellCheck to 0.7.1.
ShellCheck binary releases have moved to GitHub:

https://github.com/koalaman/shellcheck/issues/1871

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:06:57 -07:00
Anders Kaseorg 0f63753926 install-node: Upgrade Node.js to 12.18.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:06:57 -07:00
Anders Kaseorg be8686474b dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:06:57 -07:00
Anders Kaseorg 0cce24a8bc eslintrc: Remove deprecated typescript-eslint rules.
We could configure @typescript-eslint/naming-convention to enforce
these conventions.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:06:57 -07:00
Anders Kaseorg 548b8c4d7f localstorage: Don’t return a value from a setter.
https://eslint.org/docs/rules/no-setter-return

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-07 11:06:57 -07:00
SiddharthVarshney d09758cec3 profile_setting: Enable allowInput on flatpickr.
Without this field the datepicker was in readonly mode.
2020-06-07 11:03:48 -07:00
Anders Kaseorg 02c670f5a3 requirements: Bump zulint.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-06 18:05:25 -07:00
anshgit101 7f4aad4511 populate_db:Add uppercase topic name randomly. 2020-06-06 09:25:13 -04:00
YashRE42 22884e768b message_edit: Ensure message edit form is empty prior to appending.
Prior to commit 8b7e70ac27 this system
would simply just .hide() forms when they were closed and
.empty().append() every time it needed to "show_edit". This was not a
very clean way of handling the action of canceling an edit, so
8b7e70ac27 introduced a change that had
the "show_edit" function append the form and the "hide" function
.empty() the form.

However, we overlooked the fact that the user could use browser
history to navigate away and back to the form and use "e" or
"left arrow key" to successfully append another form and get to an
ugly, broken state.

This commit does not revert 8b7e70ac27
as it is still accurate to .empty() when hiding the form, but we add
an early exit if a form already exists, to avoid bugs like the above.

Using an early exit instead of eg .empty().append() ensures that the
user doesn't accidentally lose the entire content of an edit, if they
deselect the input box and press `e`.

Fixes: #15045.
2020-06-05 20:12:47 -07:00
Anders Kaseorg 4a4692f817 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 20:05:18 -07:00
Anders Kaseorg a236256d64 test_slack_importer: Fix mocked_requests_get type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 20:05:18 -07:00
Anders Kaseorg 4b44d87477 test_push_notifications: Fix mock_apns type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 20:05:18 -07:00
Anders Kaseorg 22178c169e request: Replace type argument hack with a different workaround.
This works in mypy 0.770 and is needed for mypy 0.780.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 20:05:18 -07:00
João Maurício fb6047c4ae stream_color.js: Fix color picker not saving custom color.
Fix a bug where the color picker reverted the custom color to the
previous one after clicking outside the popover. The bug occurred
because although there is a confirm button, the 'clickoutFiresChanges'
option was set as true, which made the frontend always send two POST
request to edit the stream and, for a reason I wasn't able to discover,
if you hit the confirm button and click outside fast enough, the change
fired by the clickout event sent the old color to the server. It was
fixed by setting the 'clickoutFiresChanges' option to false.

Fixes #15101
2020-06-05 17:58:09 -07:00
Anders Kaseorg d49e880c09 lint: Remove custom rules duplicating eslint and pycodestyle.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 17:43:30 -07:00
Ryan Rehman b0d632577f search pills: Update multiple pills creation event behaviour.
If typeahead is used, this adds comma separated search queries
so that multiple search pills don't get combined as one and the
search behaviour remains same as search_pills_enabled = False case.

If typeahead is not used, this prevent the typing of a single comma
after the pill gets created.
2020-06-05 17:16:20 -07:00
Ryan Rehman 9faf238e8e search tests: Refactor search according to search_legacy.
Now node_tests/search.js and node_tests/search_legacy.js have
almost identical test besides the search pills related data
processing work.
This is possible since we no longer depend on the values stored
in the input pills and can narrow or search for term based on
the `#search_query` box value.
This was done in commit 02ab48a61e.
2020-06-05 17:16:20 -07:00
Ryan Rehman aeb4419d52 search: Open typeahead on initiating search.
This fixes a bug where the hotkeys used to search messages
doesn't work for pills enabled case.
2020-06-05 17:16:20 -07:00
Tim Abbott 42f1cb3444 management: Fix delete_old_unclaimed_attachments. 2020-06-05 17:06:19 -07:00
Kartik Srivastava 5cb1edcadc openapi/python_examples: Update examples for add/remove subscriptions.
This updates the examples to use user ids to add or remove subscriptions
from a stream.
2020-06-05 16:11:04 -07:00
sahil839 bd943941e4 people: Remove 'get_active_user_for_email' function.
This commit removes the 'get_active_user_for_email' function
from people.js. We have removed the use of this function
in the previous commits, which changed the functions using
'get_active_user_for_email' to use user_ids instead of emails.
2020-06-05 16:08:26 -07:00
sahil839 40475a41b0 compose_fade: Change would_receive_message to use user_id.
This commit changes the would_receive_message to use user_id
instead of emails.

This change is done because user_ids are immutable and using
user_ids is the correct way of uniquely identifying user.

The change in 'would_receive_message' also leads to change
in util.is_pm_recipient to use a string of user_ids instead
of emails.

We also know that user_ids passed to 'would_receive_message'
are active user_ids, since we get them from buddy_list.
So we don't need to check whether the user is active, which
was previously being checked by get_active_user_for_email.
2020-06-05 16:08:26 -07:00
sahil839 25aed90da1 compose: Change needs_subscribe_warning to use user_id.
This commit changes the needs_subscribe_warning function to
use user_id instead of emails.

This change is done because user_ids are immutable and using
user_ids is the correct way to uniquely identify a user.

We already know that user_ids being passed in this function are
active user_ids, since they come from typeaheads.
So, we only need to call 'people.get_by_user_id', to get the user
object from user_id and do not need to check the active status of
user, which was done previously using 'get_active_user_for_email'.
2020-06-05 16:08:26 -07:00
Anders Kaseorg f0a19ed8e6 puppeteer_tests: Use assert in strict mode.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 16:05:51 -07:00