-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(files): Fix Issue with Recycle Bin Failing to Enable #7636
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,22 +48,7 @@ func (u *SettingService) GetSettingInfo() (*dto.SettingInfo, error) { | |
} | ||
|
||
func (u *SettingService) Update(key, value string) error { | ||
switch key { | ||
case "AppStoreLastModified": | ||
exist, _ := settingRepo.Get(settingRepo.WithByKey("AppStoreLastModified")) | ||
if exist.ID == 0 { | ||
return settingRepo.Create("AppStoreLastModified", value) | ||
} | ||
case "AppDefaultDomain": | ||
exist, _ := settingRepo.Get(settingRepo.WithByKey("AppDefaultDomain")) | ||
if exist.ID == 0 { | ||
return settingRepo.Create("AppDefaultDomain", value) | ||
} | ||
} | ||
if err := settingRepo.Update(key, value); err != nil { | ||
return err | ||
} | ||
return nil | ||
return settingRepo.UpdateOrCreate(key, value) | ||
} | ||
|
||
func (u *SettingService) ReloadConn() error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code looks correct and has no apparent issues or inconsistencies. It appears to be implementing a function that retrieves and updates configuration settings, with appropriate error handling in case of failed operations. Optimization Suggestions:
There are currently no known irregularities or issues based on the available information. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,8 @@ import { dateFormat, computeSize } from '@/utils/util'; | |
import i18n from '@/lang'; | ||
import Delete from './delete/index.vue'; | ||
import Reduce from './reduce/index.vue'; | ||
import { updateSetting } from '@/api/modules/setting'; | ||
import { MsgSuccess } from '@/utils/message'; | ||
import { updateAgentSetting } from '@/api/modules/setting'; | ||
|
||
const open = ref(false); | ||
const req = reactive({ | ||
|
@@ -114,7 +114,7 @@ const getStatus = async () => { | |
const changeStatus = async () => { | ||
try { | ||
loading.value = true; | ||
await updateSetting({ key: 'FileRecycleBin', value: status.value }); | ||
await updateAgentSetting({ key: 'FileRecycleBin', value: status.value }); | ||
MsgSuccess(i18n.global.t('file.fileRecycleBinMsg', [i18n.global.t('commons.button.' + status.value)])); | ||
loading.value = false; | ||
} catch (error) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like your current codebase is not properly formatted to follow standard programming practices. Ensure you have the latest syntax settings on this platform as it can affect how some functions operate or display incorrectly. However, no specific errors have been highlighted here for review, assuming that you've made an attempt at optimizing code. If needed, please elaborate more on specifics about which parts need improvements (e.g., naming conventions, flow structure consistency), so we can further help. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot find any major inconsistencies, potential issues or optimizations in the provided code snippet based on the knowledge cut-off of September 2021.
However, regarding future updates and improvements:
WithByKey
uses an appropriate DB option method (e.g., "Select", "Find").It appears most of these areas would benefit from thoughtful design decisions rather than specific implementation details. This includes ensuring better modularization and using standardized practices for writing clean, understandable code.