summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore12
-rw-r--r--.travis.yml56
-rw-r--r--Makefile325
-rw-r--r--api/webhook.go113
-rw-r--r--config/config.json6
-rw-r--r--model/version.go8
-rw-r--r--webapp/components/about_build_modal.jsx6
-rw-r--r--webapp/components/admin_console/license_settings.jsx64
-rw-r--r--webapp/i18n/en.json12
-rw-r--r--webapp/i18n/es.json6
-rw-r--r--webapp/i18n/pt.json6
-rw-r--r--webapp/utils/constants.jsx30
12 files changed, 311 insertions, 333 deletions
diff --git a/.gitignore b/.gitignore
index 4c343021e..422c6d5f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,14 +9,15 @@ npm-debug.log
web/static/js/bundle*.js
web/static/js/bundle*.js.map
web/static/js/libs*.js
-.npminstall
config/active.dat
+# Enteprise imports file
+imports.go
+
# Build Targets
-.prepare
-.prepare-go
-.prepare-jsx
+.prebuild
+.npminstall
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
@@ -69,6 +70,3 @@ api/data/*
.agignore
.ctags
tags
-
-model/version.go
-model/version.go.bak
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 71dcbefbc..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-language: generic
-sudo: required
-services:
-- docker
-env:
-- TRAVIS_DB=mysql
-- TRAVIS_DB=postgres
-before_install:
- - docker run --name mattermost-mysql -e MYSQL_ROOT_PASSWORD=mostest -e MYSQL_USER=mmuser -e MYSQL_PASSWORD=mostest -e MYSQL_DATABASE=mattermost_test -d mysql:5.7
- - docker run --name mattermost-postgres -e POSTGRES_USER=mmuser -e POSTGRES_PASSWORD=mostest -d postgres:9.4
- - sleep 10
- - docker exec mattermost-postgres psql -c 'create database mattermost_test ;' -U postgres
- - docker exec mattermost-postgres psql -c 'grant all privileges on database "mattermost_test" to mmuser ;' -U postgres
-script: make dist-travis
-addons:
- hosts:
- - 127.0.0.1 dockerhost
-after_success:
- - sudo chown -R `whoami` dist
- - sudo chmod -R 777 dist
- - cd dist && curl -F "pr_number=$TRAVIS_PULL_REQUEST" -F "file=@mattermost.tar.gz" mattermod.mattermost.com:8087/upload_pr_build
- - md5sum mattermost.tar.gz > mm.md5
- - sha1sum mattermost.tar.gz > mm.sha1
- - sha256sum mattermost.tar.gz > mm.sha256
- - cat mm.md5 mm.sha1 mm.sha256
- - cd ..
-before_deploy:
- - sudo rm -rf dist/mattermost
- - rvm 1.9.3 do gem install mime-types -v 2.6.2
-deploy:
-# Github releases, builds only on tags
- - provider: releases
- api_key:
- secure: ma8Y0oimU+LB6LTAh8to2E1/ghaDPhcsAFXBrODsHpd4JgxA6HYoEwSEBCJFHSpu/JteclsxSTfp9hcuzw/IOtlwlSAiVoBZ60s24MRKTIAQNtrJ4QrX5wyfAZi+Bcuk/E8NynmoIW5qpaElSAdjgocyjAJIQ5ChMEztglL0cAEBXQRWbWMqSZ0hVLPrKDCIkWIyv3pFxqdLOxktkzxW07r2dlT0hppXR3dCaPJo0nelArS2H3LdN/3Iv6cAddfS27RaZkqDj/PDh6OZr4EguC99TxlVNChIr7nPr3/OiAssbkvEnhlSLeABFO9+7KfutL2WhAjpFXTjtPVq6Qalc8UW0K0gxq//sVfhb1MzjenmdOf06uB2bilQ8kgwHo7dDdRZBqqAtxQ6Q0Ht3SFMj6v/1zVD3s+YX/kWCEbUTHm6r2G/eF794ozcJyU+6j1L8hm6mvf8Mr9XCqBfgpZy6FCLX+9OKdMvX2jY8reo3Xz1PA9R6yzhN08vjku+jW+fsoYrBLd0fY1UGK2uOuvBByCeJzXupd3YpBMjEyRupVxqEj7K0GWOJeml65mkqKSNsHdDSeSjMpb8mwneZyTbdjsxCFQRLcLgpAajFrkk4G2Yz3KfhXSo29XKEGX+EbY5NuP8KmDsBsguPI0zfwv/co0hAY8PIIcehxcdoR9Vb2c=
- file: dist/mattermost.tar.gz
- skip_cleanup: true
- on:
- repo: mattermost/platform
- tags: true
- condition: $TRAVIS_DB = mysql
-
-# S3 deploy for latest master
- - provider: s3
- access_key_id: AKIAJCO3KJYEGWJIKDIQ
- secret_access_key:
- secure: p66X2tJBmKgtcVyPtGgkAwW29IiRojqGA39RjCJkIWNTJ0e/9JvBOiMS2c4a7I4aOads38rsthwdaigBWagDWNH7bGsEZN7B0TszZuFAuU+XGjU5A66MIOfFfzbUg8AnByysr+XG5/bknFIrP/XhM2fbRr6gbYrFUK7TNkpgjFs5u3BzUrz2iTAV8uOpSJqKSnaf0pTZk1EywOK/X8W8ViIjc7Di3FzQcqIW9K3D27N+3rVsv8SRT1hWASVlnG6aThqqebiM8FCGCzAYVgQb3h3Wu8JT5fIz7Qo7A6siVRwNBwWwzP8HkGoinEK32Wsj/fDXk27vjpFQO/+9sV0xfcTbIZA6MnuYWF4rHOT59KcshCWCD3V0FopX57p/dtOzM9+6lxIctAT++izxWoZit/5c5A4633iY1d+RMeTko1POix6MSlxPMRHZUFwSXROgFuWWRpyD6TlUTCST9/wTTd0WDPklAAiYcnuEPW3qCnw0r0xkrA4AwWUXqXdAIwDt5bA27KcjRyY4Fofv9NxH09BNuBTXNPrvnYPZMmaKrv+HOX3NFTreuV6+5LJdhYUxYSBvSWo1jeWIQ5Q9RUdTU0PqmKpMhJKbKey/S4gxCXHg2HR8DwLCcbIZcvneF9yPEAT71YA6zpLKoPVSwWwH97huKSzjpic/RUfFXQOcgCQ=
- bucket: mattermost-travis-master
- local_dir: dist
- acl: public_read
- region: us-east-1
- skip_cleanup: true
- detect_encoding: true
- on:
- repo: mattermost/platform
- branch: master
- condition: $TRAVIS_DB = mysql
diff --git a/Makefile b/Makefile
index eb0bdc06f..5bb64638a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,47 +1,47 @@
-.PHONY: all dist dist-local dist-travis start-docker build-server package build-client test travis-init build-container stop-docker clean-docker clean nuke run run-client run-server stop stop-client stop-server setup-mac cleandb docker-build docker-run restart-server
+.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-unit-tests test dist setup-mac prepare-enteprise
-GOPATH ?= $(GOPATH:)
-GOFLAGS ?= $(GOFLAGS:)
+# Build Flags
BUILD_NUMBER ?= $(BUILD_NUMBER:)
BUILD_DATE = $(shell date -u)
BUILD_HASH = $(shell git rev-parse HEAD)
-
-ENTERPRISE_DIR ?= ../enterprise
-BUILD_ENTERPRISE ?= true
-
-GO=$(GOPATH)/bin/godep go
-ESLINT=node_modules/eslint/bin/eslint.js
-
+# If we don't set the build number it defaults to dev
ifeq ($(BUILD_NUMBER),)
BUILD_NUMBER := dev
endif
-
-ifeq ($(TRAVIS_BUILD_NUMBER),)
- BUILD_NUMBER := dev
+BUILD_ENTERPRISE_DIR ?= ../enterprise
+BUILD_ENTERPRISE ?= true
+BUILD_ENTERPRISE_READY = false
+ifneq ($(wildcard $(BUILD_ENTERPRISE_DIR)/.),)
+ ifeq ($(BUILD_ENTERPRISE),true)
+ BUILD_ENTERPRISE_READY = true
+ else
+ BUILD_ENTERPRISE_READY = false
+ endif
else
- BUILD_NUMBER := $(TRAVIS_BUILD_NUMBER)
+ BUILD_ENTERPRISE_READY = false
endif
+BUILD_WEBAPP_DIR = ./webapp
+# Golang Flags
+GOPATH ?= $(GOPATH:)
+GOFLAGS ?= $(GOFLAGS:)
+GO=$(GOPATH)/bin/godep go
+GO_LINKER_FLAGS ?= -ldflags \
+ "-X github.com/mattermost/platform/model.BuildNumber=$(BUILD_NUMBER)\
+ -X 'github.com/mattermost/platform/model.BuildDate=$(BUILD_DATE)'\
+ -X github.com/mattermost/platform/model.BuildHash=$(BUILD_HASH)\
+ -X github.com/mattermost/platform/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)"
+
+# Output paths
DIST_ROOT=dist
DIST_PATH=$(DIST_ROOT)/mattermost
+# Tests
TESTS=.
-DOCKERNAME ?= mm-dev
-DOCKER_CONTAINER_NAME ?= mm-test
-
-all: dist-local
-
-dist: | build-server build-client go-test package
- mv ./model/version.go.bak ./model/version.go
- @if [ "$(BUILD_ENTERPRISE)" = "true" ] && [ -d "$(ENTERPRISE_DIR)" ]; then \
- mv ./mattermost.go.bak ./mattermost.go; \
- mv ./config/config.json.bak ./config/config.json 2> /dev/null || true; \
- fi
-
-dist-local: | start-docker dist
+all: dist
-dist-travis: | travis-init build-container
+dist: | check-style test package
start-docker:
@echo Starting docker containers
@@ -66,107 +66,6 @@ start-docker:
sleep 10; \
fi
-build-server:
- @echo Building mattermost server
-
- rm -Rf $(DIST_ROOT)
- $(GO) clean $(GOFLAGS) -i ./...
-
- @echo GOFMT
- $(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ mattermost.go 2>&1))
- @echo "$(GOFMT_OUTPUT)"
- @if [ ! "$(GOFMT_OUTPUT)" ]; then \
- echo "gofmt sucess"; \
- else \
- echo "gofmt failure"; \
- exit 1; \
- fi
-
- cp ./model/version.go ./model/version.go.bak
- sed -i'.make_mac_work' 's|_BUILD_NUMBER_|$(BUILD_NUMBER)|g' ./model/version.go
- sed -i'.make_mac_work' 's|_BUILD_DATE_|$(BUILD_DATE)|g' ./model/version.go
- sed -i'.make_mac_work' 's|_BUILD_HASH_|$(BUILD_HASH)|g' ./model/version.go
-
- @if [ "$(BUILD_ENTERPRISE)" = "true" ] && [ -d "$(ENTERPRISE_DIR)" ]; then \
- cp ./config/config.json ./config/config.json.bak; \
- jq -s '.[0] * .[1]' ./config/config.json $(ENTERPRISE_DIR)/config/enterprise-config-additions.json > config.json.tmp; \
- mv config.json.tmp ./config/config.json; \
- sed -e '/\/\/ENTERPRISE_IMPORTS/ {' -e 'r $(ENTERPRISE_DIR)/imports' -e 'd' -e '}' -i'.bak' mattermost.go; \
- sed -i'.make_mac_work' 's|_BUILD_ENTERPRISE_READY_|true|g' ./model/version.go; \
- else \
- sed -i'.make_mac_work' 's|_BUILD_ENTERPRISE_READY_|false|g' ./model/version.go; \
- fi
-
- rm ./model/version.go.make_mac_work
-
- $(GO) build $(GOFLAGS) ./...
- $(GO) generate $(GOFLAGS) ./...
- $(GO) install $(GOFLAGS) ./...
-
-package:
- @ echo Packaging mattermost
-
- mkdir -p $(DIST_PATH)/bin
- cp $(GOPATH)/bin/platform $(DIST_PATH)/bin
-
- cp -RL config $(DIST_PATH)/config
- cp -RL fonts $(DIST_PATH)/fonts
- touch $(DIST_PATH)/config/build.txt
- echo $(BUILD_NUMBER) | tee -a $(DIST_PATH)/config/build.txt
-
- mkdir -p $(DIST_PATH)/logs
-
- mkdir -p $(DIST_PATH)/webapp/dist
- cp -RL webapp/dist $(DIST_PATH)/webapp
-
- cp -RL templates $(DIST_PATH)
-
- cp -RL i18n $(DIST_PATH)
-
- cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH)
- cp NOTICE.txt $(DIST_PATH)
- cp README.md $(DIST_PATH)
-
- mv $(DIST_PATH)/webapp/dist/bundle.js $(DIST_PATH)/webapp/dist/bundle-$(BUILD_NUMBER).js
- sed -i'.bak' 's|bundle.js|bundle-$(BUILD_NUMBER).js|g' $(DIST_PATH)/webapp/dist/root.html
- rm $(DIST_PATH)/webapp/dist/root.html.bak
-
- @if [ "$(BUILD_ENTERPRISE)" = "true" ] && [ -d "$(ENTERPRISE_DIR)" ]; then \
- sudo mv -f $(DIST_PATH)/config/config.json.bak $(DIST_PATH)/config/config.json || echo 'nomv'; \
- fi
-
- tar -C dist -czf $(DIST_PATH).tar.gz mattermost
-
-build-client:
- mkdir -p webapp/dist/files
- cd webapp && make build
-
-go-test:
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
-
-test: | start-docker .prepare-go go-test
-
-travis-init:
- @echo Setting up enviroment for travis
-
- if [ "$(TRAVIS_DB)" = "postgres" ]; then \
- sed -i'.bak' 's|mysql|postgres|g' config/config.json; \
- sed -i'.bak2' 's|mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8|postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable\&connect_timeout=10|g' config/config.json; \
- fi
-
- if [ "$(TRAVIS_DB)" = "mysql" ]; then \
- sed -i'.bak' 's|mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8|mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8|g' config/config.json; \
- fi
-
-build-container:
- @echo Building in container
-
- cd .. && docker run -e TRAVIS_BUILD_NUMBER=$(TRAVIS_BUILD_NUMBER) --link mattermost-mysql:mysql --link mattermost-postgres:postgres -v `pwd`:/go/src/github.com/mattermost mattermost/builder:latest
-
stop-docker:
@echo Stopping docker containers
@@ -195,92 +94,144 @@ clean-docker:
docker rm -v mattermost-postgres > /dev/null; \
fi
-clean: stop-docker
- rm -Rf $(DIST_ROOT)
- go clean $(GOFLAGS) -i ./...
+check-style:
+ @echo Running GOFMT
+ $(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ einterfaces/ mattermost.go 2>&1))
+ @echo "$(GOFMT_OUTPUT)"
+ @if [ ! "$(GOFMT_OUTPUT)" ]; then \
+ echo "gofmt sucess"; \
+ else \
+ echo "gofmt failure"; \
+ exit 1; \
+ fi
- cd webapp && make clean
+test: start-docker
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
- rm -rf api/data
- rm -rf logs
+.prebuild:
+ @echo Preparation for running go code
+ go get $(GOFLAGS) github.com/tools/godep
- rm -rf Godeps/_workspace/pkg/
+ touch $@
- rm -f mattermost.log
- rm -f .prepare-go .prepare-jsx
+prepare-enterprise:
+ifeq ($(BUILD_ENTERPRISE_READY),true)
+ @echo Enterprise build selected, perparing
+ cp $(BUILD_ENTERPRISE_DIR)/imports.go .
+endif
-nuke: | clean clean-docker
- rm -rf data
+build: .prebuild prepare-enterprise
+ @echo Building mattermost server
-.prepare-go:
- @echo Preparation for running go code
- go get $(GOFLAGS) github.com/tools/godep
+ $(GO) clean $(GOFLAGS) -i ./...
+ $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
- touch $@
+build-client:
+ @echo Building mattermost web app
-run: | start-docker run-server run-client
+ cd $(BUILD_WEBAPP_DIR) && make build
-run-server: .prepare-go
- @echo Starting go web server
- mkdir -p webapp/dist/files
- $(GO) run $(GOFLAGS) mattermost.go -config=config.json &
-run-client:
- @echo Starting client
+package: build build-client
+ @ echo Packaging mattermost
- cd webapp && make run
+ # Remove any old files
+ rm -Rf $(DIST_ROOT)
- @if [ "$(BUILD_ENTERPRISE)" = "true" ] && [ -d "$(ENTERPRISE_DIR)" ]; then \
- cp ./config/config.json ./config/config.json.bak; \
- jq -s '.[0] * .[1]' ./config/config.json $(ENTERPRISE_DIR)/config/enterprise-config-additions.json > config.json.tmp; \
- mv config.json.tmp ./config/config.json; \
- sed -e '/\/\/ENTERPRISE_IMPORTS/ {' -e 'r $(ENTERPRISE_DIR)/imports' -e 'd' -e '}' -i'.bak' mattermost.go; \
- sed -i'.bak' 's|_BUILD_ENTERPRISE_READY_|true|g' ./model/version.go; \
- else \
- sed -i'.bak' 's|_BUILD_ENTERPRISE_READY_|false|g' ./model/version.go; \
- fi
+ # Create needed directories
+ mkdir -p $(DIST_PATH)/bin
+ mkdir -p $(DIST_PATH)/logs
-stop: stop-server stop-client
- @if [ $(shell docker ps -a | grep -ci ${DOCKER_CONTAINER_NAME}) -eq 1 ]; then \
- echo removing dev docker container; \
- docker stop ${DOCKER_CONTAINER_NAME} > /dev/null; \
- docker rm -v ${DOCKER_CONTAINER_NAME} > /dev/null; \
- fi
+ # Copy binary
+ cp $(GOPATH)/bin/platform $(DIST_PATH)/bin
- @if [ "$(BUILD_ENTERPRISE)" = "true" ] && [ -d "$(ENTERPRISE_DIR)" ]; then \
- mv ./config/config.json.bak ./config/config.json 2> /dev/null || true; \
- mv ./mattermost.go.bak ./mattermost.go 2> /dev/null || true; \
- mv ./model/version.go.bak ./model/version.go 2> /dev/null || true; \
- fi
+ # Resource directories
+ cp -RL config $(DIST_PATH)
+ cp -RL fonts $(DIST_PATH)
+ cp -RL templates $(DIST_PATH)
+ cp -RL i18n $(DIST_PATH)
+
+ # Package webapp
+ mkdir -p $(DIST_PATH)/webapp/dist
+ cp -RL $(BUILD_WEBAPP_DIR)/dist $(DIST_PATH)/webapp
+ mv $(DIST_PATH)/webapp/dist/bundle.js $(DIST_PATH)/webapp/dist/bundle-$(BUILD_NUMBER).js
+ sed -i'.bak' 's|bundle.js|bundle-$(BUILD_NUMBER).js|g' $(DIST_PATH)/webapp/dist/root.html
+ rm $(DIST_PATH)/webapp/dist/root.html.bak
+
+ # Help files
+ifeq ($(BUILD_ENTERPRISE_READY),true)
+ cp $(BUILD_ENTERPRISE_DIR)/ENTERPRISE-EDITION-LICENSE.txt $(DIST_PATH)
+else
+ cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH)
+endif
+ cp NOTICE.txt $(DIST_PATH)
+ cp README.md $(DIST_PATH)
+
+ # Create package
+ tar -C dist -czf $(DIST_PATH).tar.gz mattermost
+
+run-server: prepare-enterprise
+ @echo Running mattermost for development
+
+ mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
+ $(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) *.go &
+
+run-client:
+ @echo Running mattermost client for development
+
+ cd $(BUILD_WEBAPP_DIR) && make run
+
+run: run-server run-client
stop-server:
- @for PID in $$(ps -ef | grep "go run [m]attermost.go" | awk '{ print $$2 }'); do \
+ @echo Stopping mattermost
+
+ @for PID in $$(ps -ef | grep "[g]o run" | awk '{ print $$2 }'); do \
echo stopping go $$PID; \
kill $$PID; \
done
- @for PID in $$(ps -ef | grep "go-build.*/[m]attermost" | awk '{ print $$2 }'); do \
+ @for PID in $$(ps -ef | grep "[g]o-build" | awk '{ print $$2 }'); do \
echo stopping mattermost $$PID; \
kill $$PID; \
done
stop-client:
- cd webapp && make stop
+ @echo Stopping mattermost client
-restart-server: stop-server run-server
+ cd $(BUILD_WEBAPP_DIR) && make stop
-setup-mac:
- echo $$(boot2docker ip 2> /dev/null) dockerhost | sudo tee -a /etc/hosts
-cleandb:
- @if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 1 ]; then \
- docker stop mattermost-mysql > /dev/null; \
- docker rm -v mattermost-mysql > /dev/null; \
- fi
+stop: stop-server stop-client
+
+restart-server: | stop-server run-server
+
+restart-client: | stop-client run-client
+
+clean: stop-docker
+ @echo Cleaning
+
+ rm -Rf $(DIST_ROOT)
+ go clean $(GOFLAGS) -i ./...
+
+ cd $(BUILD_WEBAPP_DIR) && make clean
-docker-build: stop
- docker build -t ${DOCKERNAME} -f docker/local/Dockerfile .
+ rm -rf api/data
+ rm -rf logs
+
+ rm -rf Godeps/_workspace/pkg/
+
+ rm -f mattermost.log
+ rm -f .prepare-go
+
+nuke: clean clean-docker
+ @echo BOOM
-docker-run: docker-build
- docker run --name ${DOCKER_CONTAINER_NAME} -d --publish 8065:80 ${DOCKERNAME}
+ rm -rf data
+setup-mac:
+ echo $$(boot2docker ip 2> /dev/null) dockerhost | sudo tee -a /etc/hosts
diff --git a/api/webhook.go b/api/webhook.go
index c0f8ea506..fe1aa1175 100644
--- a/api/webhook.go
+++ b/api/webhook.go
@@ -4,11 +4,14 @@
package api
import (
+ "net/http"
+ "strings"
+
l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
- "net/http"
)
func InitWebhook(r *mux.Router) {
@@ -23,6 +26,12 @@ func InitWebhook(r *mux.Router) {
sr.Handle("/outgoing/regen_token", ApiUserRequired(regenOutgoingHookToken)).Methods("POST")
sr.Handle("/outgoing/delete", ApiUserRequired(deleteOutgoingHook)).Methods("POST")
sr.Handle("/outgoing/list", ApiUserRequired(getOutgoingHooks)).Methods("GET")
+
+ sr.Handle("/{id:[A-Za-z0-9]+}", ApiAppHandler(incomingWebhook)).Methods("POST")
+
+ // Old route. Remove eventually.
+ mr := Srv.Router
+ mr.Handle("/hooks/{id:[A-Za-z0-9]+}", ApiAppHandler(incomingWebhook)).Methods("POST")
}
func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -330,3 +339,105 @@ func regenOutgoingHookToken(c *Context, w http.ResponseWriter, r *http.Request)
w.Write([]byte(result.Data.(*model.OutgoingWebhook).ToJson()))
}
}
+
+func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !utils.Cfg.ServiceSettings.EnableIncomingWebhooks {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.disabled.app_error", nil, "")
+ c.Err.StatusCode = http.StatusNotImplemented
+ return
+ }
+
+ params := mux.Vars(r)
+ id := params["id"]
+
+ hchan := Srv.Store.Webhook().GetIncoming(id)
+
+ r.ParseForm()
+
+ var parsedRequest *model.IncomingWebhookRequest
+ contentType := r.Header.Get("Content-Type")
+ if strings.Split(contentType, "; ")[0] == "application/json" {
+ parsedRequest = model.IncomingWebhookRequestFromJson(r.Body)
+ } else {
+ parsedRequest = model.IncomingWebhookRequestFromJson(strings.NewReader(r.FormValue("payload")))
+ }
+
+ if parsedRequest == nil {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.parse.app_error", nil, "")
+ return
+ }
+
+ text := parsedRequest.Text
+ if len(text) == 0 && parsedRequest.Attachments == nil {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.text.app_error", nil, "")
+ return
+ }
+
+ channelName := parsedRequest.ChannelName
+ webhookType := parsedRequest.Type
+
+ //attachments is in here for slack compatibility
+ if parsedRequest.Attachments != nil {
+ if len(parsedRequest.Props) == 0 {
+ parsedRequest.Props = make(model.StringInterface)
+ }
+ parsedRequest.Props["attachments"] = parsedRequest.Attachments
+ webhookType = model.POST_SLACK_ATTACHMENT
+ }
+
+ var hook *model.IncomingWebhook
+ if result := <-hchan; result.Err != nil {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.invalid.app_error", nil, "err="+result.Err.Message)
+ return
+ } else {
+ hook = result.Data.(*model.IncomingWebhook)
+ }
+
+ var channel *model.Channel
+ var cchan store.StoreChannel
+
+ if len(channelName) != 0 {
+ if channelName[0] == '@' {
+ if result := <-Srv.Store.User().GetByUsername(hook.TeamId, channelName[1:]); result.Err != nil {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.user.app_error", nil, "err="+result.Err.Message)
+ return
+ } else {
+ channelName = model.GetDMNameFromIds(result.Data.(*model.User).Id, hook.UserId)
+ }
+ } else if channelName[0] == '#' {
+ channelName = channelName[1:]
+ }
+
+ cchan = Srv.Store.Channel().GetByName(hook.TeamId, channelName)
+ } else {
+ cchan = Srv.Store.Channel().Get(hook.ChannelId)
+ }
+
+ overrideUsername := parsedRequest.Username
+ overrideIconUrl := parsedRequest.IconURL
+
+ if result := <-cchan; result.Err != nil {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.channel.app_error", nil, "err="+result.Err.Message)
+ return
+ } else {
+ channel = result.Data.(*model.Channel)
+ }
+
+ pchan := Srv.Store.Channel().CheckPermissionsTo(hook.TeamId, channel.Id, hook.UserId)
+
+ // create a mock session
+ c.Session = model.Session{UserId: hook.UserId, TeamId: hook.TeamId, IsOAuth: false}
+
+ if !c.HasPermissionsToChannel(pchan, "createIncomingHook") && channel.Type != model.CHANNEL_OPEN {
+ c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.permissions.app_error", nil, "")
+ return
+ }
+
+ if _, err := CreateWebhookPost(c, channel.Id, text, overrideUsername, overrideIconUrl, parsedRequest.Props, webhookType); err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Header().Set("Content-Type", "text/plain")
+ w.Write([]byte("ok"))
+}
diff --git a/config/config.json b/config/config.json
index 1735ca293..65a61bb72 100644
--- a/config/config.json
+++ b/config/config.json
@@ -87,8 +87,8 @@
"InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
"PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
"SendPushNotifications": false,
- "PushNotificationContents": "generic",
- "PushNotificationServer": ""
+ "PushNotificationServer": "",
+ "PushNotificationContents": "generic"
},
"RateLimitSettings": {
"EnableRateLimiter": true,
@@ -146,4 +146,4 @@
"Directory": "./data/",
"EnableDaily": false
}
-}
+} \ No newline at end of file
diff --git a/model/version.go b/model/version.go
index 737071934..b3950dcc9 100644
--- a/model/version.go
+++ b/model/version.go
@@ -28,10 +28,10 @@ var versions = []string{
}
var CurrentVersion string = versions[0]
-var BuildNumber = "_BUILD_NUMBER_"
-var BuildDate = "_BUILD_DATE_"
-var BuildHash = "_BUILD_HASH_"
-var BuildEnterpriseReady = "_BUILD_ENTERPRISE_READY_"
+var BuildNumber string
+var BuildDate string
+var BuildHash string
+var BuildEnterpriseReady string
var versionsWithoutHotFixes []string
func init() {
diff --git a/webapp/components/about_build_modal.jsx b/webapp/components/about_build_modal.jsx
index e2fefc44e..e73d842d0 100644
--- a/webapp/components/about_build_modal.jsx
+++ b/webapp/components/about_build_modal.jsx
@@ -24,7 +24,7 @@ export default class AboutBuildModal extends React.Component {
let title = (
<FormattedMessage
id='about.teamEditiont0'
- defaultMessage='Team Edition T0'
+ defaultMessage='Team Edition'
/>
);
@@ -33,14 +33,14 @@ export default class AboutBuildModal extends React.Component {
title = (
<FormattedMessage
id='about.teamEditiont1'
- defaultMessage='Team Edition T1'
+ defaultMessage='Enterprise Edition'
/>
);
if (license.IsLicensed === 'true') {
title = (
<FormattedMessage
id='about.enterpriseEditione1'
- defaultMessage='Enterprise Edition E1'
+ defaultMessage='Enterprise Edition'
/>
);
licensee = (
diff --git a/webapp/components/admin_console/license_settings.jsx b/webapp/components/admin_console/license_settings.jsx
index 5aa0dba7e..ad310d8e0 100644
--- a/webapp/components/admin_console/license_settings.jsx
+++ b/webapp/components/admin_console/license_settings.jsx
@@ -105,36 +105,27 @@ class LicenseSettings extends React.Component {
let licenseType;
let licenseKey;
+ const issued = Utils.displayDate(parseInt(global.window.mm_license.IssuedAt, 10)) + ' ' + Utils.displayTime(parseInt(global.window.mm_license.IssuedAt, 10), true);
+ const startsAt = Utils.displayDate(parseInt(global.window.mm_license.StartsAt, 10));
+ const expiresAt = Utils.displayDate(parseInt(global.window.mm_license.ExpiresAt, 10));
+
if (global.window.mm_license.IsLicensed === 'true') {
- edition = (
- <FormattedMessage
- id='admin.license.enterpriseEdition'
- defaultMessage='Mattermost Enterprise Edition. Designed for enterprise-scale communication.'
- />
- );
+ // Note: DO NOT LOCALISE THESE STRINGS. Legally we can not since the license is in English.
+ edition = 'Mattermost Enterprise Edition. Enterprise features on this server have been unlocked with a license key and a valid subscription.';
licenseType = (
- <FormattedHTMLMessage
- id='admin.license.enterpriseType'
- values={{
- terms: global.window.mm_config.TermsOfServiceLink,
- name: global.window.mm_license.Name,
- company: global.window.mm_license.Company,
- users: global.window.mm_license.Users,
- issued: Utils.displayDate(parseInt(global.window.mm_license.IssuedAt, 10)) + ' ' + Utils.displayTime(parseInt(global.window.mm_license.IssuedAt, 10), true),
- start: Utils.displayDate(parseInt(global.window.mm_license.StartsAt, 10)),
- expires: Utils.displayDate(parseInt(global.window.mm_license.ExpiresAt, 10)),
- ldap: global.window.mm_license.LDAP
- }}
- defaultMessage='<div><p>This compiled release of Mattermost platform is provided under a <a href="http://mattermost.com" target="_blank">commercial license</a> from Mattermost, Inc. based on your subscription level and is subject to the <a href="{terms}" target="_blank">Terms of Service.</a></p>
- <p>Your subscription details are as follows:</p>
- Name: {name}<br />
- Company or organization name: {company}<br/>
- Number of users: {users}<br/>
- License issued: {issued}<br/>
- Start date of license: {start}<br/>
- Expiry date of license: {expires}<br/>
- LDAP: {ldap}<br/></div>'
- />
+ <div>
+ <p>
+ {'This software is offered under a commercial license.\n\nSee ENTERPRISE-EDITION-LICENSE.txt in your root install directory for details. See NOTICE.txt for information about open source software used in this system.\n\nYour subscription details are as follows:'}
+ </p>
+ {`Name: ${global.window.mm_license.Name}`}<br/>
+ {`Company or organization name: ${global.window.mm_license.Company}`}<br/>
+ {`Number of users: ${global.window.mm_license.Users}`}<br/>
+ {`License issued: ${issued}`}<br/>
+ {`Start date of license: ${startsAt}`}<br/>
+ {`Expiry date of license: ${expiresAt}`}<br/>
+ <br/>
+ {'See also '}<a href='https://about.mattermost.com/enterprise-edition-terms/'>{'Enterprise Edition Terms of Service'}</a>{' and '}<a href='https://about.mattermost.com/privacy/'>{'Privacy Policy.'}</a>
+ </div>
);
licenseKey = (
@@ -162,20 +153,15 @@ class LicenseSettings extends React.Component {
</div>
);
} else {
+ // Note: DO NOT LOCALISE THESE STRINGS. Legally we can not since the license is in English.
edition = (
- <FormattedMessage
- id='admin.license.teamEdition'
- defaultMessage='Mattermost Team Edition. Designed for teams from 5 to 50 users.'
- />
+ <p>
+ {'Mattermost Enterprise Edition. Unlock enterprise features in this software through the purchase of a subscription from '}
+ <a href='https://mattermost.com/'>{'https://mattermost.com/'}</a>
+ </p>
);
- licenseType = (
- <FormattedHTMLMessage
- id='admin.license.teamType'
- defaultMessage='<span><p>This compiled release of Mattermost platform is offered under an MIT license.</p>
- <p>See MIT-COMPILED-LICENSE.txt in your root install directory for details. See NOTICES.txt for information about open source software used in this system.</p></span>'
- />
- );
+ licenseType = 'This software is offered under a commercial license.\n\nSee ENTERPRISE-EDITION-LICENSE.txt in your root install directory for details. See NOTICE.txt for information about open source software used in this system.';
let fileName;
if (this.state.fileName) {
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 9b44f9abd..e4485dc29 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -1,12 +1,12 @@
{
"about.close": "Close",
"about.date": "Build Date:",
- "about.enterpriseEditione1": "Enterprise Edition E1",
+ "about.enterpriseEditione1": "Enterprise Edition",
"about.hash": "Build Hash:",
"about.licensed": "Licensed by:",
"about.number": "Build Number:",
- "about.teamEditiont0": "Team Edition T0",
- "about.teamEditiont1": "Team Edition T1",
+ "about.teamEditiont0": "Team Edition",
+ "about.teamEditiont1": "Enterprise Edition",
"about.title": "About Mattermost",
"about.version": "Version:",
"access_history.title": "Access History",
@@ -230,15 +230,9 @@
"admin.ldap.usernameAttrTitle": "Username Attribute:",
"admin.licence.keyMigration": "If you’re migrating servers you may need to remove your license key from this server in order to install it on a new server. To start, <a href=\"http://mattermost.com\" target=\"_blank\">disable all Enterprise Edition features on this server</a>. This will enable the ability to remove the license key and downgrade this server from Enterprise Edition to Team Edition.",
"admin.license.chooseFile": "Choose File",
- "admin.license.edition": "Edition: ",
- "admin.license.enterpriseEdition": "Mattermost Enterprise Edition. Designed for enterprise-scale communication.",
- "admin.license.enterpriseType": "<div><p>This compiled release of Mattermost platform is provided under a <a href=\"http://mattermost.com\" target=\"_blank\">commercial license</a> from Mattermost, Inc. based on your subscription level and is subject to the <a href=\"{terms}\" target=\"_blank\">Terms of Service.</a></p><p>Your subscription details are as follows:</p>Name: {name}<br />Company or organization name: {company}<br/>Number of users: {users}<br/>License issued: {issued}<br/>Start date of license: {start}<br/>Expiry date of license: {expires}<br/>LDAP: {ldap}<br/></div>",
- "admin.license.key": "License Key: ",
"admin.license.keyRemove": "Remove Enterprise License and Downgrade Server",
"admin.license.noFile": "No file uploaded",
"admin.license.removing": "Removing License...",
- "admin.license.teamEdition": "Mattermost Team Edition. Designed for teams from 5 to 50 users.",
- "admin.license.teamType": "<span><p>This compiled release of Mattermost platform is offered under an MIT license.</p><p>See MIT-COMPILED-LICENSE.txt in your root install directory for details. See NOTICES.txt for information about open source software used in this system.</p></span>",
"admin.license.title": "Edition and License",
"admin.license.type": "License: ",
"admin.license.upload": "Upload",
diff --git a/webapp/i18n/es.json b/webapp/i18n/es.json
index 606b4376d..021b41051 100644
--- a/webapp/i18n/es.json
+++ b/webapp/i18n/es.json
@@ -230,15 +230,9 @@
"admin.ldap.usernameAttrTitle": "Atributo Usuario:",
"admin.licence.keyMigration": "Si estás migrando servidores es posible que necesites remover tu licencia de este servidor para poder instalarlo en un servidor nuevo. Para empezar, <a href=\"http://mattermost.com\" target=\"_blank\">deshabilita todas las características de la Edición Enterprise de este servidor</a>. Esta operación habilitará la opción para remover la licencia y degradar este servidor de la Edición Enterprise a la Edición Team.",
"admin.license.chooseFile": "Escoger Archivo",
- "admin.license.edition": "Edición: ",
- "admin.license.enterpriseEdition": "Mattermost Edición Enterprise. Diseñada para comunicación de escala empresarial.",
- "admin.license.enterpriseType": "<div><p>Esta versión compilada de la plataforma de Mattermost es provista bajo una <a href=\"http://mattermost.com\" target=\"_blank\">licencia comercial</a> de Mattermost, Inc. en función en su nivel de subscripción y bajo los <a href=\"{terms}\" target=\"_blank\">Términos del Servicio.</a></p><p>Los detalles de tu subscripción son los siguientes:</p>Nombre: {name}<br />Nombre compañía u organización: {company}<br/>Cantidad de usuarios: {users}<br/>Licencia emitida: {issued}<br/>Fecha de inicio: {start}<br/>Fecha de expiración: {expires}<br/>LDAP: {ldap}<br/></div>",
- "admin.license.key": "Llave de la Licencia: ",
"admin.license.keyRemove": "Remover la Licencia Enterprise y Degradar el Servidor",
"admin.license.noFile": "No se subió ningún archivo",
"admin.license.removing": "Removiendo Licencia...",
- "admin.license.teamEdition": "Mattermost Edición Team. Diseñado para equipos desde 5 hasta 50 usuarios.",
- "admin.license.teamType": "<span><p>Esta versión compilada de la plataforma de Mattermost es proporcionada bajo la licencia MIT.</p><p>Lea MIT-COMPILED-LICENSE.txt en el directorio raíz de la instalación para más detalles. Lea NOTICES.txt para información sobre software libre utilizado en este sistema.</p></span>",
"admin.license.title": "Edición y Licencia",
"admin.license.type": "Licencia: ",
"admin.license.upload": "Subir",
diff --git a/webapp/i18n/pt.json b/webapp/i18n/pt.json
index bd40bfb9e..41d3bbc1c 100644
--- a/webapp/i18n/pt.json
+++ b/webapp/i18n/pt.json
@@ -1,12 +1,12 @@
{
"about.close": "Fechar",
"about.date": "Data De Criação:",
- "about.enterpriseEditione1": "Enterprise Edition E1",
+ "about.enterpriseEditione1": "Enterprise Edition",
"about.hash": "Hash de Compilação:",
"about.licensed": "Licenciado pela:",
"about.number": "O Número De Compilação:",
- "about.teamEditiont0": "Team Edition T0",
- "about.teamEditiont1": "Team Edition T1",
+ "about.teamEditiont0": "Team Edition",
+ "about.teamEditiont1": "Enterprise Edition",
"about.title": "Sobre o Mattermost",
"about.version": "Versão:",
"access_history.title": "Histórico de Acesso",
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index a4aa7604c..872bdb8ab 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -429,6 +429,21 @@ export default {
uiName: 'Mention Highlight Link'
},
{
+ group: 'linkAndButtonElements',
+ id: 'linkColor',
+ uiName: 'Link Color'
+ },
+ {
+ group: 'linkAndButtonElements',
+ id: 'buttonBg',
+ uiName: 'Button BG'
+ },
+ {
+ group: 'linkAndButtonElements',
+ id: 'buttonColor',
+ uiName: 'Button Text'
+ },
+ {
group: 'centerChannelElements',
id: 'codeTheme',
uiName: 'Code Theme',
@@ -458,21 +473,6 @@ export default {
iconURL: monokaiIcon
}
]
- },
- {
- group: 'linkAndButtonElements',
- id: 'linkColor',
- uiName: 'Link Color'
- },
- {
- group: 'linkAndButtonElements',
- id: 'buttonBg',
- uiName: 'Button BG'
- },
- {
- group: 'linkAndButtonElements',
- id: 'buttonColor',
- uiName: 'Button Text'
}
],
DEFAULT_CODE_THEME: 'github',