Commit Graph

23999 Commits

Author SHA1 Message Date
Robert Hönig 4cc8c74aaa frontend: Internally refer to bots by ID.
This is done by using a bot's ID instead of email in
the handler methods for bot_data.bots and bot_data.services,
and updating all code paths involved.
2018-01-23 07:29:00 -05:00
Robert Hönig bd6fa385a5 frontend: Add outgoing webhook config entries to the "edit bot" menu.
This allows users to edit an outgoing webhook's endpoint URL
and interface type after it has been created.

Fixes #7411.
2018-01-23 07:29:00 -05:00
Robert Hönig 9a15c4e3ff Add bot services to page_params.
This is the first step for allowing users
to edit a bot's service entries, name the
outgoing webhook configuration entries. The
chosen data structures allow for a future
with multiple services per bot; right now,
only one service per bot is supported.
2018-01-23 07:29:00 -05:00
Robert Hönig 06fb868482 Send an event to bot owners when a bot is created. 2018-01-23 07:29:00 -05:00
Rishi Gupta 069ab33615 docs: Add gsoc-ideas.md. 2018-01-23 01:27:21 -08:00
Vishnu Ks 036dc53d20 messages: Rename last_visible_message_id to first_visible_message_id. 2018-01-22 19:53:44 -08:00
Greg Price ff29fe07be provision: Install virtualenv on xenial too.
As the commit message on 680381c9d which added this for stretch says,
we need this dependency when on xenial as well.  Add it there.
2018-01-22 19:36:52 -08:00
Vishnu Ks b762b839d4 stripe: Make newly added card default source. 2018-01-22 19:31:17 -08:00
Greg Price 2a59b2d2ac install: Work around a bug in the (our) Debian package for camo.
Before this fix, the installer has an extremely annoying bug where
when run inside a container with `lxc-attach`, when the installer
finishes, the `lxc-attach` just hangs and doesn't respond even to
C-c or C-z.  The only way to get the terminal back is to root around
from some other terminal to find the PID and kill it; then run
something like `stty sane` to fix the messed-up terminal settings
left behind.

After bisecting pieces of the install script to locate which step
was causing the issue, it comes down to the `service camo restart`.
The comment here indicates that we knew about an annoying bug here
years ago, and just swept it under the rug by skipping this step
when in Travis. >_<

The issue can be reproduced by running simply `service camo restart`
under `lxc-attach` instead of the installer; or `service camo start`,
following a `service camo stop`.  If `lxc-attach` is used to get an
interactive shell, these commands appear to work fine; but then when
that shell exits, the same hang appears.  So, when we start camo
we're evidently leaving some kind of mess that entangles the daemon
with our shell.

Looking at the camo initscript where it starts the daemon, there's
not much code, and one flag jumps out as suspicious:

  start-stop-daemon --start --quiet --pidfile $PIDFILE -bm \
    --exec $DAEMON --no-close -c nobody --test > /dev/null 2>&1 \
    || return 1
  start-stop-daemon --start --quiet --pidfile $PIDFILE -bm \
    --no-close -c nobody --exec $DAEMON -- \
    $DAEMON_ARGS >> /var/log/camo/camo.log 2>&1 \
    || return 2

What does `--no-close` do?

 -C, --no-close
     Do not close any file descriptor when forcing the daemon
     into  the  background  (since version 1.16.5).  Used for
     debugging purposes to see  the  process  output,  or  to
     redirect  file  descriptors  to  log the process output.

And in fact, looking in /proc/PID/fd while a hang is happening finds
that fd 0 on the camo daemon process, aka stdin, is connected to our
terminal.

So, stop that by denying the initscript our stdin in the first place.
This fixes the problem.

The Debian maintainer turns out to be "Zulip Debian Packaging Team",
at debian@zulip.com; so this package and its bugs are basically ours.
2018-01-22 18:55:46 -08:00
Greg Price 6e7ae9a239 test-install: Run installer under eatmydata.
This is a tool that throws away `fsync` calls and other requests for
the system to sync files to disk.  It may make the install faster; for
example, if it has to install a number of system packages, `dpkg` is
known to make a lot of `fsync` calls which slow things down
significantly.  Conversely, if there's a power failure in the middle
of running a test install, we really don't mind if the test install's
data becomes corrupt.
2018-01-22 18:55:46 -08:00
Greg Price eb25928674 test-install: Allow the installer to move the install tree aside.
When the install script is successful, one of the final things it
wants to do is to move the tree that Zulip was installed from into the
deployments directory.  It can't do that, at least not in a naive way
with `mv`, if the tree is actually a mount point.  So, stick the tree
inside some other directory that we create just for the purpose of
being the mount point and containing the install tree.
2018-01-22 18:55:46 -08:00
Greg Price 33a0a00705 production test suite: Use installer's own `--snakeoil-cert`. 2018-01-22 18:55:46 -08:00
Greg Price b0a9117e80 test-install: Pre-install a few more dependencies in base image. 2018-01-22 18:55:46 -08:00
Greg Price 0e3ab4d437 test-install: Share the pip cache across installs.
This saves several minutes off the install time.  Sadly pip still
clones Git repos for dependencies that point to them, but for many
others (not all? not sure) it just gets a wheel from the cache.
2018-01-22 18:55:46 -08:00
Greg Price 69ba6ad6d7 test-install: Let installer handle the snakeoil cert. 2018-01-22 18:55:46 -08:00
Greg Price cef8549ec6 install: Add --snakeoil-cert option.
This provides a major simplification for non-production installs,
including our own testing (it's already in both the test-install
harness script and the "production" test suite) as well as potential
admins evaluating Zulip.

