mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-15 00:01:25 -04:00
Compare commits
No commits in common. "920ae2367fdb5350778a0f91889acc35fe67b6ba" and "a1fcb1cfb84fd6b36c8fe9fd56588119fa4377bc" have entirely different histories.
920ae2367f
...
a1fcb1cfb8
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
"code.gitea.io/gitea/modules/cache"
|
"code.gitea.io/gitea/modules/cache"
|
||||||
setting_module "code.gitea.io/gitea/modules/setting"
|
|
||||||
|
|
||||||
"xorm.io/builder"
|
"xorm.io/builder"
|
||||||
)
|
)
|
||||||
@ -155,18 +154,13 @@ func SetUserSetting(userID int64, key, value string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := upsertUserSettingValue(userID, key, value); err != nil {
|
_, err := cache.GetString(genSettingCacheKey(userID, key), func() (string, error) {
|
||||||
|
return value, upsertUserSettingValue(userID, key, value)
|
||||||
|
})
|
||||||
|
|
||||||
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 {
|
func upsertUserSettingValue(userID int64, key, value string) error {
|
||||||
return db.WithTx(db.DefaultContext, func(ctx context.Context) error {
|
return db.WithTx(db.DefaultContext, func(ctx context.Context) error {
|
||||||
e := db.GetEngine(ctx)
|
e := db.GetEngine(ctx)
|
||||||
|
@ -7,7 +7,6 @@ import {showGlobalErrorMessage} from '../bootstrap.js';
|
|||||||
import {attachDropdownAria} from './aria.js';
|
import {attachDropdownAria} from './aria.js';
|
||||||
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
|
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
|
||||||
import {initTooltip} from '../modules/tippy.js';
|
import {initTooltip} from '../modules/tippy.js';
|
||||||
import {svg} from '../svg.js';
|
|
||||||
|
|
||||||
const {appUrl, csrfToken} = window.config;
|
const {appUrl, csrfToken} = window.config;
|
||||||
|
|
||||||
@ -170,10 +169,10 @@ export function initGlobalDropzone() {
|
|||||||
$dropzone.find('.files').append(input);
|
$dropzone.find('.files').append(input);
|
||||||
// Create a "Copy Link" element, to conveniently copy the image
|
// Create a "Copy Link" element, to conveniently copy the image
|
||||||
// or file link as Markdown to the clipboard
|
// or file link as Markdown to the clipboard
|
||||||
const copyLinkElement = document.createElement('div');
|
const copyLinkElement = document.createElement('a');
|
||||||
copyLinkElement.className = 'tc';
|
copyLinkElement.className = 'dz-remove';
|
||||||
// The a element has a hardcoded cursor: pointer because the default is overridden by .dropzone
|
copyLinkElement.href = '#';
|
||||||
copyLinkElement.innerHTML = `<a href="#" style="cursor: pointer;">${svg('octicon-copy', 14, 'copy link')} Copy link</a>`;
|
copyLinkElement.innerHTML = '<i class="fa fa-copy"></i> Copy link';
|
||||||
copyLinkElement.addEventListener('click', (e) => {
|
copyLinkElement.addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let fileMarkdown = `[${file.name}](/attachments/${file.uuid})`;
|
let fileMarkdown = `[${file.name}](/attachments/${file.uuid})`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user