Merge branch 'hotfix/v1.1.2' of https://github.com/ONLYOFFICE/DocSpace into hotfix/1.1.2

This commit is contained in:
Maria Sukhova 2023-08-04 09:44:33 +03:00
commit ce51ad4f9e
4 changed files with 53 additions and 31 deletions

View File

@ -38,9 +38,8 @@ const WhiteLabel = (props) => {
} = props;
const [isLoadedData, setIsLoadedData] = useState(false);
const [logoTextWhiteLabel, setLogoTextWhiteLabel] = useState("");
const [defaultLogoTextWhiteLabel, setDefaultLogoTextWhiteLabel] = useState(
""
);
const [defaultLogoTextWhiteLabel, setDefaultLogoTextWhiteLabel] =
useState("");
const [logoUrlsWhiteLabel, setLogoUrlsWhiteLabel] = useState(null);
const [isSaving, setIsSaving] = useState(false);
@ -89,26 +88,24 @@ const WhiteLabel = (props) => {
const onUseTextAsLogo = () => {
let newLogos = logoUrlsWhiteLabel;
for (let i = 0; i < logoUrlsWhiteLabel.length; i++) {
const width = logoUrlsWhiteLabel[i].size.width / 2;
const height = logoUrlsWhiteLabel[i].size.height / 2;
const options = getLogoOptions(i, logoTextWhiteLabel);
const isDocsEditorName = logoUrlsWhiteLabel[i].name === "DocsEditor";
const logoLight = generateLogo(
width,
height,
options.width,
options.height,
options.text,
options.fontSize,
isDocsEditorName ? "#fff" : "#000",
options.isEditorLogo
options.alignCenter
);
const logoDark = generateLogo(
width,
height,
options.width,
options.height,
options.text,
options.fontSize,
"#fff",
options.isEditorLogo
options.alignCenter
);
newLogos[i].path.light = logoLight;
newLogos[i].path.dark = logoDark;

View File

@ -8,19 +8,22 @@ export const generateLogo = (
text,
fontSize = 18,
fontColor = "#000",
isEditorLogo = false
alignCenter
) => {
const canvas = document.createElement("canvas");
canvas.width = isEditorLogo ? "154" : width;
canvas.height = isEditorLogo ? "27" : height;
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext("2d");
const x = alignCenter ? width / 2 : 0;
ctx.fillStyle = "transparent";
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = fontColor;
ctx.textAlign = "start";
ctx.textBaseline = "top";
ctx.textAlign = alignCenter ? "center" : "start";
ctx.textBaseline = "middle";
ctx.font = `${fontSize}px Arial`;
ctx.fillText(text, 0, height / 2 - fontSize / 2);
ctx.fillText(text, x, height - fontSize / 2);
return canvas.toDataURL();
};
@ -28,21 +31,33 @@ export const generateLogo = (
export const getLogoOptions = (index, text) => {
switch (index) {
case 0:
return { fontSize: 18, text: text };
return { fontSize: 18, text: text, width: 211, height: 24 };
case 1:
return { fontSize: 44, text: text };
return { fontSize: 32, text: text, width: 384, height: 42 };
case 2:
return { fontSize: 16, text: text.trim().charAt(0) };
return {
fontSize: 26,
text: text.trim().charAt(0),
width: 30,
height: 30,
alignCenter: true,
};
case 3:
return { fontSize: 16, text: text, isEditorLogo: true };
return { fontSize: 22, text: text, width: 154, height: 27 };
case 4:
return { fontSize: 16, text: text, isEditorLogo: true };
return { fontSize: 22, text: text, width: 154, height: 27 };
case 5:
return { fontSize: 30, text: text.trim().charAt(0) };
return {
fontSize: 24,
text: text.trim().charAt(0),
width: 28,
height: 28,
alignCenter: true,
};
case 6:
return { fontSize: 32, text: text };
return { fontSize: 18, text: text, width: 211, height: 24 };
default:
return { fontSize: 18, text: text };
return { fontSize: 18, text: text, width: 211, height: 24 };
}
};

View File

@ -189,6 +189,7 @@ internal abstract class GoogleDriveDaoBase : ThirdPartyProviderDao<GoogleDrivePr
return null;
}
_logger.Error($"googleDriveError:{driveEntry.Error},{driveEntry.ErrorId}");
var folder = GetErrorFolder(new ErrorEntry(driveEntry.Error, driveEntry.ErrorId));
folder.Title = MakeFolderTitle(driveEntry);

View File

@ -176,7 +176,7 @@ public sealed class UserManagerWrapper
throw new Exception(_customNamingPeople.Substitute<Resource>("ErrorEmailAlreadyExists"));
}
if (makeUniqueName)
if (makeUniqueName && !updateExising)
{
userInfo.UserName = MakeUniqueName(userInfo);
}
@ -190,7 +190,16 @@ public sealed class UserManagerWrapper
userInfo.ActivationStatus = !afterInvite ? EmployeeActivationStatus.Pending : EmployeeActivationStatus.Activated;
}
var newUserInfo = await _userManager.SaveUserInfo(userInfo, type, isCardDav, !updateExising);
UserInfo newUserInfo;
if (updateExising)
{
newUserInfo = await _userManager.UpdateUserInfo(userInfo);
}
else
{
newUserInfo = await _userManager.SaveUserInfo(userInfo, type, isCardDav, !updateExising);
}
_securityContext.SetUserPasswordHash(newUserInfo.Id, passwordHash);
if (_coreBaseSettings.Personal)