From c3aed620316241eba48ecd2fd1f36a309bcfdff9 Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 9 Jul 2015 16:37:03 -0700 Subject: Added timestamps to pictures to stop caching --- store/sql_user_store.go | 19 +++++++++++++++++++ store/store.go | 1 + web/react/components/post.jsx | 4 +++- web/react/components/post_list.jsx | 2 +- web/react/components/post_right.jsx | 3 ++- web/react/components/user_profile.jsx | 2 +- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/store/sql_user_store.go b/store/sql_user_store.go index fc3d125c4..77470946c 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -150,6 +150,25 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha return storeChannel } +func (us SqlUserStore) UpdateUpdateAt(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = ? WHERE Id = ?", model.GetMillis(), userId); err != nil { + result.Err = model.NewAppError("SqlUserStore.UpdateUpdateAt", "We couldn't update the update_at", "user_id="+userId) + } else { + result.Data = userId + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (us SqlUserStore) UpdateLastPingAt(userId string, time int64) StoreChannel { storeChannel := make(StoreChannel) diff --git a/store/store.go b/store/store.go index 070ee0562..0ed045788 100644 --- a/store/store.go +++ b/store/store.go @@ -77,6 +77,7 @@ type PostStore interface { type UserStore interface { Save(user *model.User) StoreChannel Update(user *model.User, allowRoleUpdate bool) StoreChannel + UpdateUpdateAt(userId string) StoreChannel UpdateLastPingAt(userId string, time int64) StoreChannel UpdateLastActivityAt(userId string, time int64) StoreChannel UpdateUserAndSessionActivity(userId string, sessionId string, time int64) StoreChannel diff --git a/web/react/components/post.jsx b/web/react/components/post.jsx index 04b5ba082..726fb1b02 100644 --- a/web/react/components/post.jsx +++ b/web/react/components/post.jsx @@ -74,12 +74,14 @@ module.exports = React.createClass({ currentUserCss = "current--user"; } + var timestamp = UserStore.getCurrentUser().update_at; + return (
{ !this.props.hideProfilePic ?
- +
: "" }
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index d6dc9ce30..e6e028209 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -342,7 +342,7 @@ module.exports = React.createClass({ more_messages = (
- +
diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index 115ee87d4..d48b0f0ef 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -67,6 +67,7 @@ RootPost = React.createClass({ var message = utils.textToJsx(this.props.post.message); var filenames = this.props.post.filenames; var isOwner = UserStore.getCurrentId() == this.props.post.user_id; + var timestamp = UserStore.getProfile(this.props.post.user_id).update_at; var type = "Post"; if (this.props.post.root_id.length > 0) { @@ -118,7 +119,7 @@ RootPost = React.createClass({ return (
- +
    diff --git a/web/react/components/user_profile.jsx b/web/react/components/user_profile.jsx index 648960471..89d0a80ff 100644 --- a/web/react/components/user_profile.jsx +++ b/web/react/components/user_profile.jsx @@ -53,7 +53,7 @@ module.exports = React.createClass({ var name = this.props.overwriteName ? this.props.overwriteName : this.state.profile.username; - var data_content = ""; + var data_content = ""; if (!config.ShowEmail) { data_content += "
    Email not shared
    "; } else { -- cgit v1.2.3-1-g7c22 From 7d6d9c297f21fa8cf0848c071bcdd13691fb3d9b Mon Sep 17 00:00:00 2001 From: nickago Date: Fri, 10 Jul 2015 09:56:41 -0700 Subject: Added User update function --- api/user.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/user.go b/api/user.go index 483ae67b5..bdd26e097 100644 --- a/api/user.go +++ b/api/user.go @@ -135,6 +135,8 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) { user.EmailVerified = true } + user.EmailVerified = true + ruser := CreateUser(c, team, user) if c.Err != nil { return @@ -729,6 +731,8 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) { return } + Srv.Store.User().UpdateUpdateAt(c.Session.UserId) + c.LogAudit("") } -- cgit v1.2.3-1-g7c22 From f5d188e1caa4b27eb4878de41e479199ca0cafda Mon Sep 17 00:00:00 2001 From: nickago Date: Fri, 10 Jul 2015 09:57:17 -0700 Subject: Added async get to channel swap --- web/react/utils/utils.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 5ded0e76f..a5ed08d67 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -707,6 +707,7 @@ module.exports.switchChannel = function(channel, teammate_name) { AsyncClient.getChannels(true, true, true); AsyncClient.getChannelExtraInfo(true); AsyncClient.getPosts(true, channel.id); + AsyncClient.getProfiles(); $('.inner__wrap').removeClass('move--right'); $('.sidebar--left').removeClass('move--right'); -- cgit v1.2.3-1-g7c22 From c485dad84f9a94c3d1261f7e2207baf071c2d3ca Mon Sep 17 00:00:00 2001 From: nickago Date: Mon, 13 Jul 2015 09:22:42 -0700 Subject: Added update function to image update and fixed corner cases --- web/react/components/member_list_item.jsx | 3 ++- web/react/components/member_list_team.jsx | 5 +++-- web/react/components/mention.jsx | 4 +++- web/react/components/post_right.jsx | 3 ++- web/react/components/search_results.jsx | 3 ++- web/react/utils/utils.jsx | 1 - 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/web/react/components/member_list_item.jsx b/web/react/components/member_list_item.jsx index 357fd49a8..cf8c71d7e 100644 --- a/web/react/components/member_list_item.jsx +++ b/web/react/components/member_list_item.jsx @@ -23,6 +23,7 @@ module.exports = React.createClass({ var member = this.props.member; var isAdmin = this.props.isAdmin; var isMemberAdmin = member.roles.indexOf("admin") > -1; + var timestamp = UserStore.getCurrentUser().update_at; var invite; if (member.invited && this.props.handleInvite) { @@ -53,7 +54,7 @@ module.exports = React.createClass({ return (
    - + {member.username} {member.email} { invite } diff --git a/web/react/components/member_list_team.jsx b/web/react/components/member_list_team.jsx index cfb473e5e..aa53c5db6 100644 --- a/web/react/components/member_list_team.jsx +++ b/web/react/components/member_list_team.jsx @@ -61,7 +61,8 @@ var MemberListTeamItem = React.createClass({ render: function() { var server_error = this.state.server_error ?
    : null; var user = this.props.user; - var currentRoles = "Member" + var currentRoles = "Member"; + var timestamp = UserStore.getCurrentUser().update_at; if (user.roles.length > 0) { currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1); @@ -83,7 +84,7 @@ var MemberListTeamItem = React.createClass({ return (
    - + {user.full_name.trim() ? user.full_name : user.username} {user.full_name.trim() ? user.username : email}
    diff --git a/web/react/components/mention.jsx b/web/react/components/mention.jsx index 3c33ddf49..520b81cbb 100644 --- a/web/react/components/mention.jsx +++ b/web/react/components/mention.jsx @@ -1,5 +1,6 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. +var UserStore = require("../stores/user_store.jsx"); module.exports = React.createClass({ handleClick: function() { @@ -7,8 +8,9 @@ module.exports = React.createClass({ }, render: function() { var icon; + var timestamp = UserStore.getCurrentUser().update_at; if (this.props.id != null) { - icon = ; + icon = ; } diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index d48b0f0ef..408fbf83a 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -228,11 +228,12 @@ CommentPost = React.createClass({ } var message = utils.textToJsx(this.props.post.message); + var timestamp = UserStore.getCurrentUser().update_at; return (
    - +
      diff --git a/web/react/components/search_results.jsx b/web/react/components/search_results.jsx index 003a38b7e..156cf0120 100644 --- a/web/react/components/search_results.jsx +++ b/web/react/components/search_results.jsx @@ -76,6 +76,7 @@ SearchItem = React.createClass({ var message = utils.textToJsx(this.props.post.message, {searchTerm: this.props.term, noMentionHighlight: !this.props.isMentionSearch}); var channelName = ""; var channel = ChannelStore.get(this.props.post.channel_id) + var timestamp = UserStore.getCurrentUser().update_at; if (channel) { if (channel.type === 'D') { @@ -89,7 +90,7 @@ SearchItem = React.createClass({
      { channelName }
      - +
        diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index a5ed08d67..5ded0e76f 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -707,7 +707,6 @@ module.exports.switchChannel = function(channel, teammate_name) { AsyncClient.getChannels(true, true, true); AsyncClient.getChannelExtraInfo(true); AsyncClient.getPosts(true, channel.id); - AsyncClient.getProfiles(); $('.inner__wrap').removeClass('move--right'); $('.sidebar--left').removeClass('move--right'); -- cgit v1.2.3-1-g7c22 From aff43f43f8185ae6d5555ca9f99bfcc4bd3eb99e Mon Sep 17 00:00:00 2001 From: nickago Date: Mon, 13 Jul 2015 09:27:30 -0700 Subject: removed testing state --- api/user.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/user.go b/api/user.go index bdd26e097..5b052e826 100644 --- a/api/user.go +++ b/api/user.go @@ -135,8 +135,6 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) { user.EmailVerified = true } - user.EmailVerified = true - ruser := CreateUser(c, team, user) if c.Err != nil { return -- cgit v1.2.3-1-g7c22