@ -4,7 +4,7 @@ import {createCommentSimpleMDE} from './comp/CommentSimpleMDE.js';
import { initCompImagePaste } from './comp/ImagePaste.js' ;
import { initCompImagePaste } from './comp/ImagePaste.js' ;
import { initCompMarkupContentPreviewTab } from './comp/MarkupContentPreview.js' ;
import { initCompMarkupContentPreviewTab } from './comp/MarkupContentPreview.js' ;
const { A ppSubUrl, csrf } = window . config ;
const { a ppSubUrl, csrfToken } = window . config ;
export function initRepoIssueTimeTracking ( ) {
export function initRepoIssueTimeTracking ( ) {
$ ( document ) . on ( 'click' , '.issue-add-time' , ( ) => {
$ ( document ) . on ( 'click' , '.issue-add-time' , ( ) => {
@ -58,7 +58,7 @@ function updateDeadline(deadlineString) {
due _date : realDeadline ,
due _date : realDeadline ,
} ) ,
} ) ,
headers : {
headers : {
'X-Csrf-Token' : csrf ,
'X-Csrf-Token' : csrfToken ,
'X-Remote' : true ,
'X-Remote' : true ,
} ,
} ,
contentType : 'application/json' ,
contentType : 'application/json' ,
@ -91,9 +91,9 @@ export function initRepoIssueList() {
const repoId = $ ( '#repoId' ) . val ( ) ;
const repoId = $ ( '#repoId' ) . val ( ) ;
const crossRepoSearch = $ ( '#crossRepoSearch' ) . val ( ) ;
const crossRepoSearch = $ ( '#crossRepoSearch' ) . val ( ) ;
const tp = $ ( '#type' ) . val ( ) ;
const tp = $ ( '#type' ) . val ( ) ;
let issueSearchUrl = ` ${ A ppSubUrl} /api/v1/repos/ ${ repolink } /issues?q={query}&type= ${ tp } ` ;
let issueSearchUrl = ` ${ a ppSubUrl} /api/v1/repos/ ${ repolink } /issues?q={query}&type= ${ tp } ` ;
if ( crossRepoSearch === 'true' ) {
if ( crossRepoSearch === 'true' ) {
issueSearchUrl = ` ${ A ppSubUrl} /api/v1/repos/issues/search?q={query}&priority_repo_id= ${ repoId } &type= ${ tp } ` ;
issueSearchUrl = ` ${ a ppSubUrl} /api/v1/repos/issues/search?q={query}&priority_repo_id= ${ repoId } &type= ${ tp } ` ;
}
}
$ ( '#new-dependency-drop-list' )
$ ( '#new-dependency-drop-list' )
. dropdown ( {
. dropdown ( {
@ -157,7 +157,7 @@ export function initRepoIssueCommentDelete() {
const $this = $ ( this ) ;
const $this = $ ( this ) ;
if ( window . confirm ( $this . data ( 'locale' ) ) ) {
if ( window . confirm ( $this . data ( 'locale' ) ) ) {
$ . post ( $this . data ( 'url' ) , {
$ . post ( $this . data ( 'url' ) , {
_csrf : csrf ,
_csrf : csrfToken ,
} ) . done ( ( ) => {
} ) . done ( ( ) => {
const $conversationHolder = $this . closest ( '.conversation-holder' ) ;
const $conversationHolder = $this . closest ( '.conversation-holder' ) ;
$ ( ` # ${ $this . data ( 'comment-id' ) } ` ) . remove ( ) ;
$ ( ` # ${ $this . data ( 'comment-id' ) } ` ) . remove ( ) ;
@ -258,7 +258,7 @@ export function initRepoPullRequestUpdate() {
const redirect = $this . data ( 'redirect' ) ;
const redirect = $this . data ( 'redirect' ) ;
$this . addClass ( 'loading' ) ;
$this . addClass ( 'loading' ) ;
$ . post ( $this . data ( 'do' ) , {
$ . post ( $this . data ( 'do' ) , {
_csrf : csrf
_csrf : csrfToken
} ) . done ( ( data ) => {
} ) . done ( ( data ) => {
if ( data . redirect ) {
if ( data . redirect ) {
window . location . href = data . redirect ;
window . location . href = data . redirect ;
@ -291,7 +291,7 @@ export function initRepoIssueReferenceRepositorySearch() {
$ ( '.issue_reference_repository_search' )
$ ( '.issue_reference_repository_search' )
. dropdown ( {
. dropdown ( {
apiSettings : {
apiSettings : {
url : ` ${ A ppSubUrl} /api/v1/repos/search?q={query}&limit=20 ` ,
url : ` ${ a ppSubUrl} /api/v1/repos/search?q={query}&limit=20 ` ,
onResponse ( response ) {
onResponse ( response ) {
const filteredResponse = { success : true , results : [ ] } ;
const filteredResponse = { success : true , results : [ ] } ;
$ . each ( response . data , ( _r , repo ) => {
$ . each ( response . data , ( _r , repo ) => {
@ -306,7 +306,7 @@ export function initRepoIssueReferenceRepositorySearch() {
} ,
} ,
onChange ( _value , _text , $choice ) {
onChange ( _value , _text , $choice ) {
const $form = $choice . closest ( 'form' ) ;
const $form = $choice . closest ( 'form' ) ;
$form . attr ( 'action' , ` ${ A ppSubUrl} / ${ _text } /issues/new ` ) ;
$form . attr ( 'action' , ` ${ a ppSubUrl} / ${ _text } /issues/new ` ) ;
} ,
} ,
fullTextSearch : true
fullTextSearch : true
} ) ;
} ) ;
@ -338,7 +338,7 @@ export function updateIssuesMeta(url, action, issueIds, elementId) {
type : 'POST' ,
type : 'POST' ,
url ,
url ,
data : {
data : {
_csrf : csrf ,
_csrf : csrfToken ,
action ,
action ,
issue _ids : issueIds ,
issue _ids : issueIds ,
id : elementId ,
id : elementId ,
@ -556,7 +556,7 @@ export function initRepoIssueWipToggle() {
e . preventDefault ( ) ;
e . preventDefault ( ) ;
const { title , wipPrefix , updateUrl } = e . currentTarget . closest ( '.toggle-wip' ) . dataset ;
const { title , wipPrefix , updateUrl } = e . currentTarget . closest ( '.toggle-wip' ) . dataset ;
await $ . post ( updateUrl , {
await $ . post ( updateUrl , {
_csrf : csrf ,
_csrf : csrfToken ,
title : title ? . startsWith ( wipPrefix ) ? title . substr ( wipPrefix . length ) . trim ( ) : ` ${ wipPrefix . trim ( ) } ${ title } ` ,
title : title ? . startsWith ( wipPrefix ) ? title . substr ( wipPrefix . length ) . trim ( ) : ` ${ wipPrefix . trim ( ) } ${ title } ` ,
} ) ;
} ) ;
window . location . reload ( ) ;
window . location . reload ( ) ;
@ -591,7 +591,7 @@ export function initRepoIssueTitleEdit() {
return false ;
return false ;
}
}
$ . post ( update _url , {
$ . post ( update _url , {
_csrf : csrf ,
_csrf : csrfToken ,
target _branch : targetBranch
target _branch : targetBranch
} ) . done ( ( data ) => {
} ) . done ( ( data ) => {
$branchTarget . text ( data . base _branch ) ;
$branchTarget . text ( data . base _branch ) ;
@ -606,7 +606,7 @@ export function initRepoIssueTitleEdit() {
pullrequest _targetbranch _change ( pullrequest _target _update _url ) ;
pullrequest _targetbranch _change ( pullrequest _target _update _url ) ;
} else {
} else {
$ . post ( $ ( this ) . data ( 'update-url' ) , {
$ . post ( $ ( this ) . data ( 'update-url' ) , {
_csrf : csrf ,
_csrf : csrfToken ,
title : $editInput . val ( )
title : $editInput . val ( )
} , ( data ) => {
} , ( data ) => {
$editInput . val ( data . title ) ;
$editInput . val ( data . title ) ;