Merge branch 'release/1.0.0' of github.com:ONLYOFFICE/AppServer into release/1.0.0

This commit is contained in:
Viktor Fomin 2021-08-10 14:00:48 +03:00
commit ab457722b6
21 changed files with 301 additions and 249 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<AssemblyTitle>ASC.Common</AssemblyTitle>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<ProjectGuid>{A51D0454-4AFA-46DE-89D4-B03D37E1816C}</ProjectGuid>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<AssemblyTitle>ASC.Core.Common</AssemblyTitle>

View File

@ -265,6 +265,11 @@ namespace ASC.Core.Caching
return Service.GetUser(tenant, email);
}
public UserInfo GetUserByUserName(int tenant, string userName)
{
return Service.GetUserByUserName(tenant, userName);
}
/// <summary>
/// For Personal only
@ -373,7 +378,12 @@ namespace ASC.Core.Caching
public IDictionary<string, UserGroupRef> GetUserGroupRefs(int tenant, DateTime from)
{
{
if (CoreBaseSettings.Personal)
{
return new Dictionary<string, UserGroupRef>();
}
GetChangesFromDb();
var key = UserServiceCache.GetRefCacheKey(tenant);

View File

@ -176,7 +176,13 @@ namespace ASC.Core
}
public UserInfo GetUserByUserName(string username)
{
{
if (CoreBaseSettings.Personal)
{
var u = UserService.GetUserByUserName(TenantManager.GetCurrentTenant().TenantId, username);
return u ?? Constants.LostUser;
}
return GetUsersInternal()
.FirstOrDefault(u => string.Compare(u.UserName, username, StringComparison.CurrentCultureIgnoreCase) == 0) ?? Constants.LostUser;
}
@ -404,7 +410,12 @@ namespace ASC.Core
}
internal List<GroupInfo> GetUserGroups(Guid userID, IncludeType includeType, Guid? categoryId)
{
{
if (CoreBaseSettings.Personal)
{
return new List<GroupInfo> { Constants.GroupUser, Constants.GroupEveryone };
}
var httpRequestDictionary = new HttpRequestDictionary<List<GroupInfo>>(Accessor?.HttpContext, "GroupInfo");
var result = httpRequestDictionary.Get(userID.ToString());
if (result != null)

View File

@ -59,6 +59,8 @@ namespace ASC.Core
UserInfo GetUser(int tenant, string email);
UserInfo GetUserByUserName(int tenant, string userName);
UserInfo GetUser(int tenant, Guid id, Expression<Func<User, UserInfo>> exp);
UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash);

View File

@ -230,6 +230,13 @@ namespace ASC.Core.Data
.FirstOrDefault(r=> r.Email == email && !r.Removed);
}
public UserInfo GetUserByUserName(int tenant, string userName)
{
return GetUserQuery(tenant, default(DateTime))
.Select(FromUserToUserInfo)
.FirstOrDefault(r=> r.UserName == userName && !r.Removed);
}
public UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<ProjectGuid>{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}</ProjectGuid>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<AssemblyTitle>ASC.ElasticSearch</AssemblyTitle>

View File

@ -112,7 +112,7 @@
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;AllowPublicKeyRetrieval=True",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;AllowPublicKeyRetrieval=True;ConnectionReset=false",
"providerName": "MySql.Data.MySqlClient"
},
"postgre": {
@ -122,7 +122,7 @@
},
"mysql": {
"name": "mysql",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;AllowPublicKeyRetrieval=True",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;AllowPublicKeyRetrieval=True;ConnectionReset=false",
"providerName": "MySql.Data.MySqlClient"
}
},

View File

@ -9,7 +9,7 @@
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=172.18.0.5;Port=3306;Database=onlyoffice;User ID=onlyoffice_user;Password=onlyoffice_pass;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none",
"connectionString": "Server=172.18.0.5;Port=3306;Database=onlyoffice;User ID=onlyoffice_user;Password=onlyoffice_pass;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;ConnectionReset=false",
"providerName": "MySql.Data.MySqlClient"
}
},

View File

