From 364aa15bfa217d812d523a042f58008daafdd2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl?= Date: Mon, 10 Aug 2020 01:37:16 +0200 Subject: [PATCH] Improve --options (#4) * Disable configuration in System Console * Pinned posts are not deleted by default * Added flag `--delete-pinned-posts` * Added flag `--confirm` * Updated README.md --- .golangci.yml | 2 +- Makefile | 2 +- README.md | 11 ++--- go.mod | 2 +- go.sum | 6 +-- plugin.json | 7 +-- screenshot.png | Bin 57699 -> 128331 bytes server/command.go | 112 +++++++++++++++++++++++++++++++++++--------- server/http.go | 9 +++- server/manifest.go | 5 -- server/utilities.go | 40 ++++++++++------ 11 files changed, 135 insertions(+), 61 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8b75d38..93bc566 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,7 +9,7 @@ linters-settings: gofmt: simplify: true goimports: - local-prefixes: github.com/nathanaelhoun/mattermost-plugin-postmanager + local-prefixes: github.com/nathanaelhoun/mattermost-plugin-clear golint: min-confidence: 0 govet: diff --git a/Makefile b/Makefile index cf12b20..2cf0c6c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GO ?= $(shell command -v go 2> /dev/null) NPM ?= $(shell command -v npm 2> /dev/null) CURL ?= $(shell command -v curl 2> /dev/null) -DEBUG ?=1 +DEBUG ?= MANIFEST_FILE ?= plugin.json GOPATH ?= $(shell go env GOPATH) GO_TEST_FLAGS ?= -race diff --git a/README.md b/README.md index 1aa01f8..1c15027 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,19 @@ [![CircleCI branch](https://img.shields.io/circleci/project/github/nathanaelhoun/mattermost-plugin-clear/master.svg)](https://circleci.com/gh/nathanaelhoun/mattermost-plugin-clear) -This [mattermost](https://mattermost.org) plugin allow to delete post with a command. +This [Mattermost](https://mattermost.org) plugin allow to delete posts with a /command. ![Plugin screenshot](./screenshot.png) -**Supported Mattermost Server Versions: 5.2+** (command autocomplete with Mattermost 5.24+) +**Supported Mattermost Server Versions: 5.12+** (command autocomplete with Mattermost 5.24+) ## Features -#### Manage posts with commands - `/clear [number-of-post]` Delete the last `[number-of-post]` posts in the current channel -Available options : - _incoming feature_ +### Available options : +* `--delete-pinned-posts` Also delete pinned post (disabled by default) +* `--confirm` Do not show confirmation dialog ## Installation diff --git a/go.mod b/go.mod index d9a21be..900a948 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/mattermost/mattermost-plugin-starter-template go 1.12 require ( - github.com/mattermost/mattermost-server/v5 v5.24.0-rc3 + github.com/mattermost/mattermost-server/v5 v5.24.1 github.com/pkg/errors v0.9.1 ) diff --git a/go.sum b/go.sum index 8855ebe..b6847e2 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,7 @@ github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2o github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/squirrel v1.2.0/go.mod h1:yaPeOnPG5ZRwL9oKdTsO/prlkPbXWZlRVMQ/gGlzIuA= github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PaulARoy/azurestoragecache v0.0.0-20170906084534-3c249a3ba788/go.mod h1:lY1dZd8HBzJ10eqKERHn3CU59tfhzcAVb2c0ZhIWSOk= github.com/RoaringBitmap/roaring v0.4.21/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= @@ -279,8 +280,8 @@ github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible/go. github.com/mattermost/gosaml2 v0.3.2/go.mod h1:Z429EIOiEi9kbq6yHoApfzlcXpa6dzRDc6pO+Vy2Ksk= github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d h1:2DV7VIlEv6J5R5o6tUcb3ZMKJYeeZuWZL7Rv1m23TgQ= github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ= -github.com/mattermost/mattermost-server/v5 v5.24.0-rc3 h1:+fQNocygVkOnh0LV+x97qWxKd/Ibydk8ju2PKx1PSXk= -github.com/mattermost/mattermost-server/v5 v5.24.0-rc3/go.mod h1:wmIfEohk+D0xbFFfJPNvvUYaxeqUNKQcPZejT73m9YM= +github.com/mattermost/mattermost-server/v5 v5.24.1 h1:dkEDqjLTtgqlQTc03kEi7N2IgBT9cZmzLs6XPylpMUo= +github.com/mattermost/mattermost-server/v5 v5.24.1/go.mod h1:TVkOfVyk4wGw8j5J2IX3PDCP5R7j20IEP4FAezDK8Wk= github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs= github.com/mattermost/viper v1.0.4/go.mod h1:uc5hKG9lv4/KRwPOt2c1omOyirS/UnuA2TytiZQSFHM= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -312,7 +313,6 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mkraft/gziphandler v1.1.2-0.20200509175700-73dc64f3ad90/go.mod h1:gG8WEPb2aI5MHdmHv83au7bk3molRSZiAjdxYrEMJdQ= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= diff --git a/plugin.json b/plugin.json index 826215b..2a8470e 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "id": "com.github.nathanaelhoun.plugin-clear", "name": "Clear", - "description": "Delete multiple posts with a command.", + "description": "Delete multiple posts with a /command.", "version": "0.2.0", "min_server_version": "5.12.0", "server": { @@ -10,10 +10,5 @@ "darwin-amd64": "server/dist/plugin-darwin-amd64", "windows-amd64": "server/dist/plugin-windows-amd64.exe" } - }, - "settings_schema": { - "header": "", - "footer": "* To report an issue, make a suggestion or a contribution, [check the repository](https://github.com/nathanaelhoun/mattermost-plugin-clear).", - "settings": [] } } \ No newline at end of file diff --git a/screenshot.png b/screenshot.png index d417b76e0a7728a4ee4720a0e217a9375c7e1538..58451c13b3ccfa941db08dd3644fe0d2d6ddacda 100644 GIT binary patch literal 128331 zcmb5W1ys~u*ET!`_?Hls5)e@lkZzDx5fFxu?q-0YyUSou5Rh(Ax@+i`Ze-|gknXPU z40=EJbKl>3*LvUOLYKpD&YZK)K6_vLy7rkb@1(_Wu}HBX5D2dL+c$C$2*yna3*R3Fy@l*tc6mj;;ilLlaM=a&+6@)=J2{PBD`6Q z*hAu}1Md5IV=9qG5=!|y1;0o&;XTGSeUuej`oc5?YqzJ(@R#V@N}%w&@+O&eCNC`!sz2a-BZwOvB- zH?I_&M%N}B-zgl|aGmTNcb;Psd>fztdTkMLh{!x0I-OLvoXB)ttufjtJzkD3fq#1jbrc#*%Whg3p#SzL zp70XBqzeUeP=Ts*eyY9f6Jo?kpn^cWdS0o@OKs6e{S2IXYI+RJXRuC#fCuYgmIE^Za^SgdRfsrA1m5Yb~SQNaTSm>aWLF>^q9}@Qc3OO zlGg9PkOCX$74bln1QSfzD53~K7pD90>OVAp=I>OXs+fPrF$Dd4dW5n9!hU_Up4J-=W!?70szo2vd{y(IyRZsU9>2NSEk0cY$EYD6>3hZR2BwXW>c zxmfmtC;SQ57_<6UKk5gfs*AVJ!J