diff options
Diffstat (limited to 'api')
52 files changed, 155 insertions, 160 deletions
diff --git a/api/admin.go b/api/admin.go index d9714d6d2..2167868e0 100644 --- a/api/admin.go +++ b/api/admin.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/admin_test.go b/api/admin_test.go index ad7ac08f8..0e51644d8 100644 --- a/api/admin_test.go +++ b/api/admin_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/api.go b/api/api.go index a50cce946..5c3c0d8c6 100644 --- a/api/api.go +++ b/api/api.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/api_test.go b/api/api_test.go index 761f3e33f..bea949ad2 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_channels.go b/api/auto_channels.go index b72e5d538..ab1fe6ed3 100644 --- a/api/auto_channels.go +++ b/api/auto_channels.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_constants.go b/api/auto_constants.go index 73ecb47f8..f5d5dab0c 100644 --- a/api/auto_constants.go +++ b/api/auto_constants.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_enviroment.go b/api/auto_enviroment.go index dd663533c..c6453f5da 100644 --- a/api/auto_enviroment.go +++ b/api/auto_enviroment.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_posts.go b/api/auto_posts.go index a014d22ae..b64217c55 100644 --- a/api/auto_posts.go +++ b/api/auto_posts.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_teams.go b/api/auto_teams.go index dd82abe8d..6677ac9bf 100644 --- a/api/auto_teams.go +++ b/api/auto_teams.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/auto_users.go b/api/auto_users.go index 39ed201b9..d1e3d494e 100644 --- a/api/auto_users.go +++ b/api/auto_users.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/channel.go b/api/channel.go index 0d22d7c00..adf125378 100644 --- a/api/channel.go +++ b/api/channel.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api @@ -26,11 +26,11 @@ func InitChannel(r *mux.Router) { sr.Handle("/update_notify_props", ApiUserRequired(updateNotifyProps)).Methods("POST") sr.Handle("/{id:[A-Za-z0-9]+}/", ApiUserRequiredActivity(getChannel, false)).Methods("GET") sr.Handle("/{id:[A-Za-z0-9]+}/extra_info", ApiUserRequired(getChannelExtraInfo)).Methods("GET") - sr.Handle("/{id:[A-Za-z0-9]+}/join", ApiUserRequired(joinChannel)).Methods("POST") - sr.Handle("/{id:[A-Za-z0-9]+}/leave", ApiUserRequired(leaveChannel)).Methods("POST") + sr.Handle("/{id:[A-Za-z0-9]+}/join", ApiUserRequired(join)).Methods("POST") + sr.Handle("/{id:[A-Za-z0-9]+}/leave", ApiUserRequired(leave)).Methods("POST") sr.Handle("/{id:[A-Za-z0-9]+}/delete", ApiUserRequired(deleteChannel)).Methods("POST") - sr.Handle("/{id:[A-Za-z0-9]+}/add", ApiUserRequired(addChannelMember)).Methods("POST") - sr.Handle("/{id:[A-Za-z0-9]+}/remove", ApiUserRequired(removeChannelMember)).Methods("POST") + sr.Handle("/{id:[A-Za-z0-9]+}/add", ApiUserRequired(addMember)).Methods("POST") + sr.Handle("/{id:[A-Za-z0-9]+}/remove", ApiUserRequired(removeMember)).Methods("POST") sr.Handle("/{id:[A-Za-z0-9]+}/update_last_viewed_at", ApiUserRequired(updateLastViewedAt)).Methods("POST") } @@ -329,7 +329,7 @@ func getChannelCounts(c *Context, w http.ResponseWriter, r *http.Request) { } } -func joinChannel(c *Context, w http.ResponseWriter, r *http.Request) { +func join(c *Context, w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) channelId := params["id"] @@ -360,43 +360,62 @@ func JoinChannel(c *Context, channelId string, role string) { channel := cresult.Data.(*model.Channel) user := uresult.Data.(*model.User) - if !c.HasPermissionsToTeam(channel.TeamId, "joinChannel") { - return - } - - if channel.DeleteAt > 0 { - c.Err = model.NewAppError("joinChannel", "The channel has been archived or deleted", "") - c.Err.StatusCode = http.StatusBadRequest + if !c.HasPermissionsToTeam(channel.TeamId, "join") { return } if channel.Type == model.CHANNEL_OPEN { - cm := &model.ChannelMember{ChannelId: channel.Id, UserId: c.Session.UserId, - Roles: role, NotifyProps: model.GetDefaultChannelNotifyProps()} - - if cmresult := <-Srv.Store.Channel().SaveMember(cm); cmresult.Err != nil { - c.Err = cmresult.Err - return - } - - post := &model.Post{ChannelId: channel.Id, Message: fmt.Sprintf( - `User %v has joined this channel.`, - user.Username), Type: model.POST_JOIN_LEAVE} - if _, err := CreatePost(c, post, false); err != nil { - l4g.Error("Failed to post join message %v", err) - c.Err = model.NewAppError("joinChannel", "Failed to send join request", "") + if _, err := AddUserToChannel(user, channel); err != nil { + c.Err = err return } - - UpdateChannelAccessCacheAndForget(c.Session.TeamId, c.Session.UserId, channel.Id) + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(`User %v has joined this channel.`, user.Username)) } else { - c.Err = model.NewAppError("joinChannel", "You do not have the appropriate permissions", "") + c.Err = model.NewAppError("join", "You do not have the appropriate permissions", "") c.Err.StatusCode = http.StatusForbidden return } } } +func PostUserAddRemoveMessageAndForget(c *Context, channelId string, message string) { + go func() { + post := &model.Post{ + ChannelId: channelId, + Message: message, + Type: model.POST_JOIN_LEAVE, + } + if _, err := CreatePost(c, post, false); err != nil { + l4g.Error("Failed to post join/leave message %v", err) + } + }() +} + +func AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelMember, *model.AppError) { + if channel.DeleteAt > 0 { + return nil, model.NewAppError("AddUserToChannel", "The channel has been archived or deleted", "") + } + + if channel.Type != model.CHANNEL_OPEN && channel.Type != model.CHANNEL_PRIVATE { + return nil, model.NewAppError("AddUserToChannel", "Can not add user to this channel type", "") + } + + newMember := &model.ChannelMember{ChannelId: channel.Id, UserId: user.Id, NotifyProps: model.GetDefaultChannelNotifyProps()} + if cmresult := <-Srv.Store.Channel().SaveMember(newMember); cmresult.Err != nil { + l4g.Error("Failed to add member user_id=%v channel_id=%v err=%v", user.Id, channel.Id, cmresult.Err) + return nil, model.NewAppError("AddUserToChannel", "Failed to add user to channel", "") + } + + go func() { + UpdateChannelAccessCache(channel.TeamId, user.Id, channel.Id) + + message := model.NewMessage(channel.TeamId, channel.Id, user.Id, model.ACTION_USER_ADDED) + PublishAndForget(message) + }() + + return newMember, nil +} + func JoinDefaultChannels(user *model.User, channelRole string) *model.AppError { // We don't call JoinChannel here since c.Session is not populated on user creation @@ -427,7 +446,7 @@ func JoinDefaultChannels(user *model.User, channelRole string) *model.AppError { return err } -func leaveChannel(c *Context, w http.ResponseWriter, r *http.Request) { +func leave(c *Context, w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) id := params["id"] @@ -445,24 +464,18 @@ func leaveChannel(c *Context, w http.ResponseWriter, r *http.Request) { channel := cresult.Data.(*model.Channel) user := uresult.Data.(*model.User) - if !c.HasPermissionsToTeam(channel.TeamId, "leaveChannel") { - return - } - - if channel.DeleteAt > 0 { - c.Err = model.NewAppError("leaveChannel", "The channel has been archived or deleted", "") - c.Err.StatusCode = http.StatusBadRequest + if !c.HasPermissionsToTeam(channel.TeamId, "leave") { return } if channel.Type == model.CHANNEL_DIRECT { - c.Err = model.NewAppError("leaveChannel", "Cannot leave a direct message channel", "") + c.Err = model.NewAppError("leave", "Cannot leave a direct message channel", "") c.Err.StatusCode = http.StatusForbidden return } if channel.Name == model.DEFAULT_CHANNEL { - c.Err = model.NewAppError("leaveChannel", "Cannot leave the default channel "+model.DEFAULT_CHANNEL, "") + c.Err = model.NewAppError("leave", "Cannot leave the default channel "+model.DEFAULT_CHANNEL, "") c.Err.StatusCode = http.StatusForbidden return } @@ -472,16 +485,9 @@ func leaveChannel(c *Context, w http.ResponseWriter, r *http.Request) { return } - UpdateChannelAccessCacheAndForget(c.Session.TeamId, c.Session.UserId, channel.Id) + RemoveUserFromChannel(c.Session.UserId, c.Session.UserId, channel) - post := &model.Post{ChannelId: channel.Id, Message: fmt.Sprintf( - `%v has left the channel.`, - user.Username), Type: model.POST_JOIN_LEAVE} - if _, err := CreatePost(c, post, false); err != nil { - l4g.Error("Failed to post leave message %v", err) - c.Err = model.NewAppError("leaveChannel", "Failed to send leave message", "") - return - } + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(`%v has left the channel.`, user.Username)) result := make(map[string]string) result["id"] = channel.Id @@ -656,7 +662,7 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) { } } -func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { +func addMember(c *Context, w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) id := params["id"] @@ -664,7 +670,7 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { userId := data["user_id"] if len(userId) != 26 { - c.SetInvalidParam("addChannelMember", "user_id") + c.SetInvalidParam("addMember", "user_id") return } @@ -674,55 +680,35 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { nuc := Srv.Store.User().Get(userId) // Only need to be a member of the channel to add a new member - if !c.HasPermissionsToChannel(cchan, "addChannelMember") { + if !c.HasPermissionsToChannel(cchan, "addMember") { return } if nresult := <-nuc; nresult.Err != nil { - c.Err = model.NewAppError("addChannelMember", "Failed to find user to be added", "") + c.Err = model.NewAppError("addMember", "Failed to find user to be added", "") return } else if cresult := <-sc; cresult.Err != nil { - c.Err = model.NewAppError("addChannelMember", "Failed to find channel", "") + c.Err = model.NewAppError("addMember", "Failed to find channel", "") return } else { channel := cresult.Data.(*model.Channel) nUser := nresult.Data.(*model.User) - if channel.DeleteAt > 0 { - c.Err = model.NewAppError("updateChannel", "The channel has been archived or deleted", "") - c.Err.StatusCode = http.StatusBadRequest - return - } - if oresult := <-ouc; oresult.Err != nil { - c.Err = model.NewAppError("addChannelMember", "Failed to find user doing the adding", "") + c.Err = model.NewAppError("addMember", "Failed to find user doing the adding", "") return } else { oUser := oresult.Data.(*model.User) - cm := &model.ChannelMember{ChannelId: channel.Id, UserId: userId, NotifyProps: model.GetDefaultChannelNotifyProps()} - - if cmresult := <-Srv.Store.Channel().SaveMember(cm); cmresult.Err != nil { - l4g.Error("Failed to add member user_id=%v channel_id=%v err=%v", userId, id, cmresult.Err) - c.Err = model.NewAppError("addChannelMember", "Failed to add user to channel", "") + cm, err := AddUserToChannel(nUser, channel) + if err != nil { + c.Err = err return } c.LogAudit("name=" + channel.Name + " user_id=" + userId) - go func() { - post := &model.Post{ChannelId: id, Message: fmt.Sprintf( - `%v added to the channel by %v`, - nUser.Username, oUser.Username), Type: model.POST_JOIN_LEAVE} - if _, err := CreatePost(c, post, false); err != nil { - l4g.Error("Failed to post add member to channel message, err=%v", err) - } - - UpdateChannelAccessCache(c.Session.TeamId, userId, channel.Id) - message := model.NewMessage(c.Session.TeamId, channel.Id, userId, model.ACTION_USER_ADDED) - - PublishAndForget(message) - }() + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(`%v added to the channel by %v`, nUser.Username, oUser.Username)) <-Srv.Store.Channel().UpdateLastViewedAt(id, oUser.Id) w.Write([]byte(cm.ToJson())) @@ -730,20 +716,20 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { } } -func removeChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { +func removeMember(c *Context, w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) - id := params["id"] + channelId := params["id"] data := model.MapFromJson(r.Body) - userId := data["user_id"] + userIdToRemove := data["user_id"] - if len(userId) != 26 { - c.SetInvalidParam("addChannelMember", "user_id") + if len(userIdToRemove) != 26 { + c.SetInvalidParam("removeMember", "user_id") return } - sc := Srv.Store.Channel().Get(id) - cmc := Srv.Store.Channel().GetMember(id, c.Session.UserId) + sc := Srv.Store.Channel().Get(channelId) + cmc := Srv.Store.Channel().GetMember(channelId, c.Session.UserId) if cresult := <-sc; cresult.Err != nil { c.Err = cresult.Err @@ -753,48 +739,52 @@ func removeChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { return } else { channel := cresult.Data.(*model.Channel) - channelMember := cmcresult.Data.(model.ChannelMember) + removerChannelMember := cmcresult.Data.(model.ChannelMember) - if !c.HasPermissionsToTeam(channel.TeamId, "removeChannelMember") { + if !c.HasPermissionsToTeam(channel.TeamId, "removeMember") { return } - if !strings.Contains(channelMember.Roles, model.CHANNEL_ROLE_ADMIN) && !strings.Contains(c.Session.Roles, model.ROLE_TEAM_ADMIN) { + if !strings.Contains(removerChannelMember.Roles, model.CHANNEL_ROLE_ADMIN) && !c.IsTeamAdmin() { c.Err = model.NewAppError("updateChannel", "You do not have the appropriate permissions ", "") c.Err.StatusCode = http.StatusForbidden return } - if channel.DeleteAt > 0 { - c.Err = model.NewAppError("updateChannel", "The channel has been archived or deleted", "") - c.Err.StatusCode = http.StatusBadRequest + if err := RemoveUserFromChannel(userIdToRemove, c.Session.UserId, channel); err != nil { + c.Err = model.NewAppError("updateChannel", "Unable to remove user.", err.Message) return } - if cmresult := <-Srv.Store.Channel().RemoveMember(id, userId); cmresult.Err != nil { - c.Err = cmresult.Err - return - } - - c.LogAudit("name=" + channel.Name + " user_id=" + userId) - - go func() { - UpdateChannelAccessCache(c.Session.TeamId, userId, id) - - message := model.NewMessage(c.Session.TeamId, "", userId, model.ACTION_USER_REMOVED) - message.Add("channel_id", id) - message.Add("remover", c.Session.UserId) - PublishAndForget(message) - }() + c.LogAudit("name=" + channel.Name + " user_id=" + userIdToRemove) result := make(map[string]string) result["channel_id"] = channel.Id - result["removed_user_id"] = userId + result["removed_user_id"] = userIdToRemove w.Write([]byte(model.MapToJson(result))) } } +func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError { + if channel.DeleteAt > 0 { + return model.NewAppError("updateChannel", "The channel has been archived or deleted", "") + } + + if cmresult := <-Srv.Store.Channel().RemoveMember(channel.Id, userIdToRemove); cmresult.Err != nil { + return cmresult.Err + } + + UpdateChannelAccessCacheAndForget(channel.TeamId, userIdToRemove, channel.Id) + + message := model.NewMessage(channel.TeamId, "", userIdToRemove, model.ACTION_USER_REMOVED) + message.Add("channel_id", channel.Id) + message.Add("remover", removerUserId) + PublishAndForget(message) + + return nil +} + func updateNotifyProps(c *Context, w http.ResponseWriter, r *http.Request) { data := model.MapFromJson(r.Body) diff --git a/api/channel_benchmark_test.go b/api/channel_benchmark_test.go index 7820f4a03..58e3fa18d 100644 --- a/api/channel_benchmark_test.go +++ b/api/channel_benchmark_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/channel_test.go b/api/channel_test.go index e6c7ed80e..899016065 100644 --- a/api/channel_test.go +++ b/api/channel_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/command.go b/api/command.go index 427922344..94b2cd2f8 100644 --- a/api/command.go +++ b/api/command.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/command_test.go b/api/command_test.go index 360c4da58..476748c6b 100644 --- a/api/command_test.go +++ b/api/command_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/context.go b/api/context.go index e80582b2a..bd9744bf8 100644 --- a/api/context.go +++ b/api/context.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/context_test.go b/api/context_test.go index 23a5b75b9..a9e2afa0f 100644 --- a/api/context_test.go +++ b/api/context_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/export.go b/api/export.go index aff34073f..fa9686005 100644 --- a/api/export.go +++ b/api/export.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/file.go b/api/file.go index bb9aa00d8..9ebcd821b 100644 --- a/api/file.go +++ b/api/file.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/file_benchmark_test.go b/api/file_benchmark_test.go index 47f8bff43..a02bffa0e 100644 --- a/api/file_benchmark_test.go +++ b/api/file_benchmark_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/file_test.go b/api/file_test.go index 657c08131..b337eadc4 100644 --- a/api/file_test.go +++ b/api/file_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/import.go b/api/import.go index c465825b4..81de78975 100644 --- a/api/import.go +++ b/api/import.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/oauth.go b/api/oauth.go index 26c3c5da8..5753db8bd 100644 --- a/api/oauth.go +++ b/api/oauth.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/oauth_test.go b/api/oauth_test.go index 18db49bc5..64d9c6fd9 100644 --- a/api/oauth_test.go +++ b/api/oauth_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/post.go b/api/post.go index 65dad0eb6..58fd3488a 100644 --- a/api/post.go +++ b/api/post.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/post_benchmark_test.go b/api/post_benchmark_test.go index 861c687fb..00eb3c468 100644 --- a/api/post_benchmark_test.go +++ b/api/post_benchmark_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/post_test.go b/api/post_test.go index 358611240..1971b6114 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/server.go b/api/server.go index 3f23d8df6..347f0e2c9 100644 --- a/api/server.go +++ b/api/server.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/server_test.go b/api/server_test.go index 2d1d57392..a9837203f 100644 --- a/api/server_test.go +++ b/api/server_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/sharding.go b/api/sharding.go index 569d3a232..2a5db408c 100644 --- a/api/sharding.go +++ b/api/sharding.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/slackimport.go b/api/slackimport.go index 4e6c01dbb..06032c068 100644 --- a/api/slackimport.go +++ b/api/slackimport.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/team.go b/api/team.go index 9021fefb9..6aa5ec1bb 100644 --- a/api/team.go +++ b/api/team.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/team_test.go b/api/team_test.go index e2a7cf430..9b701911b 100644 --- a/api/team_test.go +++ b/api/team_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/templates/email_change_body.html b/api/templates/email_change_body.html index d4e6abd02..41fd6e4c3 100644 --- a/api/templates/email_change_body.html +++ b/api/templates/email_change_body.html @@ -37,7 +37,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/email_change_verify_body.html b/api/templates/email_change_verify_body.html index 356f2454c..1e1bcc22d 100644 --- a/api/templates/email_change_verify_body.html +++ b/api/templates/email_change_verify_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/find_teams_body.html b/api/templates/find_teams_body.html index 3046ee5f8..41f9dac01 100644 --- a/api/templates/find_teams_body.html +++ b/api/templates/find_teams_body.html @@ -45,7 +45,7 @@ <img width="65" src="{{.ClientProps.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/invite_body.html b/api/templates/invite_body.html index fdfcfa9f1..57feef5d9 100644 --- a/api/templates/invite_body.html +++ b/api/templates/invite_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/password_change_body.html b/api/templates/password_change_body.html index c420d7a69..542df4b74 100644 --- a/api/templates/password_change_body.html +++ b/api/templates/password_change_body.html @@ -37,7 +37,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/post_body.html b/api/templates/post_body.html index 1dd30ca45..63a53bf3c 100644 --- a/api/templates/post_body.html +++ b/api/templates/post_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/reset_body.html b/api/templates/reset_body.html index d388689cf..4bafc57e8 100644 --- a/api/templates/reset_body.html +++ b/api/templates/reset_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/signup_team_body.html b/api/templates/signup_team_body.html index 83c1679b9..dc2cb32ec 100644 --- a/api/templates/signup_team_body.html +++ b/api/templates/signup_team_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/verify_body.html b/api/templates/verify_body.html index def067a84..0613b5dd5 100644 --- a/api/templates/verify_body.html +++ b/api/templates/verify_body.html @@ -40,7 +40,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/templates/welcome_body.html b/api/templates/welcome_body.html index ff31ee8d5..94b597cbb 100644 --- a/api/templates/welcome_body.html +++ b/api/templates/welcome_body.html @@ -31,7 +31,7 @@ <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt=""> </p> <p style="padding: 0 50px;"> - (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> + (c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a> </p> </td> diff --git a/api/user.go b/api/user.go index 34cbec151..faf828cf9 100644 --- a/api/user.go +++ b/api/user.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/user_test.go b/api/user_test.go index baa567dec..77309e5b2 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/web_conn.go b/api/web_conn.go index 4315f5650..a5099e520 100644 --- a/api/web_conn.go +++ b/api/web_conn.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/web_hub.go b/api/web_hub.go index 15528c612..f80488824 100644 --- a/api/web_hub.go +++ b/api/web_hub.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/web_socket.go b/api/web_socket.go index 75936a8d5..298e44b44 100644 --- a/api/web_socket.go +++ b/api/web_socket.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/web_socket_test.go b/api/web_socket_test.go index 49a4c6870..63c4dd05d 100644 --- a/api/web_socket_test.go +++ b/api/web_socket_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api @@ -55,12 +55,17 @@ func TestSocket(t *testing.T) { time.Sleep(300 * time.Millisecond) Client.Must(Client.JoinChannel(channel1.Id)) - // Read the join channel message that gets generated + // Read the user_added message that gets generated var rmsg model.Message if err := c2.ReadJSON(&rmsg); err != nil { t.Fatal(err) } + // Read the second user_added message that gets generated + if err := c2.ReadJSON(&rmsg); err != nil { + t.Fatal(err) + } + // Test sending message without a channelId m := model.NewMessage("", "", "", model.ACTION_TYPING) m.Add("RootId", model.NewId()) diff --git a/api/web_team_hub.go b/api/web_team_hub.go index 31c8dfedf..c57de550f 100644 --- a/api/web_team_hub.go +++ b/api/web_team_hub.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/webhook.go b/api/webhook.go index e694b202c..de4ba6691 100644 --- a/api/webhook.go +++ b/api/webhook.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api diff --git a/api/webhook_test.go b/api/webhook_test.go index 22883f8ca..16b9c9529 100644 --- a/api/webhook_test.go +++ b/api/webhook_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api |