Merge branch 'release/v1.0.0' of https://github.com/ONLYOFFICE/DocSpace into release/v1.0.0
This commit is contained in:
commit
7828abcec9
@ -26,6 +26,8 @@
|
||||
|
||||
using ASC.Core.Common.EF;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Data;
|
||||
|
||||
[Scope]
|
||||
@ -550,14 +552,8 @@ public class EFUserService : IUserService
|
||||
public void SetUserPhoto(int tenant, Guid id, byte[] photo)
|
||||
{
|
||||
using var userDbContext = _dbContextFactory.CreateDbContext();
|
||||
var strategy = userDbContext.Database.CreateExecutionStrategy();
|
||||
|
||||
strategy.Execute(async () =>
|
||||
{
|
||||
using var userDbContext = _dbContextFactory.CreateDbContext();
|
||||
using var tr = await userDbContext.Database.BeginTransactionAsync();
|
||||
|
||||
var userPhoto = await userDbContext.Photos.FirstOrDefaultAsync(r => r.UserId == id && r.Tenant == tenant);
|
||||
var userPhoto = userDbContext.Photos.FirstOrDefault(r => r.UserId == id && r.Tenant == tenant);
|
||||
|
||||
if (photo != null && photo.Length != 0)
|
||||
{
|
||||
@ -576,7 +572,7 @@ public class EFUserService : IUserService
|
||||
}
|
||||
|
||||
|
||||
await userDbContext.AddOrUpdateAsync(r => userDbContext.Photos, userPhoto);
|
||||
userDbContext.AddOrUpdate(userDbContext.Photos, userPhoto);
|
||||
|
||||
var userEntity = new User
|
||||
{
|
||||
@ -585,6 +581,7 @@ public class EFUserService : IUserService
|
||||
Tenant = tenant
|
||||
};
|
||||
|
||||
userDbContext.Users.Attach(userEntity);
|
||||
userDbContext.Entry(userEntity).Property(x => x.LastModified).IsModified = true;
|
||||
|
||||
}
|
||||
@ -593,10 +590,7 @@ public class EFUserService : IUserService
|
||||
userDbContext.Photos.Remove(userPhoto);
|
||||
}
|
||||
|
||||
await userDbContext.SaveChangesAsync();
|
||||
await tr.CommitAsync();
|
||||
}).GetAwaiter()
|
||||
.GetResult();
|
||||
userDbContext.SaveChanges();
|
||||
}
|
||||
|
||||
private IQueryable<User> GetUserQuery(UserDbContext userDbContext, int tenant)
|
||||
|
@ -154,7 +154,8 @@ const StyledComboButton = styled.div`
|
||||
? props.theme.comboBox.label.selectedColor
|
||||
: props.theme.comboBox.label.color};
|
||||
|
||||
max-width: ${(props) => props.theme.comboBox.label.maxWidth};
|
||||
max-width: ${(props) =>
|
||||
props.scaled ? "100%" : props.theme.comboBox.label.maxWidth};
|
||||
|
||||
${(props) =>
|
||||
props.noBorder &&
|
||||
|
@ -207,14 +207,14 @@ public class PhotoController : PeopleControllerBase
|
||||
throw new ImageSizeLimitException();
|
||||
}
|
||||
|
||||
var mainPhoto = _userPhotoManager.SaveOrUpdatePhoto(userId, data);
|
||||
var mainPhoto = await _userPhotoManager.SaveOrUpdatePhoto(userId, data);
|
||||
var userInfo = _userManager.GetUsers(userId);
|
||||
var cacheKey = Math.Abs(userInfo.LastModified.GetHashCode());
|
||||
|
||||
result.Data =
|
||||
new
|
||||
{
|
||||
main = (await mainPhoto).Item1 + $"?hash={cacheKey}",
|
||||
main = mainPhoto.Item1 + $"?hash={cacheKey}",
|
||||
retina = await _userPhotoManager.GetRetinaPhotoURL(userId) + $"?hash={cacheKey}",
|
||||
max = await _userPhotoManager.GetMaxPhotoURL(userId) + $"?hash={cacheKey}",
|
||||
big = await _userPhotoManager.GetBigPhotoURL(userId) + $"?hash={cacheKey}",
|
||||
|
@ -546,7 +546,7 @@ public class UserPhotoManager
|
||||
data = TryParseImage(data, -1, OriginalFotoSize, out _, out var width, out var height);
|
||||
_userManager.SaveUserPhoto(userID, data);
|
||||
SetUserPhotoThumbnailSettings(userID, width, height);
|
||||
_userPhotoManagerCache.ClearCache(userID, _tenantManager.GetCurrentTenant().Id);
|
||||
// _userPhotoManagerCache.ClearCache(userID, _tenantManager.GetCurrentTenant().Id);
|
||||
}
|
||||
|
||||
|
||||
@ -561,8 +561,7 @@ public class UserPhotoManager
|
||||
{
|
||||
_userManager.SaveUserPhoto(userID, data);
|
||||
SetUserPhotoThumbnailSettings(userID, width, height);
|
||||
_userPhotoManagerCache.ClearCache(userID, _tenantManager.GetCurrentTenant().Id);
|
||||
|
||||
// _userPhotoManagerCache.ClearCache(userID, _tenantManager.GetCurrentTenant().Id);
|
||||
}
|
||||
|
||||
var store = GetDataStore();
|
||||
|
Loading…
Reference in New Issue
Block a user