mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added timestamps to pictures to stop caching
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,12 +74,14 @@ module.exports = React.createClass({
|
||||
currentUserCss = "current--user";
|
||||
}
|
||||
|
||||
var timestamp = UserStore.getCurrentUser().update_at;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div id={post.id} className={"post " + this.props.sameUser + " " + rootUser + " " + postType + " " + currentUserCss}>
|
||||
{ !this.props.hideProfilePic ?
|
||||
<div className="post-profile-img__container">
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + post.user_id + "/image"} height="36" width="36" />
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + post.user_id + "/image?time=" + timestamp} height="36" width="36" />
|
||||
</div>
|
||||
: "" }
|
||||
<div className="post__content">
|
||||
|
||||
@@ -342,7 +342,7 @@ module.exports = React.createClass({
|
||||
more_messages = (
|
||||
<div className="channel-intro">
|
||||
<div className="post-profile-img__container channel-intro-img">
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + teammate.id + "/image"} height="50" width="50" />
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + teammate.id + "/image?time=" + teammate.update_at} height="50" width="50" />
|
||||
</div>
|
||||
<div className="channel-intro-profile">
|
||||
<strong><UserProfile userId={teammate.id} /></strong>
|
||||
|
||||
@@ -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 (
|
||||
<div className={"post post--root " + currentUserCss}>
|
||||
<div className="post-profile-img__container">
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
|
||||
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image?time=" + timestamp} height="36" width="36" />
|
||||
</div>
|
||||
<div className="post__content">
|
||||
<ul className="post-header">
|
||||
|
||||
@@ -53,7 +53,7 @@ module.exports = React.createClass({
|
||||
var name = this.props.overwriteName ? this.props.overwriteName : this.state.profile.username;
|
||||
|
||||
|
||||
var data_content = "<img style='margin: 10px' src='/api/v1/users/" + this.state.profile.id + "/image' height='128' width='128' />";
|
||||
var data_content = "<img style='margin: 10px' src='/api/v1/users/" + this.state.profile.id + "/image?time=" + this.state.profile.update_at + "' height='128' width='128' />";
|
||||
if (!config.ShowEmail) {
|
||||
data_content += "<div class='text-nowrap'>Email not shared</div>";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user