summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NOTICE.txt76
-rw-r--r--PULL_REQUEST_TEMPLATE.md2
-rw-r--r--api4/channel.go8
-rw-r--r--app/channel.go28
-rw-r--r--i18n/en.json12
-rw-r--r--model/post.go2
6 files changed, 53 insertions, 75 deletions
diff --git a/NOTICE.txt b/NOTICE.txt
index 4668d63e3..08f555694 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1677,43 +1677,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-This product contains a modified portion of 'asn1-ber', an ASN1 BER Encoding / Decoding Library for the GO programming language by The Go Authors.
-
-* HOMEPAGE:
- * http://gopkg.in/asn1-ber.v1
-
-* LICENSE:
-
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
----
-
## redigo
This product contains a modified portion of 'redigo', a Go client for the Redis database.
@@ -2309,43 +2272,6 @@ SOFTWARE.
---
-This product contains a modified portion of 'letsencrypt' to manage TLS certificates automatically via LetsEncrypt.org, built by Russ Cox.
-
-* HOMEPAGE:
- * https://github.com/rsc/letsencrypt
-
-* LICENSE:
-
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
----
-
This product contains a modified portion of ‘manners’ a polite webserver for Go, built by Braintree, a division of PayPal, Inc.
* HOMEPAGE:
@@ -3563,3 +3489,5 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+---
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
index 085b2d142..32a5e5a95 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -15,5 +15,5 @@ When filling in a section please remove the help text and the above text.
- [ ] All new/modified APIs include changes to the drivers
- [ ] Has enterprise changes (please link)
- [ ] Has UI changes
-- [ ] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/mattermost-server/blob/master/i18n/en.json) updates
+- [ ] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/mattermost-server/blob/master/i18n/en.json)) updates
- [ ] Touches critical sections of the codebase (auth, upgrade, etc.)
diff --git a/api4/channel.go b/api4/channel.go
index 1670770c6..f5f6bd06d 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -119,6 +119,7 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
oldChannel.Purpose = channel.Purpose
oldChannelDisplayName := oldChannel.DisplayName
+ oldChannelType := oldChannel.Type
if len(channel.DisplayName) > 0 {
oldChannel.DisplayName = channel.DisplayName
@@ -141,6 +142,13 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
l4g.Error(err.Error())
}
}
+
+ if oldChannelType == model.CHANNEL_OPEN && channel.Type == model.CHANNEL_PRIVATE {
+ if err := c.App.PostConvertChannelToPrivate(c.Session.UserId, channel); err != nil {
+ l4g.Error(err.Error())
+ }
+ }
+
c.LogAudit("name=" + channel.Name)
w.Write([]byte(oldChannel.ToJson()))
}
diff --git a/app/channel.go b/app/channel.go
index cd694af0f..eadb94c2f 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -809,6 +809,34 @@ func (a *App) PostUpdateChannelDisplayNameMessage(userId string, channel *model.
return nil
}
+func (a *App) PostConvertChannelToPrivate(userId string, channel *model.Channel) *model.AppError {
+ uc := a.Srv.Store.User().Get(userId)
+
+ if uresult := <-uc; uresult.Err != nil {
+ return model.NewAppError("PostConvertChannelToPrivate", "api.channel.post_convert_channel_to_private.retrieve_user.error", nil, uresult.Err.Error(), http.StatusBadRequest)
+ } else {
+ user := uresult.Data.(*model.User)
+
+ message := fmt.Sprintf(utils.T("api.channel.post_convert_channel_to_private.updated_from"), user.Username)
+
+ post := &model.Post{
+ ChannelId: channel.Id,
+ Message: message,
+ Type: model.POST_CONVERT_CHANNEL,
+ UserId: userId,
+ Props: model.StringInterface{
+ "username": user.Username,
+ },
+ }
+
+ if _, err := a.CreatePost(post, channel, false); err != nil {
+ return model.NewAppError("PostConvertChannelToPrivate", "api.channel.post_convert_channel_to_private.create_post.error", nil, err.Error(), http.StatusInternalServerError)
+ }
+ }
+
+ return nil
+}
+
func (a *App) GetChannel(channelId string) (*model.Channel, *model.AppError) {
if result := <-a.Srv.Store.Channel().Get(channelId, true); result.Err != nil && result.Err.Id == "store.sql_channel.get.existing.app_error" {
result.Err.StatusCode = http.StatusNotFound
diff --git a/i18n/en.json b/i18n/en.json
index a63ee2af6..cf3e88b5a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -336,6 +336,18 @@
"translation": "%v left the channel."
},
{
+ "id": "api.channel.post_convert_channel_to_private.create_post.error",
+ "translation": "Failed to post channel conversion to private message"
+ },
+ {
+ "id": "api.channel.post_convert_channel_to_private.retrieve_user.error",
+ "translation": "Failed to retrieve user while converting the channel from public to private"
+ },
+ {
+ "id": "api.channel.post_convert_channel_to_private.updated_from",
+ "translation": "%s converted the channel from public to private"
+ },
+ {
"id": "api.channel.post_update_channel_displayname_message_and_forget.create_post.error",
"translation": "Failed to post displayname update message"
},
diff --git a/model/post.go b/model/post.go
index ae0627a03..09303c0cd 100644
--- a/model/post.go
+++ b/model/post.go
@@ -33,6 +33,7 @@ const (
POST_REMOVE_FROM_TEAM = "system_remove_from_team"
POST_HEADER_CHANGE = "system_header_change"
POST_DISPLAYNAME_CHANGE = "system_displayname_change"
+ POST_CONVERT_CHANNEL = "system_convert_channel"
POST_PURPOSE_CHANGE = "system_purpose_change"
POST_CHANNEL_DELETED = "system_channel_deleted"
POST_EPHEMERAL = "system_ephemeral"
@@ -207,6 +208,7 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
POST_HEADER_CHANGE,
POST_PURPOSE_CHANGE,
POST_DISPLAYNAME_CHANGE,
+ POST_CONVERT_CHANNEL,
POST_CHANNEL_DELETED,
POST_CHANGE_CHANNEL_PRIVACY:
default: