PLT-7309: Fix webook management when permitted for non-admins. (#7132)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
82407bd44a
Коммит
5132c62d15
@@ -33,6 +33,20 @@ export function loadIncomingHooks(complete) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loadIncomingHooksForTeam(teamId, complete) {
|
||||||
|
IntegrationActions.getIncomingHooks(teamId, 0, 10000)(dispatch, getState).then(
|
||||||
|
(data) => {
|
||||||
|
if (data) {
|
||||||
|
loadProfilesForIncomingHooks(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
complete(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function loadProfilesForIncomingHooks(hooks) {
|
function loadProfilesForIncomingHooks(hooks) {
|
||||||
const profilesToLoad = {};
|
const profilesToLoad = {};
|
||||||
for (let i = 0; i < hooks.length; i++) {
|
for (let i = 0; i < hooks.length; i++) {
|
||||||
@@ -64,6 +78,20 @@ export function loadOutgoingHooks(complete) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loadOutgoingHooksForTeam(teamId, complete) {
|
||||||
|
IntegrationActions.getOutgoingHooks('', teamId, 0, 10000)(dispatch, getState).then(
|
||||||
|
(data) => {
|
||||||
|
if (data) {
|
||||||
|
loadProfilesForOutgoingHooks(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
complete(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function loadProfilesForOutgoingHooks(hooks) {
|
function loadProfilesForOutgoingHooks(hooks) {
|
||||||
const profilesToLoad = {};
|
const profilesToLoad = {};
|
||||||
for (let i = 0; i < hooks.length; i++) {
|
for (let i = 0; i < hooks.length; i++) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import IntegrationStore from 'stores/integration_store.jsx';
|
|||||||
import TeamStore from 'stores/team_store.jsx';
|
import TeamStore from 'stores/team_store.jsx';
|
||||||
import UserStore from 'stores/user_store.jsx';
|
import UserStore from 'stores/user_store.jsx';
|
||||||
|
|
||||||
import {loadIncomingHooks, deleteIncomingHook} from 'actions/integration_actions.jsx';
|
import {loadIncomingHooksForTeam, deleteIncomingHook} from 'actions/integration_actions.jsx';
|
||||||
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ export default class InstalledIncomingWebhooks extends React.Component {
|
|||||||
UserStore.addChangeListener(this.handleUserChange);
|
UserStore.addChangeListener(this.handleUserChange);
|
||||||
|
|
||||||
if (window.mm_config.EnableIncomingWebhooks === 'true') {
|
if (window.mm_config.EnableIncomingWebhooks === 'true') {
|
||||||
loadIncomingHooks(() => this.setState({loading: false}));
|
loadIncomingHooksForTeam(TeamStore.getCurrentId(), () => this.setState({loading: false}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import IntegrationStore from 'stores/integration_store.jsx';
|
|||||||
import TeamStore from 'stores/team_store.jsx';
|
import TeamStore from 'stores/team_store.jsx';
|
||||||
import UserStore from 'stores/user_store.jsx';
|
import UserStore from 'stores/user_store.jsx';
|
||||||
|
|
||||||
import {loadOutgoingHooks, regenOutgoingHookToken, deleteOutgoingHook} from 'actions/integration_actions.jsx';
|
import {loadOutgoingHooksForTeam, regenOutgoingHookToken, deleteOutgoingHook} from 'actions/integration_actions.jsx';
|
||||||
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ export default class InstalledOutgoingWebhooks extends React.Component {
|
|||||||
UserStore.addChangeListener(this.handleUserChange);
|
UserStore.addChangeListener(this.handleUserChange);
|
||||||
|
|
||||||
if (window.mm_config.EnableOutgoingWebhooks === 'true') {
|
if (window.mm_config.EnableOutgoingWebhooks === 'true') {
|
||||||
loadOutgoingHooks(() => this.setState({loading: false}));
|
loadOutgoingHooksForTeam(TeamStore.getCurrentId(), () => this.setState({loading: false}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user