mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-14 00:01:44 -04:00
Compare commits
2 Commits
a1fcb1cfb8
...
920ae2367f
Author | SHA1 | Date | |
---|---|---|---|
|
920ae2367f | ||
|
eb793c3361 |
@ -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 {
|
||||
|
@ -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})`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user