Commit Graph

41132 Commits

Author SHA1 Message Date
akshatdalton 9c6d8d9d81 markdown: Add support to shorten GitHub links.
We add support to shorten links and test their shortening in
well-organized, clean manner that makes it trivial to extend the
GitHub approach for GitLab and perhaps other services.

We only shorten basic types of GitHub links (issue, PR, commit) that
fit a set of simple common patterns; the default behaviour of Autolink
is kept for everything else.

Logic added in frontend and backend Markdown Processor is identical.
This makes easy to extend the logic for other services like GitLab.

Fixes #11895.
2021-03-25 00:39:44 -07:00
YashRE42 abd959cf6a server_events_dispatch: Throw blueslip from typing based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 a93adbfa76 server_events_dispatch: Throw blueslip from stream based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 f69de35267 server_events_dispatch: Throw blueslip from realm_user based on op. 2021-03-24 15:04:00 -07:00
YashRE42 27ac45e71b server_events_dispatch: Throw blueslip from realm_domains based on op. 2021-03-24 15:04:00 -07:00
YashRE42 4ffdfb5f00 server_events_dispatch: Throw blueslip if wrong op in realm_bot case. 2021-03-24 15:04:00 -07:00
YashRE42 d50bc7441a server_events_dispatch: Refactor realm_bot case to use switch/case.
This should make no functional changes.
2021-03-24 15:04:00 -07:00
YashRE42 b89363cec3 server_events_dispatch: Refactor realm event to use switch/case.
This should make no functional changes.
2021-03-24 15:04:00 -07:00
YashRE42 195b1b28ee server_events_dispatch: Throw blueslip if update_dict without prop. 2021-03-24 15:04:00 -07:00
YashRE42 e3b6cc61f3 server_events_dispatch: Throw from "reaction" based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 bf86422116 server_events_dispatch: Refactor 'reaction' case to use switch/case. 2021-03-24 15:04:00 -07:00
YashRE42 bc69521caa server_events_dispatch: Throw from "subscription" based on event.op. 2021-03-24 15:04:00 -07:00
Tim Abbott d89c405074 custom_profile_fields: Revert incorrect early-converted hunk.
In b220d29fed, we incorrectly migrated a
field exposed to the frontend, which resulted in the frontend
puppeteer tests failing in CI.
2021-03-24 14:22:08 -07:00
Anders Kaseorg 6de39ae92d js: Clean up typeof … === "undefined" checks.
The only reason to use typeof foo === "undefined" is when foo is a
global identifier that might not have been declared at all, so it
might raise a ReferenceError if evaluated.  For a variable declared
with const or let or import, a function argument, or a complex
expression, simply foo === undefined is equivalent.

Some of these conditions have become impossible and can be removed
entirely, and some can be replaced more idiomatically with default
parameters (note that JavaScript does not share the Python misfeature
of evaluating the default parameter at function declaration time).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 13:15:01 -07:00
Suyash Vardhan Mathur 9840803c00 openapi: Fix schema for unread_msgs in /register.
The schema for unread_msgs was missing additionalProperties: false
that was causing tests to pass even with undocumented parameters
which were validated as an additional property. Set
additionalProperties to false and added documentation for missing
count variable.

Fixes #17728.
2021-03-24 13:03:36 -07:00
Tim Abbott 7e77320953 custom profile fields: Rename s/choice/select/ in tests. 2021-03-24 12:57:55 -07:00
tushar912 98a6bdbd4c custom profile fields: Rename "SELECT" field validator.
Rename the "SELECT" field validator so that it can be reused
with the upcoming "SELECT_MULTIPLE" field.
2021-03-24 12:54:51 -07:00
tushar912 b220d29fed custom profile fields: Rename "CHOICE" to "SELECT" in backend.
Rename the "CHOICE" field to "SELECT" in backend. This is
done to improve readability as a prep for the upcoming
"SELECT_MULTIPLE" field.
2021-03-24 12:54:51 -07:00
yashika 999b52d309 docs: Fixed the typos in the devlopment environment docs. 2021-03-24 12:53:40 -07:00
yashika e94fc624d5 docs: Update the URL to uninstall WSL 2 in development environment docs.
Development environment docs contains a wrong url
to uninstall WSL 2. This commit fixes the statement
containing the correct URL to uninstall WSL 2.
2021-03-24 12:50:18 -07:00
sahil839 6d419565b7 streams: Show error according to create_stream_policy on failure.
This commit changes the list_to_streams function to raise error
according to create_stream_policy value when a user cannot create
streams instead of same error for all cases.
2021-03-24 12:33:58 -07:00
sahil839 13e412d553 tests: Modify invite_to_stream_policy tests to check all cases.
This commit modifies test_user_settings_for_subscribing_other_users
to check all the possible cases including the cases when a user
can successfully subscribe other users along with the already
tested failure cases. This commit also adds checks for guest users
which was not present before.
2021-03-24 12:33:58 -07:00
sahil839 b45d6ef0d8 tests: Use do_change_user_role and do_set_realm_property.
This commit replaces the code which directly changes user.role,
realm.create_stream_policy and realm.waiting_period_threshold
with do_change_user_role and do_set_realm_property functions
in test_can_create_streams. This makes the code similar to the
other tests.
2021-03-24 12:33:58 -07:00
sahil839 683b6f7d65 tests: Refactor test_can_create_streams and test_can_subscribe_other_users.
We refactor test_can_create_streams and test_can_subscribe_other_users
in test_subs.py. We want to follow a specific order in such tests
which is just set the policy value one by one and then checking
that the role in policy returns true and role just below that returns
false. This approach is explained in detail below.

Following hierarchy of roles is considered for these tests -
1. Realm admin
2. Full members
3. Members
4. Guests.

