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