Modify: clean modals

This commit is contained in:
HFO4
2020-03-11 15:22:21 +08:00
parent 4d70f9fa3e
commit 4ba24e0cf1
30 changed files with 22 additions and 598 deletions

View File

@@ -12,8 +12,6 @@ type SiteConfig struct {
QQLogin bool `json:"QQLogin"`
Themes string `json:"themes"`
DefaultTheme string `json:"defaultTheme"`
ScoreEnabled bool `json:"score_enabled"`
ShareScoreRate string `json:"share_score_rate"`
HomepageViewMethod string `json:"home_view_method"`
ShareViewMethod string `json:"share_view_method"`
Authn bool `json:"authn"'`
@@ -72,8 +70,6 @@ func BuildSiteConfig(settings map[string]string, user *model.User) Response {
QQLogin: model.IsTrueVal(checkSettingValue(settings, "qq_login")),
Themes: checkSettingValue(settings, "themes"),
DefaultTheme: checkSettingValue(settings, "defaultTheme"),
ScoreEnabled: model.IsTrueVal(checkSettingValue(settings, "score_enabled")),
ShareScoreRate: checkSettingValue(settings, "share_score_rate"),
HomepageViewMethod: checkSettingValue(settings, "home_view_method"),
ShareViewMethod: checkSettingValue(settings, "share_view_method"),
Authn: model.IsTrueVal(checkSettingValue(settings, "authn_enabled")),

View File

@@ -11,7 +11,6 @@ type Share struct {
Key string `json:"key"`
Locked bool `json:"locked"`
IsDir bool `json:"is_dir"`
Score int `json:"score"`
CreateDate string `json:"create_date,omitempty"`
Downloads int `json:"downloads"`
Views int `json:"views"`
@@ -36,7 +35,6 @@ type shareSource struct {
type myShareItem struct {
Key string `json:"key"`
IsDir bool `json:"is_dir"`
Score int `json:"score"`
Password string `json:"password"`
CreateDate string `json:"create_date,omitempty"`
Downloads int `json:"downloads"`
@@ -55,7 +53,6 @@ func BuildShareList(shares []model.Share, total int) Response {
item := myShareItem{
Key: hashid.HashID(shares[i].ID, hashid.ShareID),
IsDir: shares[i].IsDir,
Score: shares[i].Score,
Password: shares[i].Password,
CreateDate: shares[i].CreatedAt.Format("2006-01-02 15:04:05"),
Downloads: shares[i].Downloads,
@@ -101,7 +98,6 @@ func BuildShareResponse(share *model.Share, unlocked bool) Share {
Nick: creator.Nick,
GroupName: creator.Group.Name,
},
Score: share.Score,
CreateDate: share.CreatedAt.Format("2006-01-02 15:04:05"),
}

View File

@@ -24,7 +24,6 @@ type User struct {
Avatar string `json:"avatar"`
CreatedAt int64 `json:"created_at"`
PreferredTheme string `json:"preferred_theme"`
Score int `json:"score"`
Anonymous bool `json:"anonymous"`
Policy policy `json:"policy"`
Group group `json:"group"`
@@ -97,7 +96,6 @@ func BuildUser(user model.User) User {
Avatar: user.Avatar,
CreatedAt: user.CreatedAt.Unix(),
PreferredTheme: user.OptionsSerialized.PreferredTheme,
Score: user.Score,
Anonymous: user.IsAnonymous(),
Policy: policy{
SaveType: user.Policy.Type,
@@ -112,7 +110,6 @@ func BuildUser(user model.User) User {
AllowShare: user.Group.ShareEnabled,
AllowRemoteDownload: user.Group.OptionsSerialized.Aria2,
AllowArchiveDownload: user.Group.OptionsSerialized.ArchiveDownload,
ShareFreeEnabled: user.Group.OptionsSerialized.ShareFree,
ShareDownload: user.Group.OptionsSerialized.ShareDownload,
CompressEnabled: user.Group.OptionsSerialized.ArchiveTask,
WebDAVEnabled: user.Group.WebDAVEnabled,

View File

@@ -55,25 +55,6 @@ func BuildPolicySettingRes(policies []model.Policy, current *model.Policy) Respo
}
}
// BuildMountedFolderRes 构建已挂载目录响应list为当前用户可用存储策略ID
func BuildMountedFolderRes(folders []model.Folder, list []uint) []MountedFolders {
res := make([]MountedFolders, 0, len(folders))
for _, folder := range folders {
single := MountedFolders{
ID: hashid.HashID(folder.ID, hashid.FolderID),
Name: folder.Name,
PolicyName: "[已失效存储策略]",
}
if policy, err := model.GetPolicyByID(folder.PolicyID); err == nil && util.ContainsUint(list, policy.ID) {
single.PolicyName = policy.Name
}
res = append(res, single)
}
return res
}
// BuildUserQuotaResponse 序列化用户存储配额概况响应
func BuildUserQuotaResponse(user *model.User, packs []model.StoragePack) Response {
packSize := user.GetAvailablePackSize()