@ -47,7 +47,7 @@ namespace ASC.Calendar.Core.Dao
entity.Property(e => e.ItemId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarCalendarUser>(entity =>
@ -56,74 +56,74 @@ namespace ASC.Calendar.Core.Dao
.HasName("PRIMARY");
entity.HasIndex(e => e.UserId)
.HasName("user_id");
.HasDatabaseName("user_id");
entity.Property(e => e.ExtCalendarId)
.HasDefaultValueSql("''")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.BackgroundColor)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TextColor)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimeZone)
.HasDefaultValueSql("'UTC'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarCalendars>(entity =>
{
entity.HasIndex(e => new { e.Tenant, e.OwnerId })
.HasName("owner_id");
.HasDatabaseName("owner_id");
entity.Property(e => e.BackgroundColor)
.HasDefaultValueSql("'#fa9191'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CaldavGuid)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Description)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IcalUrl)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.OwnerId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TextColor)
.HasDefaultValueSql("'#000000'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimeZone)
.HasDefaultValueSql("'UTC'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarEventHistory>(entity =>
@ -132,15 +132,15 @@ namespace ASC.Calendar.Core.Dao
.HasName("PRIMARY");
entity.HasIndex(e => new { e.Tenant, e.EventId })
.HasName("event_id");
.HasDatabaseName("event_id");
entity.Property(e => e.EventUid)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Ics)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarEventItem>(entity =>
@ -150,7 +150,7 @@ namespace ASC.Calendar.Core.Dao
entity.Property(e => e.ItemId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarEventUser>(entity =>
@ -160,33 +160,33 @@ namespace ASC.Calendar.Core.Dao
entity.Property(e => e.UserId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarEvents>(entity =>
{
entity.HasIndex(e => new { e.Tenant, e.CalendarId })
.HasName("calendar_id");
.HasDatabaseName("calendar_id");
entity.Property(e => e.Description)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.OwnerId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Rrule)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Uid)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarNotifications>(entity =>
@ -195,45 +195,45 @@ namespace ASC.Calendar.Core.Dao
.HasName("PRIMARY");
entity.HasIndex(e => e.EventId)
.HasName("event_id");
.HasDatabaseName("event_id");
entity.HasIndex(e => e.NotifyDate)
.HasName("notify_date");
.HasDatabaseName("notify_date");
entity.Property(e => e.UserId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Rrule)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimeZone)
.HasDefaultValueSql("'UTC'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
modelBuilder.Entity<CalendarTodos>(entity =>
{
entity.HasIndex(e => new { e.Tenant, e.CalendarId })
.HasName("calendar_id");
.HasDatabaseName("calendar_id");
entity.Property(e => e.Description)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.OwnerId)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Uid)
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
OnModelCreatingPartial(modelBuilder);

View File

@ -1,135 +1,135 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASC.Calendar.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CalendarResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal CalendarResource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASC.Calendar.Resources.CalendarResource", typeof(CalendarResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to The uploaded file could not be found.
/// </summary>
internal static string ErrorEmptyUploadFileSelected {
get {
return ResourceManager.GetString("ErrorEmptyUploadFileSelected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image size is too large.
/// </summary>
internal static string ErrorImageSizetLimit {
get {
return ResourceManager.GetString("ErrorImageSizetLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image file size is too large.
/// </summary>
internal static string ErrorImageWeightLimit {
get {
return ResourceManager.GetString("ErrorImageWeightLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unknown image file type.
/// </summary>
internal static string ErrorUnknownFileImageType {
get {
return ResourceManager.GetString("ErrorUnknownFileImageType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do the same as a user|Create profiles and groups|Import profiles|Invite users.
/// </summary>
internal static string ProductAdminOpportunities {
get {
return ResourceManager.GetString("ProductAdminOpportunities", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add new users, invite or import them. Manage users and view their detailed information..
/// </summary>
internal static string ProductDescription {
get {
return ResourceManager.GetString("ProductDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to People.
/// </summary>
internal static string ProductName {
get {
return ResourceManager.GetString("ProductName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to View profiles and groups.
/// </summary>
internal static string ProductUserOpportunities {
get {
return ResourceManager.GetString("ProductUserOpportunities", resourceCulture);
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASC.Calendar.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CalendarResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal CalendarResource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASC.Calendar.Resources.CalendarResource", typeof(CalendarResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to The uploaded file could not be found.
/// </summary>
internal static string ErrorEmptyUploadFileSelected {
get {
return ResourceManager.GetString("ErrorEmptyUploadFileSelected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image size is too large.
/// </summary>
internal static string ErrorImageSizetLimit {
get {
return ResourceManager.GetString("ErrorImageSizetLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image file size is too large.
/// </summary>
internal static string ErrorImageWeightLimit {
get {
return ResourceManager.GetString("ErrorImageWeightLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unknown image file type.
/// </summary>
internal static string ErrorUnknownFileImageType {
get {
return ResourceManager.GetString("ErrorUnknownFileImageType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do the same as a user|Create profiles and groups|Import profiles|Invite users.
/// </summary>
internal static string ProductAdminOpportunities {
get {
return ResourceManager.GetString("ProductAdminOpportunities", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add new users, invite or import them. Manage users and view their detailed information..
/// </summary>
internal static string ProductDescription {
get {
return ResourceManager.GetString("ProductDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to People.
/// </summary>
internal static string ProductName {
get {
return ResourceManager.GetString("ProductName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to View profiles and groups.
/// </summary>
internal static string ProductUserOpportunities {
get {
return ResourceManager.GetString("ProductUserOpportunities", resourceCulture);
}
}
}
}

View File

@ -145,7 +145,7 @@ export default function withContent(WrappedContent) {
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
"/products/files/doceditor"
"/doceditor"
),
"_blank"
)

View File

@ -135,7 +135,7 @@ export default function withContextOptions(WrappedComponent) {
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
"/products/files/doceditor"
"/doceditor"
),
"_blank"
)

View File

@ -232,7 +232,7 @@ export default function withFileActions(WrappedFileItem) {
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
"/products/files/doceditor"
"/doceditor"
),
"_blank"
)

View File

@ -132,6 +132,36 @@ class SectionFilterContent extends React.Component {
]
: "";
const images = !isRecentFolder
? [
{
key: FilterType.ImagesOnly.toString(),
group: "filter-filterType",
label: t("Images"),
},
]
: "";
const archives = !isRecentFolder
? [
{
key: FilterType.ArchiveOnly.toString(),
group: "filter-filterType",
label: t("Archives"),
},
]
: "";
const media = !isRecentFolder
? [
{
key: FilterType.MediaOnly.toString(),
group: "filter-filterType",
label: t("Media"),
},
]
: "";
const options = [
{
key: "filter-filterType",
@ -155,21 +185,9 @@ class SectionFilterContent extends React.Component {
group: "filter-filterType",
label: t("Translations:Spreadsheets"),
},
{
key: FilterType.ImagesOnly.toString(),
group: "filter-filterType",
label: t("Images"),
},
{
key: FilterType.MediaOnly.toString(),
group: "filter-filterType",
label: t("Media"),
},
{
key: FilterType.ArchiveOnly.toString(),
group: "filter-filterType",
label: t("Archives"),
},
...images,
...media,
...archives,
...allFiles,
];

View File

@ -167,57 +167,60 @@ const Editor = () => {
}
if (successAuth) {
const recentFolderList = await getRecentFolderList();
try {
const recentFolderList = await getRecentFolderList();
let recentFilesArray = [];
const filesArray = recentFolderList.files.slice(0, 25);
const filesArray = recentFolderList.files;
const recentFiles = filesArray.filter(
(file) =>
file.rootFolderType !== FolderType.SHARE &&
((config.documentType === text && file.fileType === 7) ||
(config.documentType === spreadSheet && file.fileType === 5) ||
(config.documentType === presentation && file.fileType === 6))
);
for (let i = 0; i < filesArray.length; i++) {
if (
config.documentType === text &&
filesArray[i].fileType === 7 &&
filesArray[i].rootFolderType !== FolderType.SHARE
) {
const folderInfo = await getFolderInfo(filesArray[i].folderId);
const groupedByFolder = recentFiles.reduce((r, a) => {
r[a.folderId] = [...(r[a.folderId] || []), a];
return r;
}, {});
const convertedData = convertRecentData(filesArray[i], folderInfo);
const requests = Object.entries(groupedByFolder).map((item) =>
getFolderInfo(item[0])
.then((folderInfo) =>
Promise.resolve({
files: item[1],
folderInfo: folderInfo,
})
)
.catch((e) => console.error(e))
);
if (Object.keys(convertedData).length !== 0)
recentFilesArray.push(convertedData);
let recent = [];
try {
let responses = await Promise.all(requests);
for (let i = 0; i < responses.length; i++) {
const res = responses[i];
res.files.forEach((file) => {
const convertedData = convertRecentData(file, res.folderInfo);
if (Object.keys(convertedData).length !== 0)
recent.push(convertedData);
});
}
} catch (e) {
console.error(e);
}
if (
config.documentType === spreadSheet &&
filesArray[i].fileType === 5 &&
filesArray[i].rootFolderType !== FolderType.SHARE
) {
const folderInfo = await getFolderInfo(filesArray[i].folderId);
const convertedData = convertRecentData(filesArray[i], folderInfo);
if (Object.keys(convertedData).length !== 0)
recentFilesArray.push(convertedData);
}
if (
config.documentType === presentation &&
filesArray[i].fileType === 6 &&
filesArray[i].rootFolderType !== FolderType.SHARE
) {
const folderInfo = await getFolderInfo(filesArray[i].folderId);
const convertedData = convertRecentData(filesArray[i], folderInfo);
if (Object.keys(convertedData).length !== 0)
recentFilesArray.push(convertedData);
}
config.editorConfig = {
...config.editorConfig,
recent: recent,
};
} catch (e) {
console.error(e);
}
config.editorConfig = {
...config.editorConfig,
recent: recentFilesArray,
};
}
if (
@ -256,7 +259,8 @@ const Editor = () => {
const folderName = folder.title;
const fileName = file.title;
const url = file.webUrl;
if (fileId !== file.id)
if (+fileId !== file.id)
obj = {
folder: folderName,
title: fileName,