Compare commits

...

2 Commits

Author SHA1 Message Date
Francesco Siddi
920ae2367f
Address feedback from #22517 (#22563)
- use octicons for icon
- use fomantic for centering the link
2023-01-21 22:14:43 -06:00
Lunny Xiao
eb793c3361
Fix bug on user setting (#22539)
Fix #22537

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-01-21 15:31:11 +01:00
2 changed files with 15 additions and 8 deletions

View File

@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/cache"
setting_module "code.gitea.io/gitea/modules/setting"
"xorm.io/builder"
)
@ -154,11 +155,16 @@ func SetUserSetting(userID int64, key, value string) error {
return err
}
_, err := cache.GetString(genSettingCacheKey(userID, key), func() (string, error) {
return value, upsertUserSettingValue(userID, key, value)
})
if err := upsertUserSettingValue(userID, key, value); err != nil {
return err
}
return err
cc := cache.GetCache()
if cc != nil {
return cc.Put(genSettingCacheKey(userID, key), value, setting_module.CacheService.TTLSeconds())
}
return nil
}
func upsertUserSettingValue(userID int64, key, value string) error {

View File

@ -7,6 +7,7 @@ import {showGlobalErrorMessage} from '../bootstrap.js';
import {attachDropdownAria} from './aria.js';
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
import {initTooltip} from '../modules/tippy.js';
import {svg} from '../svg.js';
const {appUrl, csrfToken} = window.config;
@ -169,10 +170,10 @@ export function initGlobalDropzone() {
$dropzone.find('.files').append(input);
// Create a "Copy Link" element, to conveniently copy the image
// or file link as Markdown to the clipboard
const copyLinkElement = document.createElement('a');
copyLinkElement.className = 'dz-remove';
copyLinkElement.href = '#';
copyLinkElement.innerHTML = '<i class="fa fa-copy"></i> Copy link';
const copyLinkElement = document.createElement('div');
copyLinkElement.className = 'tc';
// The a element has a hardcoded cursor: pointer because the default is overridden by .dropzone
copyLinkElement.innerHTML = `<a href="#" style="cursor: pointer;">${svg('octicon-copy', 14, 'copy link')} Copy link</a>`;
copyLinkElement.addEventListener('click', (e) => {
e.preventDefault();
let fileMarkdown = `[${file.name}](/attachments/${file.uuid})`;