-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* more explicit config.json instructions minor formatting changes to readme * fixed votes under additional options * added Help block to README
- Loading branch information
1 parent
52cc11c
commit c4c4d2f
Showing
1 changed file
with
33 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Mattermost Poll | ||
=============== | ||
# Mattermost Poll | ||
|
||
![build](https://travis-ci.org/M-Mueller/mattermost-poll.svg?branch=master) [![codecov](https://codecov.io/gh/M-Mueller/mattermost-poll/branch/master/graph/badge.svg)](https://codecov.io/gh/M-Mueller/mattermost-poll) | ||
|
||
Provides a slash command to create polls in Mattermost. | ||
|
@@ -12,43 +12,55 @@ By default, a poll will only offer the options *Yes* and *No*. However, users ca | |
|
||
Choices are separated by `--`. | ||
|
||
### Additional options: | ||
## Additional options | ||
|
||
- `--secret`: Do not display the number of votes until the poll is ended | ||
- `--public`: Show who voted for what at the end of the poll | ||
- `--votes=X`: Allows users to place a total of *X* votes. Default is 1. | ||
Each individual option can still only be voted once. | ||
- `--votes=X`: Allows users to place a total of *X* votes. Default is 1. Each individual option can still only be voted once. | ||
|
||
## Help | ||
|
||
`/poll help` will display full usage options. Only visible to you. | ||
|
||
Set the "Autocomplete Hint" in the Slash Command settings to `See "/poll help" for full usage options` | ||
|
||
## Requirements | ||
|
||
Requirements | ||
------------ | ||
- Python 3 | ||
- Flask | ||
- Tornado | ||
- Requests | ||
|
||
Setup | ||
----- | ||
## Setup | ||
|
||
Copy `settings.py.example` to `settings.py` and customise your settings. | ||
|
||
Start the server: | ||
``` | ||
|
||
```bash | ||
python run.py | ||
``` | ||
In Mattermost go to *Main Menu -> Integrations -> Slash Commands* and add a new slash command with the URL of the server including the configured port number, e.g. http://localhost:5000. | ||
Choose POST for the request method. | ||
Optionally add the generated token to your `settings.py` (requires server restart). | ||
|
||
1. In Mattermost go to *Main Menu -> Integrations -> Slash Commands* and add a new slash command with the URL of the server including the configured port number, e.g. http://localhost:5000. | ||
1. Choose POST for the request method. | ||
- Optionally add the generated token to your `settings.py` (requires server restart). | ||
1. Edit your Mattermost `config.json` to include "localhost" in the "AllowedUntrustedInternalConnections" setting, e.g. `"AllowedUntrustedInternalConnections": "localhost"` | ||
|
||
To resolve usernames in `--public` polls, the server needs access to the | ||
Mattermost API. For this a [personal access token](https://docs.mattermost.com/developer/personal-access-tokens.html) must be provided in your `settings.py`. Which user provides the token doesn't matter, e.g. you can create a dummy account. If no token is provided `--public` polls will not be available. | ||
|
||
Docker | ||
------ | ||
## Docker | ||
|
||
To integrate with [mattermost-docker](https://github.com/mattermost/mattermost-docker): | ||
``` | ||
|
||
```bash | ||
cd mattermost-docker | ||
git submodule add [email protected]:M-Mueller/mattermost-poll.git poll | ||
``` | ||
and add the following to the ```services``` section: | ||
``` | ||
|
||
and add the following to the `services` section: | ||
|
||
```yaml | ||
poll: | ||
build: | ||
context: poll | ||
|
@@ -63,5 +75,6 @@ and add the following to the ```services``` section: | |
- ./volumes/poll:/app/volume:rw | ||
``` | ||
In Mattermost use *http://poll:5000/* as the request url. *poll* needs to be added to "AllowedUntrustedInternalConnections" in the Mattermost *config.json*. | ||
|
||
1. In Mattermost go to *Main Menu -> Integrations -> Slash Commands* and add a new slash command with the URL of the server including the configured port number, e.g. http://poll:5000. | ||
1. Choose POST for the request method. | ||
1. Edit your Mattermost `config.json` to include "poll" in the "AllowedUntrustedInternalConnections" setting, e.g. `"AllowedUntrustedInternalConnections": "poll"` |