Then if the policy is set to admins only, we check that the having
role as admin returns true and the role just below that, i.e. full
member returns false. Similarly, if the policy is set to members
only, we check that a member should return true and role below it
which is guest should return false. We basically follow these as
we can assume that if a user with particular role cannot do the
required task, then user with role below in the hierarchy would
be not allowed to do the task too.

This commit refactors the above mentioned two tests to have above
explained workflow.
2021-03-24 12:33:58 -07:00
sahil839 bc72d2dbc4 tests: Remove unnecessary use of do_change_user_role in test_subs.
This commit removes the unnecessary do_change_user_role function
in test_can_subcribe_other_users. This was added in 1aebf3cab
which replaced the multiple functions like do_change_is_admin
and do_change_is_guest with do_change_user_role.

Previously two functions do_change_is_admin and do_change_is_guest
were used because there were two flags is_realm_admin and is_guest
which were used to determine the role of a user. But then we added
a single field role to UserProfile and removed the multiple flags
and thus also replaced the different functions with a single
do_change_user_role. With addition of a new field role, two
different do_change_* functions were not needed as we only have
a role field instead of different flags, but this was missed in
1aebf3cab and this commit fixes it.
2021-03-24 12:33:58 -07:00
Steve Howell 57d79e8fd6 refactor: Extract color_class module.
This breaks some indirect dependencies on subs
and message_view_header.
2021-03-24 12:22:27 -07:00
Steve Howell f3b1e723e0 typeahead: Eliminate render caches.
These were introduced in ff9a929d7a
with no explanation of why they were necessary.

Generally you only render a few things, and it's
important that they're up to date.

We weren't doing a good job of invalidating the cache.

Eliminating the cache will fix bugs (like presence circles
being out of date) and break some dependencies.

I removed some very fragile test code that was relying
on invalid values taken out of the cache.  (We now have
less line coverage, but if we want to test our rendering,
there are much cleaner ways to do it.)

As part of testing this, I renamed Hamlet to "aaron", so
that there are two aarons, and then I logged on as Iago
to see the "secondary" code in action that shows their
emails to distinguish them.
2021-03-24 12:15:36 -07:00
Anders Kaseorg 3b4cb899b6 zanitizer: Reformat with perltidy.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 12:12:04 -07:00
Anders Kaseorg 29e4c71ec4 puppet: Reformat custom Ruby modules with Rufo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 12:12:04 -07:00
Anders Kaseorg 81ffc4e827 Vagrantfile: Reformat with Rufo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 12:12:04 -07:00
Alex Vandiver 6ee74b3433 puppet: Check health of APT repository. 2021-03-23 19:27:42 -07:00
Alex Vandiver c01345d20c puppet: Add nagios check for long-lived certs that do not auto-renew. 2021-03-23 19:27:27 -07:00
Tim Abbott fea4bac2a5 docs: Identify WSL 2 with normal capitalization. 2021-03-23 17:12:50 -07:00
Yashika Jotwani 7111c46ddb docs: Correct the statement in the development environment docs.
Development environment docs contains an outdated
statement stating that the non-vagrant setup can't
be used on windows, while it can now be used on windows by
using wsl. This commit fixes the statement and points
the link towards the non-vagrant setup process page.

Fixes #17721.
2021-03-23 17:11:23 -07:00
Tim Abbott 11ff59aa5e test_home: Fix missing do_change_plan_type import. 2021-03-23 16:12:04 -07:00
Vishnu KS 61c8dda476 docs: Mention GitHub sponsors in contributing guide. 2021-03-23 15:57:25 -07:00
Vishnu KS 8e34bf4349 readme: Add GitHub sponsors badge in README.
The number is really low, since we haven't told anyone about our
GitHub Sponsors site, so the badge probably isn't actually helpful,
but I suppose that's OK.
2021-03-23 15:56:46 -07:00
Vishnu KS e7528b58c0 readme: Mention GitHub sponsors program. 2021-03-23 15:55:09 -07:00
Vishnu KS 7bf3d6f21f tests: Use do_change_plan_type in test_show_plans. 2021-03-23 15:51:50 -07:00
smit_patel 5ddb5fc534 popovers: Change "Delete all messages in topic" to "Delete topic".
This cleans up the copy a bit to be more readable.

Documentation changes cleaned up by tabbott.

Fixes #16856.
2021-03-23 15:46:00 -07:00
Tim Abbott 5fef101189 docs: Document zulip-archive GSoC idea. 2021-03-23 15:03:48 -07:00
Anders Kaseorg fb688e8e5d server_events_dispatch: Fix Prettier formatting.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-23 14:17:08 -07:00
Vishnu KS 965a71a332 droplets: Remove obvious comments from create.py. 2021-03-23 14:05:34 -07:00
Vishnu KS b1a26c7123 droplets: Rename get_keys to get_ssh_public_keys_from_github. 2021-03-23 14:05:34 -07:00
Vishnu KS 36ba00f65a droplets: Rename fork_exists to assert_user_forked_zulip_server_repo. 2021-03-23 14:05:34 -07:00
Vishnu KS c1d80561a6 droplets: Add support for creating prod droplets. 2021-03-23 14:05:34 -07:00
Vishnu KS fa623dbd62 droplets: Make assert_droplet_does_not_exist take droplet_name as argument. 2021-03-23 14:05:34 -07:00
Vishnu KS 13b9cf200b droplets: Make print_completion take droplet_domain_name instead of username. 2021-03-23 14:05:34 -07:00
Vishnu KS 33f51305eb droplets: Rename username argument to record_name in create_dns_record. 2021-03-23 14:05:34 -07:00
Vishnu KS 3407627c46 droplets: Rename exit_if_droplet_exists to assert_droplet_does_not_exist. 2021-03-23 14:05:34 -07:00