Ultimately this should probably be the default behavior, with perhaps
something shown to admins on the web as a reminder and link to help on
installing a better certificate.  For now, pending working through
that, just get the behavior in and leave it opt-in.
2018-01-22 18:55:46 -08:00
Greg Price ac88f8ae1b setup-certbot: Stop automatically "agreeing" to the LE TOS.
It's not appropriate for our script to pass the `--agree-tos` flag
without any evidence of the user actually having any knowledge of,
let alone intent to agree to, any such ToS.  Stop doing that.
Fortunately this script hasn't been part of any release, so it's
likely that no users have gone down this path.
2018-01-22 18:55:46 -08:00
Greg Price 7b47cca67e test-install: Pre-install two more dependencies in base image. 2018-01-22 18:55:46 -08:00
Greg Price 525b136f10 install: Install curl.
The third-party `install-yarn.sh` script uses `curl`, and we invoke it
in `install-node`.  So we need to install it as a dependency.

We've mostly gotten away with this because it's common for `curl` to
already be installed; but it isn't always.
2018-01-22 18:55:46 -08:00
Greg Price 07969a2b0c test-install: Share the tarball directory between host and container.
This greatly simplifies iterating on changes to the installer and
associated code: just edit in the shared directory (or edit in your
worktree and rsync to the directory), and rerun.

With this change, the form with a directory is now really the main
way to run the script; the form accepting a tarball is really just
a convenience feature, unpacking the tarball and then proceeding with
that directory.
2018-01-22 18:55:46 -08:00
Greg Price d7e2190b85 test-install: Pass options through to the installer.
This will facilitate testing interesting installer features
using its own CLI.

On my laptop, with a recent base image (updated a few days ago with
`prepare-base`), it takes just 7 or 8 seconds to get to the installer
running, as timed by passing `--help` so that the installer promptly
exits.
2018-01-22 18:55:45 -08:00
Greg Price de7abd8f78 test-install: Upgrade CLI parsing, with getopt.
This will let us add more options without the CLI collapsing under
its own weight.
2018-01-22 18:55:45 -08:00
Cynthia Lin 7d8cd37035 modals: Dynamically replace keyboard shortcuts for Mac OS.
Fixes #3577.
2018-01-22 19:41:17 -05:00
Cynthia Lin d449fcb309 user docs: Dynamically replace keyboard shortcuts for Mac OS. 2018-01-22 19:41:17 -05:00
YJDave 2691c27126 stream settings: Hide create-stream-btn if user not allowed. 2018-01-22 18:26:36 -05:00
YJDave 01510c1e8f all streams: Show lock-icon for subscriber count, if user can't access.
Previoulsy, we display "0 subscribers" if user can't access stream's
subscribers. Replace subscriber count with lock icon in case of
unsubscribed private stream, in "All stream" list.
2018-01-22 18:26:36 -05:00
YJDave 81599cf906 stream settings: Display warning if user can not access subscribers.
Display warning, saying "You can not access private stream subscribers,
in which you aren't subscribed", if user can not access subscribers;
instead of showing zero subscriber to stream.
2018-01-22 18:26:36 -05:00
YJDave 8f65de1970 stream settings: Always show stream type, regardless of subscribed or not. 2018-01-22 18:26:36 -05:00
YJDave c22285c154 stream settings: Allow org admin to update settings of unsub-stream.
As per backend validations.
2018-01-22 18:26:36 -05:00
Eeshan Garg 3189388258 api docs: Show Python and JavaScript examples first.
It makes sense to make our Python and JS API examples more visible
than our curl examples, since Python is what most people will tend
to use.

