summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/post.go3
-rw-r--r--config/config.json3
-rw-r--r--docker/0.6/config_docker.json1
-rw-r--r--docker/dev/config_docker.json1
-rw-r--r--docker/local/config_docker.json1
-rw-r--r--utils/config.go1
-rw-r--r--utils/mail.go6
-rw-r--r--web/react/components/login.jsx2
-rw-r--r--web/react/components/post_info.jsx4
-rw-r--r--web/react/components/post_list.jsx45
-rw-r--r--web/react/stores/post_store.jsx22
-rw-r--r--web/react/utils/constants.jsx5
12 files changed, 73 insertions, 21 deletions
diff --git a/api/post.go b/api/post.go
index f6699d181..c013df87f 100644
--- a/api/post.go
+++ b/api/post.go
@@ -696,8 +696,7 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
}
message := model.NewMessage(c.Session.TeamId, post.ChannelId, c.Session.UserId, model.ACTION_POST_DELETED)
- message.Add("post_id", post.Id)
- message.Add("channel_id", post.ChannelId)
+ message.Add("post", post.ToJson())
PublishAndForget(message)
diff --git a/config/config.json b/config/config.json
index e7134cba5..f1f3ba22c 100644
--- a/config/config.json
+++ b/config/config.json
@@ -73,7 +73,8 @@
"SMTPUsername": "",
"SMTPPassword": "",
"SMTPServer": "",
- "UseTLS": false,
+ "UseTLS": false,
+ "UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",
diff --git a/docker/0.6/config_docker.json b/docker/0.6/config_docker.json
index 128dc1274..157120b99 100644
--- a/docker/0.6/config_docker.json
+++ b/docker/0.6/config_docker.json
@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
+ "UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",
diff --git a/docker/dev/config_docker.json b/docker/dev/config_docker.json
index cd612c7fe..d336300ca 100644
--- a/docker/dev/config_docker.json
+++ b/docker/dev/config_docker.json
@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
+ "UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",
diff --git a/docker/local/config_docker.json b/docker/local/config_docker.json
index cd612c7fe..d336300ca 100644
--- a/docker/local/config_docker.json
+++ b/docker/local/config_docker.json
@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
+ "UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",
diff --git a/utils/config.go b/utils/config.go
index a3944f670..536d0d802 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -85,6 +85,7 @@ type EmailSettings struct {
SMTPPassword string
SMTPServer string
UseTLS bool
+ UseStartTLS bool
FeedbackEmail string
FeedbackName string
ApplePushServer string
diff --git a/utils/mail.go b/utils/mail.go
index d152b2669..f02e21253 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -73,6 +73,12 @@ func newSMTPClient(conn net.Conn) (*smtp.Client, *model.AppError) {
if err = c.Auth(auth); err != nil {
return nil, model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error())
}
+ } else if Cfg.EmailSettings.UseStartTLS {
+ tlsconfig := &tls.Config{
+ InsecureSkipVerify: true,
+ ServerName: host,
+ }
+ c.StartTLS(tlsconfig)
}
return c, nil
}
diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx
index f9eacf094..b61ea931e 100644
--- a/web/react/components/login.jsx
+++ b/web/react/components/login.jsx
@@ -56,7 +56,7 @@ module.exports = React.createClass({
},
function loginFailed(err) {
if (err.message === 'Login failed because email address has not been verified') {
- window.location.href = '/verify_email?name=' + encodeURIComponent(name) + '&email=' + encodeURIComponent(email);
+ window.location.href = '/verify_email?teamname=' + encodeURIComponent(name) + '&email=' + encodeURIComponent(email);
return;
}
state.serverError = err.message;
diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx
index c5b015cb9..c96a04c7c 100644
--- a/web/react/components/post_info.jsx
+++ b/web/react/components/post_info.jsx
@@ -22,6 +22,10 @@ export default class PostInfo extends React.Component {
var isOwner = UserStore.getCurrentId() === post.user_id;
var isAdmin = UserStore.getCurrentUser().roles.indexOf('admin') > -1;
+ if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.state === Constants.POST_DELETED) {
+ return '';
+ }
+
var type = 'Post';
if (post.root_id && post.root_id.length > 0) {
type = 'Comment';
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index bebd6847f..5fbee99f6 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -23,12 +23,31 @@ function getStateFromStores() {
}
var postList = PostStore.getCurrentPosts();
+ var deletedPosts = PostStore.getUnseenDeletedPosts(channel.id);
+
+ if (deletedPosts && Object.keys(deletedPosts).length > 0) {
+ for (var pid in deletedPosts) {
+ postList.posts[pid] = deletedPosts[pid];
+ postList.order.unshift(pid);
+ }
+
+ postList.order.sort(function postSort(a, b) {
+ if (postList.posts[a].create_at > postList.posts[b].create_at) {
+ return -1;
+ }
+ if (postList.posts[a].create_at < postList.posts[b].create_at) {
+ return 1;
+ }
+ return 0;
+ });
+ }
+
var pendingPostList = PostStore.getPendingPosts(channel.id);
if (pendingPostList) {
postList.order = pendingPostList.order.concat(postList.order);
- for (var pid in pendingPostList.posts) {
- postList.posts[pid] = pendingPostList.posts[pid];
+ for (var ppid in pendingPostList.posts) {
+ postList.posts[ppid] = pendingPostList.posts[ppid];
}
}
@@ -88,7 +107,6 @@ module.exports = React.createClass({
$('.modal-body').css('max-height', $(window).height() * 0.7);
});
- // Timeout exists for the DOM to fully render before making changes
var self = this;
$(window).resize(function resize() {
$(postHolder).perfectScrollbar('update');
@@ -185,6 +203,7 @@ module.exports = React.createClass({
}
}
if (this.state.channel.id !== newState.channel.id) {
+ PostStore.clearUnseenDeletedPosts(this.state.channel.id);
this.scrolledToNew = false;
}
this.setState(newState);
@@ -220,23 +239,19 @@ module.exports = React.createClass({
activeRootPostId = activeRoot.id;
}
- if (this.state.channel.id === msg.channel_id) {
- postList = this.state.postList;
- if (!(msg.props.post_id in this.state.postList.posts)) {
- return;
- }
+ post = JSON.parse(msg.props.post);
+ postList = this.state.postList;
+
+ PostStore.storeUnseenDeletedPost(post);
- delete postList.posts[msg.props.post_id];
- var index = postList.order.indexOf(msg.props.post_id);
+ if (postList.posts[post.id]) {
+ delete postList.posts[post.id];
+ var index = postList.order.indexOf(post.id);
if (index > -1) {
postList.order.splice(index, 1);
}
- this.setState({postList: postList});
-
PostStore.storePosts(msg.channel_id, postList);
- } else {
- AsyncClient.getPosts(true, msg.channel_id);
}
if (activeRootPostId === msg.props.post_id && UserStore.getCurrentId() !== msg.user_id) {
@@ -318,7 +333,7 @@ module.exports = React.createClass({
var lastViewed = Number.MAX_VALUE;
if (ChannelStore.getCurrentMember() != null) {
- lastViewed = ChannelStore.getCurrentMember().lastViewed_at;
+ lastViewed = ChannelStore.getCurrentMember().last_viewed_at;
}
if (this.state.postList != null) {
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index 3e4fde30a..2fffb17d0 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -172,6 +172,28 @@ var PostStore = assign({}, EventEmitter.prototype, {
getPendingPosts: function(channelId) {
return BrowserStore.getItem('pending_posts_' + channelId);
},
+ storeUnseenDeletedPost: function(post) {
+ var posts = this.getUnseenDeletedPosts(post.channel_id);
+
+ if (!posts) {
+ posts = {};
+ }
+
+ post.message = '(message deleted)';
+ post.state = Constants.POST_DELETED;
+
+ posts[post.id] = post;
+ this.storeUnseenDeletedPosts(post.channel_id, posts);
+ },
+ storeUnseenDeletedPosts: function(channelId, posts) {
+ BrowserStore.setItem('deleted_posts_' + channelId, posts);
+ },
+ getUnseenDeletedPosts: function(channelId) {
+ return BrowserStore.getItem('deleted_posts_' + channelId);
+ },
+ clearUnseenDeletedPosts: function(channelId) {
+ BrowserStore.setItem('deleted_posts_' + channelId, {});
+ },
removePendingPost: function(channelId, pendingPostId) {
this._removePendingPost(channelId, pendingPostId);
this.emitChange();
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index 41b02c8d6..8239a4a69 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -63,8 +63,9 @@ module.exports = {
GOOGLE_SERVICE: 'google',
POST_CHUNK_SIZE: 60,
MAX_POST_CHUNKS: 3,
- POST_LOADING: "loading",
- POST_FAILED: "failed",
+ POST_LOADING: 'loading',
+ POST_FAILED: 'failed',
+ POST_DELETED: 'deleted',
RESERVED_TEAM_NAMES: [
"www",
"web",