Merge branch 'release-3.0'
Этот коммит содержится в:
@@ -127,7 +127,7 @@ func checkUserNotDisabled(user *model.User) *model.AppError {
|
||||
}
|
||||
|
||||
func authenticateUser(user *model.User, password, mfaToken string) (*model.User, *model.AppError) {
|
||||
ldapAvailable := *utils.Cfg.LdapSettings.Enable && einterfaces.GetLdapInterface() != nil
|
||||
ldapAvailable := *utils.Cfg.LdapSettings.Enable && einterfaces.GetLdapInterface() != nil && utils.IsLicensed && *utils.License.Features.LDAP
|
||||
|
||||
if user.AuthService == model.USER_AUTH_SERVICE_LDAP {
|
||||
if !ldapAvailable {
|
||||
|
||||
@@ -266,6 +266,10 @@ func JoinUserToTeam(team *model.Team, user *model.User) *model.AppError {
|
||||
return tmr.Err
|
||||
}
|
||||
|
||||
if uua := <-Srv.Store.User().UpdateUpdateAt(user.Id); uua.Err != nil {
|
||||
return uua.Err
|
||||
}
|
||||
|
||||
// Soft error if there is an issue joining the default channels
|
||||
if err := JoinDefaultChannels(team.Id, user, channelRole); err != nil {
|
||||
l4g.Error(utils.T("api.user.create_user.joining.error"), user.Id, team.Id, err)
|
||||
|
||||
@@ -487,7 +487,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getUserForLogin(loginId string, onlyLdap bool) (*model.User, *model.AppError) {
|
||||
ldapAvailable := *utils.Cfg.LdapSettings.Enable && einterfaces.GetLdapInterface() != nil
|
||||
ldapAvailable := *utils.Cfg.LdapSettings.Enable && einterfaces.GetLdapInterface() != nil && utils.IsLicensed && *utils.License.Features.LDAP
|
||||
|
||||
if result := <-Srv.Store.User().GetForLogin(
|
||||
loginId,
|
||||
|
||||
@@ -434,6 +434,8 @@ func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
IsOAuth: false,
|
||||
}
|
||||
|
||||
c.TeamId = hook.TeamId
|
||||
|
||||
if !c.HasPermissionsToChannel(pchan, "createIncomingHook") && channel.Type != model.CHANNEL_OPEN {
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.permissions.app_error", nil, "")
|
||||
return
|
||||
|
||||
@@ -197,6 +197,27 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel {
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (us SqlUserStore) UpdateUpdateAt(userId string) StoreChannel {
|
||||
storeChannel := make(StoreChannel)
|
||||
|
||||
go func() {
|
||||
result := StoreResult{}
|
||||
|
||||
curTime := model.GetMillis()
|
||||
|
||||
if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
|
||||
result.Err = model.NewLocAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_update.app_error", nil, "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)
|
||||
|
||||
@@ -461,7 +482,7 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
|
||||
WHERE
|
||||
UserId = :UserId
|
||||
AND Category = 'direct_channel_show')
|
||||
ORDER BY UpdateAt DESC
|
||||
ORDER BY UpdateAt DESC LIMIT 1
|
||||
`, map[string]interface{}{"UserId": userId})
|
||||
if err != nil {
|
||||
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())
|
||||
|
||||
@@ -105,6 +105,30 @@ func TestUserStoreUpdate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserStoreUpdateUpdateAt(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
u1 := &model.User{}
|
||||
u1.Email = model.NewId()
|
||||
Must(store.User().Save(u1))
|
||||
Must(store.Team().SaveMember(&model.TeamMember{TeamId: model.NewId(), UserId: u1.Id}))
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
if err := (<-store.User().UpdateUpdateAt(u1.Id)).Err; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
|
||||
t.Fatal(r1.Err)
|
||||
} else {
|
||||
if r1.Data.(*model.User).UpdateAt <= u1.UpdateAt {
|
||||
t.Fatal("UpdateAt not updated correctly")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestUserStoreUpdateLastPingAt(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ type UserStore interface {
|
||||
Save(user *model.User) StoreChannel
|
||||
Update(user *model.User, allowRoleUpdate bool) StoreChannel
|
||||
UpdateLastPictureUpdate(userId string) 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
|
||||
|
||||
@@ -43,6 +43,15 @@ class FilteredUserList extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
// assume the user list is immutable
|
||||
if (this.props.users !== nextProps.users) {
|
||||
this.setState({
|
||||
users: this.filterUsers(nextProps.teamMembers, nextProps.users)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.filter !== this.state.filter) {
|
||||
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
|
||||
|
||||
Ссылка в новой задаче
Block a user