Also, from a design perspective, an API documentation page that
starts off with a shiny Python example with syntax highlighting
looked much better than having a bland curl example be the first
thing readers see.
2018-01-22 18:10:29 -05:00
Eeshan Garg 96362e8e60 api docs: Move code examples farther up. 2018-01-22 18:10:29 -05:00
Eeshan Garg 668ac28b85 api/sidebar.md: Move "REST API" to the bottom. 2018-01-22 18:10:29 -05:00
Eeshan Garg 00d3f19c0a integrations/email: Render settings.EMAIL_GATEWAY_EXAMPLE correctly. 2018-01-22 18:05:20 -05:00
Balaji2198 41685105db api/update-message: Make it render correctly in Github. 2018-01-22 15:35:49 -05:00
Balaji2198 992b416802 api/delete-queue: Add Python syntax highlighting. 2018-01-22 15:35:49 -05:00
rht 953478a189 katex: Update the `require` path to point to the new one.
This fixes #7620.
2018-01-20 08:09:17 -05:00
Aditya Bansal efbddce34d settings_user_groups.js: Add 100% node test coverage. 2018-01-20 08:01:06 -05:00
Aditya Bansal 40f161ca63 settings_user_groups.js: Remove unnecessary call to get a person. 2018-01-20 08:01:06 -05:00
Greg Price bf5f1b5f20 install: Start on an LXC-based dev/test environment for the installer.
In order to do development on the installer itself in a sane way,
we need a reasonably fast and automatic way to get a fresh environment
to try to run it in.

This calls for some form of virtualization.  Choices include

 * A public cloud, like EC2 or Digital Ocean.  These could work, if we
   wrote some suitable scripts against their APIs, to manage
   appropriate base images (as AMIs or snapshots respectively) and to
   start fresh instances/droplets from a base image.  There'd be some
   latency on starting a new VM, and this would also require the user
   to have an account on the relevant cloud with API access to create
   images and VMs.

 * A local whole-machine VM system (hypervisor) like VirtualBox or
   VMware, perhaps managing the configuration through Vagrant.  These
   hypervisors can be unstable and painfully slow.  They're often the
   only way to get development work done on a Mac or Windows machine,
   which is why we use them there for the normal Zulip development
   environment; but I don't really want to find out how their
   instability scales when constantly spawning fresh VMs from an image.

 * Containers.  The new hotness, the name on everyone's lips, is Docker.
   But Docker is not designed for virtualizing a traditional Unix server,
   complete with its own init system and a fleet of processes with a
   shared filesystem -- in other words, the platform Zulip's installer
   and deployment system are for.  Docker brings its own quite
   different model of deployment, and someday we may port Zulip from
   the traditional Unix server to the Docker-style deployment model,
   but for testing our traditional-Unix-server deployment we need a
   (virtualized) traditional Unix server.

 * Containers, with LXC.  LXC provides containers that function as
   traditional Unix servers; because of the magic of containers, the
   overhead is quite low, and LXC offers handy snapshotting features
   so that we can quickly start up a fresh environment from a base
   image.  Running LXC does require a Linux base system.  For
   contributors whose local development machine isn't already Linux,
   the same solutions are available as for our normal development
   environment: the base system for running LXC could be e.g. a
   Vagrant-managed VirtualBox VM, or a machine in a public cloud.

This commit adds a first version of such a thing, using LXC to manage
a base image plus a fresh container for each test run.  The test
containers function as VMs: once installed, all the Zulip services run
normally in them and can be managed in the normal production ways.

This initial version has a shortage of usage messages or docs, and
likely has some sharp edges.  It also requires familiarity with the
basics of LXC commands in order to make good use of the resulting
containers: `lxc-ls -f`, `lxc-attach`, `lxc-stop`, and `lxc-start`,
in particular.
2018-01-19 17:27:04 -08:00
ihsavru a5be1fb109 lightbox: Fix responsiveness issues with image description.
Fixes #7789
2018-01-19 17:12:38 -08:00
akashnimare 37c792aee5 apps: Update desktop app to latest release. 2018-01-20 00:46:31 +05:30
YJDave 8905744bb1 stream settings: Add period at the end of error messages. 2018-01-19 13:05:43 -05:00
Aditya Bansal 1324d2e3c0 reminders: Make shortcuts to setup reminder in message feed work. 2018-01-19 11:33:11 -05:00
Aditya Bansal 7d8d7f7f9b reminders: Add alert message for set reminder success or failure. 2018-01-19 11:33:11 -05:00
Aditya Bansal 0f71a7ecca reminders: Add UI for setting up reminders for messages in the feed. 2018-01-19 11:33:11 -05:00
Aditya Bansal 732321818d scheduledmessage: Adjust schedule_message to accept callbacks. 2018-01-19 11:33:11 -05:00
Aditya Bansal 76f6f7cb47 datetimepicker: Add flatpickr lib as dependancy. 2018-01-19 11:33:11 -05:00
Aditya Bansal 9efc1b08a1 reminders: Add slash command to set reminders from reminder bot. 2018-01-19 11:33:11 -05:00
Aditya Bansal f272ea9087 scheduledmessages: Start using/expecting delivery_type as a param. 2018-01-19 11:33:11 -05:00
Aditya Bansal dcce8e7219 scheduledmessages: Add delivery_type field to the table. 2018-01-19 11:33:11 -05:00