kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Update tests, remove unused code
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>api-accept
rodzic
d487e34548
commit
db56d9b16a
|
@ -1,5 +1,5 @@
|
||||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||||
import { getFeatures, parseVersion } from 'soapbox/utils/features';
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
import { shouldHaveCard } from 'soapbox/utils/status';
|
import { shouldHaveCard } from 'soapbox/utils/status';
|
||||||
|
|
||||||
import api, { getNextLink } from '../api';
|
import api, { getNextLink } from '../api';
|
||||||
|
@ -40,8 +40,6 @@ export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL';
|
||||||
export const STATUS_REVEAL = 'STATUS_REVEAL';
|
export const STATUS_REVEAL = 'STATUS_REVEAL';
|
||||||
export const STATUS_HIDE = 'STATUS_HIDE';
|
export const STATUS_HIDE = 'STATUS_HIDE';
|
||||||
|
|
||||||
export const REDRAFT = 'REDRAFT';
|
|
||||||
|
|
||||||
const statusExists = (getState, statusId) => {
|
const statusExists = (getState, statusId) => {
|
||||||
return getState().getIn(['statuses', statusId], null) !== null;
|
return getState().getIn(['statuses', statusId], null) !== null;
|
||||||
};
|
};
|
||||||
|
@ -124,22 +122,6 @@ export function fetchStatus(id) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function redraft(status, raw_text, content_type) {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
const { instance } = getState();
|
|
||||||
const { explicitAddressing } = getFeatures(instance);
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: REDRAFT,
|
|
||||||
status,
|
|
||||||
raw_text,
|
|
||||||
explicitAddressing,
|
|
||||||
content_type,
|
|
||||||
v: parseVersion(instance.version),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deleteStatus(id, routerHistory, withRedraft = false) {
|
export function deleteStatus(id, routerHistory, withRedraft = false) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
if (!isLoggedIn(getState)) return;
|
if (!isLoggedIn(getState)) return;
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
import * as actions from 'soapbox/actions/compose';
|
import * as actions from 'soapbox/actions/compose';
|
||||||
import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS } from 'soapbox/actions/me';
|
import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS } from 'soapbox/actions/me';
|
||||||
import { SETTING_CHANGE } from 'soapbox/actions/settings';
|
import { SETTING_CHANGE } from 'soapbox/actions/settings';
|
||||||
import { REDRAFT } from 'soapbox/actions/statuses';
|
|
||||||
import { TIMELINE_DELETE } from 'soapbox/actions/timelines';
|
import { TIMELINE_DELETE } from 'soapbox/actions/timelines';
|
||||||
import { normalizeStatus } from 'soapbox/normalizers/status';
|
import { normalizeStatus } from 'soapbox/normalizers/status';
|
||||||
|
|
||||||
|
@ -39,10 +38,10 @@ describe('compose reducer', () => {
|
||||||
expect(state.get('idempotencyKey').length === 36);
|
expect(state.get('idempotencyKey').length === 36);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('REDRAFT', () => {
|
describe('COMPOSE_SET_STATUS', () => {
|
||||||
it('strips Pleroma integer attachments', () => {
|
it('strips Pleroma integer attachments', () => {
|
||||||
const action = {
|
const action = {
|
||||||
type: REDRAFT,
|
type: actions.COMPOSE_SET_STATUS,
|
||||||
status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))),
|
status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))),
|
||||||
v: { software: 'Pleroma' },
|
v: { software: 'Pleroma' },
|
||||||
};
|
};
|
||||||
|
@ -53,7 +52,7 @@ describe('compose reducer', () => {
|
||||||
|
|
||||||
it('leaves non-Pleroma integer attachments alone', () => {
|
it('leaves non-Pleroma integer attachments alone', () => {
|
||||||
const action = {
|
const action = {
|
||||||
type: REDRAFT,
|
type: actions.COMPOSE_SET_STATUS,
|
||||||
status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))),
|
status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue