2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2018-01-29 07:23:21 -05:00
|
|
|
import axios from './lib/utils/axios_utils';
|
|
|
|
import flash from './flash';
|
2019-05-02 10:49:16 -04:00
|
|
|
import { s__, __ } from './locale';
|
2019-07-09 07:46:16 -04:00
|
|
|
import issuableInitBulkUpdateSidebar from './issuable_init_bulk_update_sidebar';
|
2016-12-13 22:01:05 -05:00
|
|
|
|
2017-10-26 14:03:48 -04:00
|
|
|
export default class IssuableIndex {
|
|
|
|
constructor(pagePrefix) {
|
2019-07-09 07:46:16 -04:00
|
|
|
issuableInitBulkUpdateSidebar.init(pagePrefix);
|
2017-10-26 14:03:48 -04:00
|
|
|
IssuableIndex.resetIncomingEmailToken();
|
|
|
|
}
|
|
|
|
|
|
|
|
static resetIncomingEmailToken() {
|
2018-01-30 05:57:00 -05:00
|
|
|
const $resetToken = $('.incoming-email-token-reset');
|
|
|
|
|
2018-10-10 03:13:34 -04:00
|
|
|
$resetToken.on('click', e => {
|
2017-10-26 14:03:48 -04:00
|
|
|
e.preventDefault();
|
|
|
|
|
2019-05-02 10:49:16 -04:00
|
|
|
$resetToken.text(s__('EmailToken|resetting...'));
|
2018-01-29 07:23:21 -05:00
|
|
|
|
2018-10-10 03:13:34 -04:00
|
|
|
axios
|
|
|
|
.put($resetToken.attr('href'))
|
2018-01-29 07:23:21 -05:00
|
|
|
.then(({ data }) => {
|
2018-10-10 03:13:34 -04:00
|
|
|
$('#issuable_email')
|
|
|
|
.val(data.new_address)
|
|
|
|
.focus();
|
2018-01-29 07:23:21 -05:00
|
|
|
|
2019-05-02 10:49:16 -04:00
|
|
|
$resetToken.text(s__('EmailToken|reset it'));
|
2018-01-29 07:23:21 -05:00
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
flash(__('There was an error when reseting email token.'));
|
|
|
|
|
2019-05-02 10:49:16 -04:00
|
|
|
$resetToken.text(s__('EmailToken|reset it'));
|
2018-01-29 07:23:21 -05:00
|
|
|
});
|
2017-10-26 14:03:48 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|