Merge branch 'develop' into feature/VDR-room

This commit is contained in:
Nikita Gopienko 2023-09-14 12:56:59 +03:00
commit 920e634322
25 changed files with 133 additions and 96 deletions

View File

@ -281,7 +281,7 @@ public class Tests
Assert.True(allExist, message.ToString());
}
[Test, Order(4)]
/*[Test, Order(4)]
public void CompliesToRulePunctuationLead()
{
CompliesToRule("The punctuation at the start of the messages doesn't match up:\n", CheckRules.CompliesToRulePunctuationLead);
@ -292,7 +292,7 @@ public class Tests
{
CompliesToRule("The punctuation at the end of the messages doesn't match up:\n", CheckRules.CompliesToRulePunctuationTail);
}
*/
[Test, Order(6)]
public void CompliesToRuleWhiteSpaceLead()
{

View File

@ -3,6 +3,7 @@
"AddMembersDescription": "You can add new team members manually or invite them via link.",
"AddNewExternalLink": "Add new external link",
"AddNewLink": "Add new link",
"CreateNewLink": "Create new link",
"All": "All",
"AllFiles": "All files",
"AllLinksAreDisabled": "All links are disabled",
@ -71,6 +72,7 @@
"InviteUsersInRoom": "Invite users in room",
"LimitByTimePeriod": "Limit by time period",
"LinkAddedSuccessfully": "Link added successfully",
"LinkCreatedSuccessfully": "Link successfully created",
"LinkDeletedSuccessfully": "Link deleted successfully",
"LinkDisabledSuccessfully": "Link disabled successfully",
"LinkEditedSuccessfully": "Link edited successfully",

View File

@ -26,7 +26,7 @@ export const getHeaderLabel = (
return t("Translations:CreateMasterFormFromFile");
if (!!filterParam) return t("Common:SelectFile");
return t("Common:Save");
return t("Common:SaveButton");
};
export const getAcceptButtonLabel = (

View File

@ -7,6 +7,7 @@ import FieldContainer from "@docspace/components/field-container";
const LinkBlock = (props) => {
const {
t,
isEdit,
isLoading,
shareLink,
linkNameValue,
@ -40,6 +41,7 @@ const LinkBlock = (props) => {
isDisabled={isLoading}
/>
{isEdit && (
<TextInput
scale
size="base"
@ -50,6 +52,7 @@ const LinkBlock = (props) => {
value={linkValue}
placeholder={t("ExternalLink")}
/>
)}
</div>
);
};

View File

@ -113,7 +113,7 @@ const EditLinkPanel = (props) => {
} else {
copy(link?.sharedTo?.shareLink);
toastr.success(t("Files:LinkAddedSuccessfully"));
toastr.success(t("Files:LinkCreatedSuccessfully"));
}
})
.catch((err) => toastr.error(err?.message))
@ -179,13 +179,14 @@ const EditLinkPanel = (props) => {
>
<div className="edit-link_header">
<Heading className="edit-link_heading">
{isEdit ? t("Files:EditLink") : t("Files:AddNewLink")}
{isEdit ? t("Files:EditLink") : t("Files:CreateNewLink")}
</Heading>
</div>
<StyledScrollbar stype="mediumBlack">
<div className="edit-link_body">
<LinkBlock
t={t}
isEdit={isEdit}
isLoading={isLoading}
shareLink={shareLink}
linkNameValue={linkNameValue}
@ -230,7 +231,7 @@ const EditLinkPanel = (props) => {
scale
primary
size="normal"
label={t("Common:SaveButton")}
label={isEdit ? t("Common:SaveButton") : t("Common:Create")}
isDisabled={isLoading || !linkNameIsValid || isExpired}
onClick={onSave}
/>

View File

@ -58,7 +58,7 @@ const DeliveryDatePicker = ({
isApplied,
setIsApplied,
}) => {
const { t } = useTranslation(["Webhooks", "Common"]);
const { t, i18n } = useTranslation(["Webhooks", "Common"]);
const calendarRef = useRef();
const selectorRef = useRef();
@ -114,6 +114,7 @@ const DeliveryDatePicker = ({
onChange={closeCalendar}
isMobile={isMobileOnly}
forwardedRef={calendarRef}
locale={i18n.language}
/>
);
@ -178,6 +179,7 @@ const DeliveryDatePicker = ({
onChange={onDateSet}
selectedDateText={t("SelectDate")}
showCalendarIcon={false}
locale={i18n.language}
/>
)}
{filters.deliveryDate !== null &&
@ -198,6 +200,7 @@ const DeliveryDatePicker = ({
onChange={setDeliveryFrom}
hasError={!isTimeValid}
tabIndex={1}
locale={i18n.language}
/>
</span>
@ -210,6 +213,7 @@ const DeliveryDatePicker = ({
setDate={setDeliveryTo}
hasError={!isTimeValid}
tabIndex={2}
locale={i18n.language}
/>
</TimePickerCell>
) : (

View File

@ -174,6 +174,8 @@ const StyledContainer = styled.div`
.title-icon {
min-width: 16px;
min-height: 16px;
width: 16px;
height: 16px;
svg {
path,

View File

@ -13,6 +13,7 @@ export default {
type: "select",
options: [
"az",
"ar-SA",
"zh-cn",
"cs",
"nl",

View File

@ -33,7 +33,7 @@ export const DaysHeader = ({
<Title onClick={onTitleClick} className="days-header" isMobile={isMobile}>
{observedDate.format("MMMM").charAt(0).toUpperCase() +
observedDate.format("MMMM").substring(1)}{" "}
{observedDate.year()}
{observedDate.format("YYYY")}
<HeaderActionIcon isMobile={isMobile} />
</Title>
<HeaderButtons

View File

@ -38,7 +38,7 @@ export const MonthsHeader = ({
onClick={onTitleClick}
isMobile={isMobile}
>
{observedDate.year()}
{observedDate.format("YYYY")}
<HeaderActionIcon isMobile={isMobile} />
</Title>
<HeaderButtons

View File

@ -32,7 +32,8 @@ export const YearsHeader = ({
return (
<HeaderContainer>
<Title disabled className="years-header" isMobile={isMobile}>
{firstYear}-{firstYear + 9}
{moment(firstYear, "YYYY").format("YYYY")}-
{moment(firstYear + 9, "YYYY").format("YYYY")}
<HeaderActionIcon isMobile={isMobile} />
</Title>
<HeaderButtons

View File

@ -14,10 +14,12 @@ export const getCalendarDays = (date) => {
.startOf("week")
.date();
let yearMonthDate = observedDate.clone().format("YYYY-MM-");
for (let i = 1; i <= observedDate.clone().daysInMonth(); i++) {
currentMonthDays.push({
key: observedDate.clone().format("YYYY-MM") + "-" + i,
value: i,
key: yearMonthDate + moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
value: moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
});
}
@ -26,25 +28,30 @@ export const getCalendarDays = (date) => {
.clone()
.subtract(1, "months")
.daysInMonth();
yearMonthDate = observedDate
.clone()
.subtract(1, "months")
.format("YYYY-MM-");
for (let i = firstCalendarMonday; i <= prevMonthLength; i++) {
prevMonthDays.push({
key:
observedDate.clone().subtract(1, "months").format("YYYY-MM") +
"-" +
i,
value: i,
key: yearMonthDate + moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
value: moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
});
}
}
yearMonthDate = observedDate.clone().add(1, "months").format("YYYY-MM-");
for (
let i = 1;
i <= maxCalendarDays - currentMonthDays.length - prevMonthDays.length;
i++
) {
nextMonthDays.push({
key: observedDate.clone().add(1, "months").format("YYYY-MM") + "-" + i,
value: i,
key: yearMonthDate + moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
value: moment(yearMonthDate + i, "YYYY-MM-D").format("D"),
});
}

View File

@ -3,15 +3,16 @@ import moment from "moment";
export const getCalendarMonths = (observedDate) => {
const months = moment
.monthsShort()
.map((month) => (month[0].toUpperCase() + month.substring(1)));
.map((month) => month[0].toUpperCase() + month.substring(1));
const monthsObjs = months.map((month) => ({
key: `${observedDate.year()}-${moment().month(month).format("M")}`,
key: `${observedDate.format("YYYY")}-${moment().month(month).format("M")}`,
value: month,
}));
for (let i = 0; i < 4; i++) {
monthsObjs.push({
key: `${observedDate.year() + 1}-${moment()
key: `${observedDate.clone().add(1, "year").format("YYYY")}-${moment()
.month(months[i])
.format("M")}`,
value: monthsObjs[i].value,

View File

@ -1,10 +1,12 @@
import moment from "moment";
export const getCalendarYears = (observedDate) => {
const years = [];
const selectedYear = observedDate.year();
const firstYear = selectedYear - (selectedYear % 10) - 1;
for (let i = firstYear; i <= firstYear + 15; i++) {
years.push(i);
years.push(moment(i, "YYYY").format("YYYY"));
}
return years;

View File

@ -4,10 +4,6 @@ import moment from "moment";
import { getCalendarDays } from "./getCalendarDays";
import { ColorTheme, ThemeType } from "@docspace/components/ColorTheme";
const onDateClick = (handleDateChange, newDate) => {
handleDateChange(moment(newDate));
};
export const getDayElements = (
observedDate,
selectedDate,
@ -16,11 +12,10 @@ export const getDayElements = (
maxDate,
isMobile
) => {
const onClick = (newDate) => onDateClick(handleDateChange, newDate);
const dateFormat = "YYYY-MM-D";
const calendarDays = getCalendarDays(observedDate);
const monthDays = {
prevMonthDays: calendarDays.prevMonthDays.map((day) => (
<ColorTheme
@ -28,7 +23,7 @@ export const getDayElements = (
themeId={ThemeType.DateItem}
isSecondary
key={day.key}
onClick={() => onClick(moment(day.key, dateFormat))}
onClick={() => handleDateChange(moment(day.key, dateFormat))}
disabled={
moment(day.key, dateFormat) < minDate ||
moment(day.key, dateFormat) > maxDate
@ -43,7 +38,7 @@ export const getDayElements = (
className="day"
themeId={ThemeType.DateItem}
key={day.key}
onClick={() => onClick(moment(day.key, dateFormat))}
onClick={() => handleDateChange(moment(day.key, dateFormat))}
disabled={
moment(day.key, dateFormat) < minDate ||
moment(day.key, dateFormat) > maxDate
@ -59,7 +54,7 @@ export const getDayElements = (
themeId={ThemeType.DateItem}
isSecondary
key={day.key}
onClick={() => onClick(moment(day.key, dateFormat))}
onClick={() => handleDateChange(moment(day.key, dateFormat))}
disabled={
moment(day.key, dateFormat) < minDate ||
moment(day.key, dateFormat) > maxDate
@ -71,9 +66,9 @@ export const getDayElements = (
)),
};
const currentDate = moment().format("YYYY-MM") + "-" + moment().date();
const currentDate = moment().format("YYYY-MM-") + moment().format("D");
const selectedDateFormated =
moment(selectedDate).format("YYYY-MM") + "-" + moment(selectedDate).date();
moment(selectedDate).format("YYYY-MM-") + moment(selectedDate).format("D");
for (const key in calendarDays) {
calendarDays[key].forEach((day, index) => {
@ -84,7 +79,7 @@ export const getDayElements = (
themeId={ThemeType.DateItem}
isCurrent
key={day.key}
onClick={() => onClick(moment(day.key, dateFormat))}
onClick={() => handleDateChange(moment(day.key, dateFormat))}
disabled={
moment(day.key, dateFormat) < minDate ||
moment(day.key, dateFormat) > maxDate
@ -101,7 +96,7 @@ export const getDayElements = (
themeId={ThemeType.DateItem}
key={day.key}
focused
onClick={() => onClick(moment(day.key, dateFormat))}
onClick={() => handleDateChange(moment(day.key, dateFormat))}
disabled={
moment(day.key, dateFormat) < minDate ||
moment(day.key, dateFormat) > maxDate

View File

@ -2,16 +2,6 @@ import React from "react";
import moment from "moment";
import { ColorTheme, ThemeType } from "@docspace/components/ColorTheme";
const onDateClick = (dateString, setObservedDate, setSelectedScene) => {
setObservedDate((prevObservedDate) =>
prevObservedDate.clone().set({
year: dateString.substring(0, 4),
month: dateString.substring(5) - 1,
})
);
setSelectedScene((prevSelectedScene) => prevSelectedScene - 1);
};
export const getMonthElements = (
months,
setObservedDate,
@ -21,8 +11,18 @@ export const getMonthElements = (
maxDate,
isMobile
) => {
const onClick = (dateString) =>
onDateClick(dateString, setObservedDate, setSelectedScene);
const onDateClick = (dateString) => {
setObservedDate((prevObservedDate) =>
moment(
`${moment(dateString, "YYYY-M").format("YYYY")}-${moment(
dateString,
"YYYY-M"
).format("MM")}-${prevObservedDate.format("DD")}`,
"YYYY-MM-DD"
)
);
setSelectedScene((prevSelectedScene) => prevSelectedScene - 1);
};
const dateFormat = "YYYY-M";
@ -32,7 +32,7 @@ export const getMonthElements = (
themeId={ThemeType.DateItem}
big
key={month.key}
onClick={() => onClick(month.key)}
onClick={() => onDateClick(month.key)}
disabled={
moment(month.key, dateFormat).endOf("month") < minDate ||
moment(month.key, dateFormat).startOf("month") > maxDate
@ -50,7 +50,7 @@ export const getMonthElements = (
isSecondary
big
key={months[i].key}
onClick={() => onClick(months[i].key)}
onClick={() => onDateClick(months[i].key)}
disabled={
moment(months[i].key, dateFormat).endOf("month") < minDate ||
moment(months[i].key, dateFormat).startOf("month") > maxDate
@ -62,8 +62,8 @@ export const getMonthElements = (
);
}
const currentDate = `${moment().year()}-${moment().format("M")}`;
const formattedDate = `${moment(selectedDate).year()}-${moment(
const currentDate = `${moment().format("YYYY")}-${moment().format("M")}`;
const formattedDate = `${moment(selectedDate).format("YYYY")}-${moment(
selectedDate
).format("M")}`;
@ -76,7 +76,7 @@ export const getMonthElements = (
isCurrent
big
key={month.key}
onClick={() => onClick(month.key)}
onClick={() => onDateClick(month.key)}
disabled={
moment(month.key, dateFormat).endOf("month") < minDate ||
moment(month.key, dateFormat).startOf("month") > maxDate
@ -94,7 +94,7 @@ export const getMonthElements = (
big
key={month.key}
focused
onClick={() => onClick(month.key)}
onClick={() => onDateClick(month.key)}
disabled={
moment(month.key, dateFormat).endOf("month") < minDate ||
moment(month.key, dateFormat).startOf("month") > maxDate

View File

@ -3,13 +3,6 @@ import moment from "moment";
import { ColorTheme, ThemeType } from "@docspace/components/ColorTheme";
const onDateClick = (year, setObservedDate, setSelectedScene) => {
setObservedDate((prevObservedDate) =>
prevObservedDate.clone().set({ year: year })
);
setSelectedScene((prevSelectedScene) => prevSelectedScene - 1);
};
export const getYearElements = (
years,
setObservedDate,
@ -19,8 +12,17 @@ export const getYearElements = (
maxDate,
isMobile
) => {
const onClick = (year) =>
onDateClick(year, setObservedDate, setSelectedScene);
const onDateClick = (year) => {
setObservedDate((prevObservedDate) =>
moment(
`${moment(year, "YYYY").format("YYYY")}-${prevObservedDate.format(
"MM-DD"
)}`,
"YYYY-MM-DD"
)
);
setSelectedScene((prevSelectedScene) => prevSelectedScene - 1);
};
const yearElements = years.map((year) => (
<ColorTheme
@ -29,7 +31,7 @@ export const getYearElements = (
isSecondary
big
key={year}
onClick={() => onClick(year)}
onClick={() => onDateClick(year)}
disabled={
moment(year.toString()).endOf("year").endOf("month") < minDate ||
moment(year.toString()) > maxDate
@ -47,7 +49,7 @@ export const getYearElements = (
themeId={ThemeType.DateItem}
big
key={years[i]}
onClick={() => onClick(years[i])}
onClick={() => onDateClick(years[i])}
disabled={
moment(years[i].toString()).endOf("year").endOf("month") < minDate ||
moment(years[i].toString()) > maxDate
@ -59,8 +61,8 @@ export const getYearElements = (
);
}
const currentYearIndex = years.indexOf(moment().year());
const selectedYearIndex = years.indexOf(moment(selectedDate).year());
const currentYearIndex = years.indexOf(moment().format("YYYY"));
const selectedYearIndex = years.indexOf(moment(selectedDate).format("YYYY"));
if (selectedYearIndex !== -1) {
yearElements[selectedYearIndex] = (
<ColorTheme
@ -69,7 +71,7 @@ export const getYearElements = (
big
focused
key={years[selectedYearIndex]}
onClick={() => onClick(years[selectedYearIndex])}
onClick={() => onDateClick(years[selectedYearIndex])}
disabled={
moment(years[selectedYearIndex].toString())
.endOf("year")
@ -90,7 +92,7 @@ export const getYearElements = (
isCurrent
big
key={years[currentYearIndex]}
onClick={() => onClick(years[currentYearIndex])}
onClick={() => onDateClick(years[currentYearIndex])}
disabled={
moment(years[currentYearIndex].toString())
.endOf("year")

View File

@ -4,6 +4,7 @@ import styled from "styled-components";
const locales = [
"az",
"ar-SA",
"zh-cn",
"cs",
"nl",

View File

@ -4,6 +4,7 @@ import styled from "styled-components";
const locales = [
"az",
"ar-SA",
"zh-cn",
"cs",
"nl",

View File

@ -248,6 +248,8 @@ class TableHeader extends React.Component {
? containerRef.current
: document.getElementById("table-container");
if (!container) return;
// // 400 - it is desktop info panel width
// const minSize = infoPanelVisible ? size.tablet - 400 : size.tablet;

View File

@ -371,7 +371,7 @@ public class AuthenticationController : ControllerBase
{
var settings = _settingsManager.Load<SsoSettingsV2>();
if (settings.EnableSso && !string.IsNullOrEmpty(settings.IdpSettings.SloUrl))
if (settings.EnableSso.GetValueOrDefault() && !string.IsNullOrEmpty(settings.IdpSettings.SloUrl))
{
var logoutSsoUserData = _signature.Create(new LogoutSsoUserData
{

View File

@ -126,7 +126,7 @@ public class CapabilitiesController : ControllerBase
{
var settings = await _settingsManager.LoadAsync<SsoSettingsV2>();
if (settings.EnableSso)
if (settings.EnableSso.GetValueOrDefault())
{
result.SsoUrl = settings.IdpSettings.SsoUrl;
result.SsoLabel = settings.SpLoginLabel;

View File

@ -72,18 +72,29 @@ public class SsoController : BaseSettingsController
[AllowAnonymous]
public async Task<SsoSettingsV2> GetSsoSettingsV2()
{
await CheckSsoPermissionsAsync(!_authContext.IsAuthenticated);
var settings = await _settingsManager.LoadAsync<SsoSettingsV2>();
if (!_authContext.IsAuthenticated)
{
bool hideAuthPage;
try
{
await CheckSsoPermissionsAsync(true);
hideAuthPage = settings.HideAuthPage;
}
catch (BillingException)
{
hideAuthPage = false;
}
return new SsoSettingsV2
{
HideAuthPage = settings.HideAuthPage
HideAuthPage = hideAuthPage
};
}
await CheckSsoPermissionsAsync();
if (string.IsNullOrEmpty(settings.SpLoginLabel))
{
settings.SpLoginLabel = SsoSettingsV2.SSO_SP_LOGIN_LABEL;
@ -205,12 +216,13 @@ public class SsoController : BaseSettingsController
throw new Exception(Resource.SsoSettingsCantSaveSettings);
}
if (!settings.EnableSso)
var enableSso = settings.EnableSso.GetValueOrDefault();
if (!enableSso)
{
await ConverSsoUsersToOrdinaryAsync();
}
var messageAction = settings.EnableSso ? MessageAction.SSOEnabled : MessageAction.SSODisabled;
var messageAction = enableSso ? MessageAction.SSOEnabled : MessageAction.SSODisabled;
await _messageService.SendAsync(messageAction);

View File

@ -136,7 +136,7 @@ public class SsoHandlerService
return;
}
if (!settings.EnableSso)
if (!settings.EnableSso.GetValueOrDefault())
{
throw new SSOException("Single sign-on is disabled", MessageKey.SsoSettingsDisabled);
}

View File

@ -93,7 +93,7 @@ public class SsoSettingsV2 : ISettings<SsoSettingsV2>
/// <summary>Specifies if SSO is enabled or not</summary>
/// <type>System.Boolean, System</type>
public bool EnableSso { get; set; }
public bool? EnableSso { get; set; }
/// <summary>IDP settings</summary>
/// <type>ASC.Web.Studio.UserControls.Management.SingleSignOnSettings.SsoIdpSettings, ASC.Web.Core</type>