list fake contacts

This commit is contained in:
Baptiste Lemoine 2020-01-06 20:50:36 +01:00
parent 8ca84658a3
commit d1ca0f69a8
13 changed files with 304 additions and 238 deletions

View File

@ -4,75 +4,75 @@ import { importAccount, importFetchedAccount, importFetchedAccounts } from './im
export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
export const ACCOUNT_FETCH_FAIL = 'ACCOUNT_FETCH_FAIL';
export const ACCOUNT_FETCH_FAIL = 'ACCOUNT_FETCH_FAIL';
export const ACCOUNT_FOLLOW_REQUEST = 'ACCOUNT_FOLLOW_REQUEST';
export const ACCOUNT_FOLLOW_SUCCESS = 'ACCOUNT_FOLLOW_SUCCESS';
export const ACCOUNT_FOLLOW_FAIL = 'ACCOUNT_FOLLOW_FAIL';
export const ACCOUNT_FOLLOW_FAIL = 'ACCOUNT_FOLLOW_FAIL';
export const ACCOUNT_UNFOLLOW_REQUEST = 'ACCOUNT_UNFOLLOW_REQUEST';
export const ACCOUNT_UNFOLLOW_SUCCESS = 'ACCOUNT_UNFOLLOW_SUCCESS';
export const ACCOUNT_UNFOLLOW_FAIL = 'ACCOUNT_UNFOLLOW_FAIL';
export const ACCOUNT_UNFOLLOW_FAIL = 'ACCOUNT_UNFOLLOW_FAIL';
export const ACCOUNT_BLOCK_REQUEST = 'ACCOUNT_BLOCK_REQUEST';
export const ACCOUNT_BLOCK_SUCCESS = 'ACCOUNT_BLOCK_SUCCESS';
export const ACCOUNT_BLOCK_FAIL = 'ACCOUNT_BLOCK_FAIL';
export const ACCOUNT_BLOCK_FAIL = 'ACCOUNT_BLOCK_FAIL';
export const ACCOUNT_UNBLOCK_REQUEST = 'ACCOUNT_UNBLOCK_REQUEST';
export const ACCOUNT_UNBLOCK_SUCCESS = 'ACCOUNT_UNBLOCK_SUCCESS';
export const ACCOUNT_UNBLOCK_FAIL = 'ACCOUNT_UNBLOCK_FAIL';
export const ACCOUNT_UNBLOCK_FAIL = 'ACCOUNT_UNBLOCK_FAIL';
export const ACCOUNT_MUTE_REQUEST = 'ACCOUNT_MUTE_REQUEST';
export const ACCOUNT_MUTE_SUCCESS = 'ACCOUNT_MUTE_SUCCESS';
export const ACCOUNT_MUTE_FAIL = 'ACCOUNT_MUTE_FAIL';
export const ACCOUNT_MUTE_FAIL = 'ACCOUNT_MUTE_FAIL';
export const ACCOUNT_UNMUTE_REQUEST = 'ACCOUNT_UNMUTE_REQUEST';
export const ACCOUNT_UNMUTE_SUCCESS = 'ACCOUNT_UNMUTE_SUCCESS';
export const ACCOUNT_UNMUTE_FAIL = 'ACCOUNT_UNMUTE_FAIL';
export const ACCOUNT_UNMUTE_FAIL = 'ACCOUNT_UNMUTE_FAIL';
export const ACCOUNT_PIN_REQUEST = 'ACCOUNT_PIN_REQUEST';
export const ACCOUNT_PIN_SUCCESS = 'ACCOUNT_PIN_SUCCESS';
export const ACCOUNT_PIN_FAIL = 'ACCOUNT_PIN_FAIL';
export const ACCOUNT_PIN_FAIL = 'ACCOUNT_PIN_FAIL';
export const ACCOUNT_UNPIN_REQUEST = 'ACCOUNT_UNPIN_REQUEST';
export const ACCOUNT_UNPIN_SUCCESS = 'ACCOUNT_UNPIN_SUCCESS';
export const ACCOUNT_UNPIN_FAIL = 'ACCOUNT_UNPIN_FAIL';
export const ACCOUNT_UNPIN_FAIL = 'ACCOUNT_UNPIN_FAIL';
export const FOLLOWERS_FETCH_REQUEST = 'FOLLOWERS_FETCH_REQUEST';
export const FOLLOWERS_FETCH_SUCCESS = 'FOLLOWERS_FETCH_SUCCESS';
export const FOLLOWERS_FETCH_FAIL = 'FOLLOWERS_FETCH_FAIL';
export const FOLLOWERS_FETCH_FAIL = 'FOLLOWERS_FETCH_FAIL';
export const FOLLOWERS_EXPAND_REQUEST = 'FOLLOWERS_EXPAND_REQUEST';
export const FOLLOWERS_EXPAND_SUCCESS = 'FOLLOWERS_EXPAND_SUCCESS';
export const FOLLOWERS_EXPAND_FAIL = 'FOLLOWERS_EXPAND_FAIL';
export const FOLLOWERS_EXPAND_FAIL = 'FOLLOWERS_EXPAND_FAIL';
export const FOLLOWING_FETCH_REQUEST = 'FOLLOWING_FETCH_REQUEST';
export const FOLLOWING_FETCH_SUCCESS = 'FOLLOWING_FETCH_SUCCESS';
export const FOLLOWING_FETCH_FAIL = 'FOLLOWING_FETCH_FAIL';
export const FOLLOWING_FETCH_FAIL = 'FOLLOWING_FETCH_FAIL';
export const FOLLOWING_EXPAND_REQUEST = 'FOLLOWING_EXPAND_REQUEST';
export const FOLLOWING_EXPAND_SUCCESS = 'FOLLOWING_EXPAND_SUCCESS';
export const FOLLOWING_EXPAND_FAIL = 'FOLLOWING_EXPAND_FAIL';
export const FOLLOWING_EXPAND_FAIL = 'FOLLOWING_EXPAND_FAIL';
export const RELATIONSHIPS_FETCH_REQUEST = 'RELATIONSHIPS_FETCH_REQUEST';
export const RELATIONSHIPS_FETCH_SUCCESS = 'RELATIONSHIPS_FETCH_SUCCESS';
export const RELATIONSHIPS_FETCH_FAIL = 'RELATIONSHIPS_FETCH_FAIL';
export const RELATIONSHIPS_FETCH_FAIL = 'RELATIONSHIPS_FETCH_FAIL';
export const FOLLOW_REQUESTS_FETCH_REQUEST = 'FOLLOW_REQUESTS_FETCH_REQUEST';
export const FOLLOW_REQUESTS_FETCH_SUCCESS = 'FOLLOW_REQUESTS_FETCH_SUCCESS';
export const FOLLOW_REQUESTS_FETCH_FAIL = 'FOLLOW_REQUESTS_FETCH_FAIL';
export const FOLLOW_REQUESTS_FETCH_FAIL = 'FOLLOW_REQUESTS_FETCH_FAIL';
export const FOLLOW_REQUESTS_EXPAND_REQUEST = 'FOLLOW_REQUESTS_EXPAND_REQUEST';
export const FOLLOW_REQUESTS_EXPAND_SUCCESS = 'FOLLOW_REQUESTS_EXPAND_SUCCESS';
export const FOLLOW_REQUESTS_EXPAND_FAIL = 'FOLLOW_REQUESTS_EXPAND_FAIL';
export const FOLLOW_REQUESTS_EXPAND_FAIL = 'FOLLOW_REQUESTS_EXPAND_FAIL';
export const FOLLOW_REQUEST_AUTHORIZE_REQUEST = 'FOLLOW_REQUEST_AUTHORIZE_REQUEST';
export const FOLLOW_REQUEST_AUTHORIZE_SUCCESS = 'FOLLOW_REQUEST_AUTHORIZE_SUCCESS';
export const FOLLOW_REQUEST_AUTHORIZE_FAIL = 'FOLLOW_REQUEST_AUTHORIZE_FAIL';
export const FOLLOW_REQUEST_AUTHORIZE_FAIL = 'FOLLOW_REQUEST_AUTHORIZE_FAIL';
export const FOLLOW_REQUEST_REJECT_REQUEST = 'FOLLOW_REQUEST_REJECT_REQUEST';
export const FOLLOW_REQUEST_REJECT_SUCCESS = 'FOLLOW_REQUEST_REJECT_SUCCESS';
export const FOLLOW_REQUEST_REJECT_FAIL = 'FOLLOW_REQUEST_REJECT_FAIL';
export const FOLLOW_REQUEST_REJECT_FAIL = 'FOLLOW_REQUEST_REJECT_FAIL';
function getFromDB(dispatch, getState, index, id) {
return new Promise((resolve, reject) => {
@ -106,7 +106,7 @@ export function fetchAccount(id) {
dispatch,
getState,
db.transaction('accounts', 'read').objectStore('accounts').index('id'),
id
id,
).then(() => db.close(), error => {
db.close();
throw error;
@ -135,7 +135,7 @@ export function fetchAccountSuccess() {
export function fetchAccountFail(id, error) {
return {
type: ACCOUNT_FETCH_FAIL,
type : ACCOUNT_FETCH_FAIL,
id,
error,
skipAlert: true,
@ -171,7 +171,7 @@ export function unfollowAccount(id) {
export function followAccountRequest(id, locked) {
return {
type: ACCOUNT_FOLLOW_REQUEST,
type : ACCOUNT_FOLLOW_REQUEST,
id,
locked,
skipLoading: true,
@ -180,7 +180,7 @@ export function followAccountRequest(id, locked) {
export function followAccountSuccess(relationship, alreadyFollowing) {
return {
type: ACCOUNT_FOLLOW_SUCCESS,
type : ACCOUNT_FOLLOW_SUCCESS,
relationship,
alreadyFollowing,
skipLoading: true,
@ -189,7 +189,7 @@ export function followAccountSuccess(relationship, alreadyFollowing) {
export function followAccountFail(error, locked) {
return {
type: ACCOUNT_FOLLOW_FAIL,
type : ACCOUNT_FOLLOW_FAIL,
error,
locked,
skipLoading: true,
@ -198,7 +198,7 @@ export function followAccountFail(error, locked) {
export function unfollowAccountRequest(id) {
return {
type: ACCOUNT_UNFOLLOW_REQUEST,
type : ACCOUNT_UNFOLLOW_REQUEST,
id,
skipLoading: true,
};
@ -206,7 +206,7 @@ export function unfollowAccountRequest(id) {
export function unfollowAccountSuccess(relationship, statuses) {
return {
type: ACCOUNT_UNFOLLOW_SUCCESS,
type : ACCOUNT_UNFOLLOW_SUCCESS,
relationship,
statuses,
skipLoading: true,
@ -215,7 +215,7 @@ export function unfollowAccountSuccess(relationship, statuses) {
export function unfollowAccountFail(error) {
return {
type: ACCOUNT_UNFOLLOW_FAIL,
type : ACCOUNT_UNFOLLOW_FAIL,
error,
skipLoading: true,
};
@ -289,7 +289,6 @@ export function unblockAccountFail(error) {
};
};
export function muteAccount(id, notifications) {
return (dispatch, getState) => {
dispatch(muteAccountRequest(id));
@ -358,7 +357,6 @@ export function unmuteAccountFail(error) {
};
};
export function fetchFollowers(id) {
return (dispatch, getState) => {
dispatch(fetchFollowersRequest(id));
@ -469,6 +467,7 @@ export function fetchFollowingRequest(id) {
};
export function fetchFollowingSuccess(id, accounts, next) {
console.log('id,accounts,next', id, accounts, next);
return {
type: FOLLOWING_FETCH_SUCCESS,
id,
@ -552,7 +551,7 @@ export function fetchRelationships(accountIds) {
export function fetchRelationshipsRequest(ids) {
return {
type: RELATIONSHIPS_FETCH_REQUEST,
type : RELATIONSHIPS_FETCH_REQUEST,
ids,
skipLoading: true,
};
@ -560,7 +559,7 @@ export function fetchRelationshipsRequest(ids) {
export function fetchRelationshipsSuccess(relationships) {
return {
type: RELATIONSHIPS_FETCH_SUCCESS,
type : RELATIONSHIPS_FETCH_SUCCESS,
relationships,
skipLoading: true,
};
@ -568,7 +567,7 @@ export function fetchRelationshipsSuccess(relationships) {
export function fetchRelationshipsFail(error) {
return {
type: RELATIONSHIPS_FETCH_FAIL,
type : RELATIONSHIPS_FETCH_FAIL,
error,
skipLoading: true,
};
@ -679,7 +678,6 @@ export function authorizeFollowRequestFail(id, error) {
};
};
export function rejectFollowRequest(id) {
return (dispatch, getState) => {
dispatch(rejectFollowRequestRequest(id));

View File

@ -7,26 +7,25 @@ import { useEmoji } from './emojis';
import resizeImage from '../utils/resize_image';
import { importFetchedAccounts } from './importer';
import { updateTimeline } from './timelines';
import { showAlertForError } from './alerts';
import { showAlert } from './alerts';
import { showAlert, showAlertForError } from './alerts';
import { defineMessages } from 'react-intl';
let cancelFetchComposeSuggestionsAccounts, cancelFetchComposeSuggestionsTags;
export const COMPOSE_CHANGE = 'COMPOSE_CHANGE';
export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST';
export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS';
export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
export const COMPOSE_RESET = 'COMPOSE_RESET';
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
export const COMPOSE_CHANGE = 'COMPOSE_CHANGE';
export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST';
export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS';
export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
export const COMPOSE_RESET = 'COMPOSE_RESET';
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
export const COMPOSE_UPLOAD_PROGRESS = 'COMPOSE_UPLOAD_PROGRESS';
export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO';
export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO';
export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR';
export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY';
@ -35,32 +34,32 @@ export const COMPOSE_SUGGESTION_TAGS_UPDATE = 'COMPOSE_SUGGESTION_TAGS_UPDATE';
export const COMPOSE_TAG_HISTORY_UPDATE = 'COMPOSE_TAG_HISTORY_UPDATE';
export const COMPOSE_MOUNT = 'COMPOSE_MOUNT';
export const COMPOSE_MOUNT = 'COMPOSE_MOUNT';
export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT';
export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE';
export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE';
export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
export const COMPOSE_UPLOAD_CHANGE_REQUEST = 'COMPOSE_UPLOAD_UPDATE_REQUEST';
export const COMPOSE_UPLOAD_CHANGE_SUCCESS = 'COMPOSE_UPLOAD_UPDATE_SUCCESS';
export const COMPOSE_UPLOAD_CHANGE_FAIL = 'COMPOSE_UPLOAD_UPDATE_FAIL';
export const COMPOSE_UPLOAD_CHANGE_REQUEST = 'COMPOSE_UPLOAD_UPDATE_REQUEST';
export const COMPOSE_UPLOAD_CHANGE_SUCCESS = 'COMPOSE_UPLOAD_UPDATE_SUCCESS';
export const COMPOSE_UPLOAD_CHANGE_FAIL = 'COMPOSE_UPLOAD_UPDATE_FAIL';
export const COMPOSE_POLL_ADD = 'COMPOSE_POLL_ADD';
export const COMPOSE_POLL_REMOVE = 'COMPOSE_POLL_REMOVE';
export const COMPOSE_POLL_OPTION_ADD = 'COMPOSE_POLL_OPTION_ADD';
export const COMPOSE_POLL_OPTION_CHANGE = 'COMPOSE_POLL_OPTION_CHANGE';
export const COMPOSE_POLL_OPTION_REMOVE = 'COMPOSE_POLL_OPTION_REMOVE';
export const COMPOSE_POLL_ADD = 'COMPOSE_POLL_ADD';
export const COMPOSE_POLL_REMOVE = 'COMPOSE_POLL_REMOVE';
export const COMPOSE_POLL_OPTION_ADD = 'COMPOSE_POLL_OPTION_ADD';
export const COMPOSE_POLL_OPTION_CHANGE = 'COMPOSE_POLL_OPTION_CHANGE';
export const COMPOSE_POLL_OPTION_REMOVE = 'COMPOSE_POLL_OPTION_REMOVE';
export const COMPOSE_POLL_SETTINGS_CHANGE = 'COMPOSE_POLL_SETTINGS_CHANGE';
const messages = defineMessages({
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
uploadErrorPoll : { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
});
const COMPOSE_PANEL_BREAKPOINT = 600 + (285 * 1) + (10 * 1);
@ -81,7 +80,7 @@ export function changeCompose(text) {
export function replyCompose(status, routerHistory) {
return (dispatch, getState) => {
dispatch({
type: COMPOSE_REPLY,
type : COMPOSE_REPLY,
status: status,
});
@ -104,7 +103,7 @@ export function resetCompose() {
export function mentionCompose(account, routerHistory) {
return (dispatch, getState) => {
dispatch({
type: COMPOSE_MENTION,
type : COMPOSE_MENTION,
account: account,
});
@ -115,7 +114,7 @@ export function mentionCompose(account, routerHistory) {
export function directCompose(account, routerHistory) {
return (dispatch, getState) => {
dispatch({
type: COMPOSE_DIRECT,
type : COMPOSE_DIRECT,
account: account,
});
@ -126,7 +125,7 @@ export function directCompose(account, routerHistory) {
export function submitCompose(routerHistory) {
return function (dispatch, getState) {
const status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const media = getState().getIn(['compose', 'media_attachments']);
if ((!status || !status.length) && media.size === 0) {
return;
@ -137,11 +136,11 @@ export function submitCompose(routerHistory) {
api(getState).post('/api/v1/statuses', {
status,
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: media.map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']),
spoiler_text: getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '',
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
media_ids : media.map(item => item.get('id')),
sensitive : getState().getIn(['compose', 'sensitive']),
spoiler_text : getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '',
visibility : getState().getIn(['compose', 'privacy']),
poll : getState().getIn(['compose', 'poll'], null),
}, {
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
@ -189,14 +188,14 @@ export function submitComposeRequest() {
export function submitComposeSuccess(status) {
return {
type: COMPOSE_SUBMIT_SUCCESS,
type : COMPOSE_SUBMIT_SUCCESS,
status: status,
};
};
export function submitComposeFail(error) {
return {
type: COMPOSE_SUBMIT_FAIL,
type : COMPOSE_SUBMIT_FAIL,
error: error,
};
};
@ -204,8 +203,8 @@ export function submitComposeFail(error) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 4;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const progress = new Array(files.length).fill(0);
let total = Array.from(files).reduce((a, v) => a + v.size, 0);
@ -231,13 +230,14 @@ export function uploadCompose(files) {
total += file.size - f.size;
return api(getState).post('/api/v1/media', data, {
onUploadProgress: function({ loaded }){
onUploadProgress: function ({ loaded }) {
progress[i] = loaded;
dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
},
}).then(({ data }) => dispatch(uploadComposeSuccess(data, f)));
}).catch(error => dispatch(uploadComposeFail(error)));
};
}
;
};
};
@ -255,61 +255,62 @@ export function changeUploadCompose(id, params) {
export function changeUploadComposeRequest() {
return {
type: COMPOSE_UPLOAD_CHANGE_REQUEST,
type : COMPOSE_UPLOAD_CHANGE_REQUEST,
skipLoading: true,
};
};
export function changeUploadComposeSuccess(media) {
return {
type: COMPOSE_UPLOAD_CHANGE_SUCCESS,
media: media,
type : COMPOSE_UPLOAD_CHANGE_SUCCESS,
media : media,
skipLoading: true,
};
};
export function changeUploadComposeFail(error) {
return {
type: COMPOSE_UPLOAD_CHANGE_FAIL,
error: error,
type : COMPOSE_UPLOAD_CHANGE_FAIL,
error : error,
skipLoading: true,
};
};
export function uploadComposeRequest() {
return {
type: COMPOSE_UPLOAD_REQUEST,
type : COMPOSE_UPLOAD_REQUEST,
skipLoading: true,
};
};
export function uploadComposeProgress(loaded, total) {
return {
type: COMPOSE_UPLOAD_PROGRESS,
type : COMPOSE_UPLOAD_PROGRESS,
loaded: loaded,
total: total,
total : total,
};
};
export function uploadComposeSuccess(media, file) {
return {
type: COMPOSE_UPLOAD_SUCCESS,
media: media,
file: file,
type : COMPOSE_UPLOAD_SUCCESS,
media : media,
file : file,
skipLoading: true,
};
};
export function uploadComposeFail(error) {
return {
type: COMPOSE_UPLOAD_FAIL,
error: error,
type : COMPOSE_UPLOAD_FAIL,
error : error,
skipLoading: true,
};
};
export function undoUploadCompose(media_id) {
return {
type: COMPOSE_UPLOAD_UNDO,
type : COMPOSE_UPLOAD_UNDO,
media_id: media_id,
};
};
@ -334,9 +335,9 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
}),
params: {
q: token.slice(1),
q : token.slice(1),
resolve: false,
limit: 4,
limit : 4,
},
}).then(response => {
dispatch(importFetchedAccounts(response.data));
@ -366,10 +367,10 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
}),
params: {
type: 'hashtags',
q: token.slice(1),
resolve: false,
limit: 4,
type : 'hashtags',
q : token.slice(1),
resolve : false,
limit : 4,
exclude_unreviewed: true,
},
}).then(({ data }) => {
@ -424,20 +425,20 @@ export function selectComposeSuggestion(position, token, suggestion, path) {
let completion, startPosition;
if (suggestion.type === 'emoji') {
completion = suggestion.native || suggestion.colons;
completion = suggestion.native || suggestion.colons;
startPosition = position - 1;
dispatch(useEmoji(suggestion));
} else if (suggestion.type === 'hashtag') {
completion = `#${suggestion.name}`;
completion = `#${suggestion.name}`;
startPosition = position - 1;
} else if (suggestion.type === 'account') {
completion = getState().getIn(['accounts', suggestion.id, 'acct']);
completion = getState().getIn(['accounts', suggestion.id, 'acct']);
startPosition = position;
}
dispatch({
type: COMPOSE_SUGGESTION_SELECT,
type : COMPOSE_SUGGESTION_SELECT,
position: startPosition,
token,
completion,
@ -463,6 +464,7 @@ export function updateTagHistory(tags) {
export function hydrateCompose() {
return (dispatch, getState) => {
const me = getState().getIn(['meta', 'me']);
console.log('my user id:', me);
const history = tagHistory.get(me);
if (history !== null) {

View File

@ -2,62 +2,62 @@ import { connect } from 'react-redux';
import ComposeForm from '../components/compose_form';
import {
changeCompose,
submitCompose,
changeComposeSpoilerText,
clearComposeSuggestions,
fetchComposeSuggestions,
selectComposeSuggestion,
changeComposeSpoilerText,
insertEmojiCompose,
selectComposeSuggestion,
submitCompose,
uploadCompose,
} from '../../../actions/compose';
const mapStateToProps = state => ({
text: state.getIn(['compose', 'text']),
suggestions: state.getIn(['compose', 'suggestions']),
spoiler: state.getIn(['compose', 'spoiler']),
spoilerText: state.getIn(['compose', 'spoiler_text']),
privacy: state.getIn(['compose', 'privacy']),
focusDate: state.getIn(['compose', 'focusDate']),
caretPosition: state.getIn(['compose', 'caretPosition']),
preselectDate: state.getIn(['compose', 'preselectDate']),
isSubmitting: state.getIn(['compose', 'is_submitting']),
text : state.getIn(['compose', 'text']),
suggestions : state.getIn(['compose', 'suggestions']),
spoiler : state.getIn(['compose', 'spoiler']),
spoilerText : state.getIn(['compose', 'spoiler_text']),
privacy : state.getIn(['compose', 'privacy']),
focusDate : state.getIn(['compose', 'focusDate']),
caretPosition : state.getIn(['compose', 'caretPosition']),
preselectDate : state.getIn(['compose', 'preselectDate']),
isSubmitting : state.getIn(['compose', 'is_submitting']),
isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
isUploading: state.getIn(['compose', 'is_uploading']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
isUploading : state.getIn(['compose', 'is_uploading']),
showSearch : state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
anyMedia : state.getIn(['compose', 'media_attachments']).size > 0,
});
const mapDispatchToProps = (dispatch) => ({
onChange (text) {
onChange(text) {
dispatch(changeCompose(text));
},
onSubmit (router) {
onSubmit(router) {
dispatch(submitCompose(router));
},
onClearSuggestions () {
onClearSuggestions() {
dispatch(clearComposeSuggestions());
},
onFetchSuggestions (token) {
onFetchSuggestions(token) {
dispatch(fetchComposeSuggestions(token));
},
onSuggestionSelected (position, token, suggestion, path) {
onSuggestionSelected(position, token, suggestion, path) {
dispatch(selectComposeSuggestion(position, token, suggestion, path));
},
onChangeSpoilerText (checked) {
onChangeSpoilerText(checked) {
dispatch(changeComposeSpoilerText(checked));
},
onPaste (files) {
onPaste(files) {
dispatch(uploadCompose(files));
},
onPickEmoji (position, data, needsSpace) {
onPickEmoji(position, data, needsSpace) {
dispatch(insertEmojiCompose(position, data, needsSpace));
},

View File

@ -5,11 +5,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowing,
expandFollowing,
} from '../../actions/accounts';
import { expandFollowing, fetchAccount, fetchFollowing } from '../../actions/accounts';
import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column';
@ -19,34 +15,34 @@ import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator';
const mapStateToProps = (state, props) => ({
isAccount: !!state.getIn(['accounts', props.params.accountId]),
isAccount : !!state.getIn(['accounts', props.params.accountId]),
accountIds: state.getIn(['user_lists', 'following', props.params.accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', props.params.accountId, 'next']),
blockedBy: state.getIn(['relationships', props.params.accountId, 'blocked_by'], false),
hasMore : !!state.getIn(['user_lists', 'following', props.params.accountId, 'next']),
blockedBy : state.getIn(['relationships', props.params.accountId, 'blocked_by'], false),
});
export default @connect(mapStateToProps)
class Following extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
params : PropTypes.object.isRequired,
dispatch : PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
blockedBy: PropTypes.bool,
isAccount: PropTypes.bool,
multiColumn: PropTypes.bool,
accountIds : ImmutablePropTypes.list,
hasMore : PropTypes.bool,
blockedBy : PropTypes.bool,
isAccount : PropTypes.bool,
multiColumn : PropTypes.bool,
};
componentWillMount () {
componentWillMount() {
if (!this.props.accountIds) {
this.props.dispatch(fetchAccount(this.props.params.accountId));
this.props.dispatch(fetchFollowing(this.props.params.accountId));
}
}
componentWillReceiveProps (nextProps) {
componentWillReceiveProps(nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(nextProps.params.accountId));
this.props.dispatch(fetchFollowing(nextProps.params.accountId));
@ -57,29 +53,35 @@ class Following extends ImmutablePureComponent {
this.props.dispatch(expandFollowing(this.props.params.accountId));
}, 300, { leading: true });
render () {
render() {
const { shouldUpdateScroll, accountIds, hasMore, blockedBy, isAccount, multiColumn } = this.props;
if (!isAccount) {
return (
<Column>
<Column >
<MissingIndicator />
</Column>
</Column >
);
}
if (!accountIds) {
return (
<Column>
<Column >
<LoadingIndicator />
</Column>
</Column >
);
}
const emptyMessage = blockedBy ? <FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' /> : <FormattedMessage id='account.follows.empty' defaultMessage="This user doesn't follow anyone yet." />;
const emptyMessage = blockedBy ? <FormattedMessage
id='empty_column.account_unavailable'
defaultMessage='Profile unavailable'
/> : <FormattedMessage
id='account.follows.empty'
defaultMessage="This user doesn't follow anyone yet."
/>;
return (
<Column>
<Column >
<ColumnBackButton multiColumn={multiColumn} />
<ScrollableList
@ -87,16 +89,23 @@ class Following extends ImmutablePureComponent {
hasMore={hasMore}
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
prepend={<HeaderContainer accountId={this.props.params.accountId} hideTabs />}
prepend={<HeaderContainer
accountId={this.props.params.accountId}
hideTabs
/>}
alwaysPrepend
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
>
{blockedBy ? [] : accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} />
<AccountContainer
key={id}
id={id}
withNote={false}
/>,
)}
</ScrollableList>
</Column>
</ScrollableList >
</Column >
);
}

View File

@ -222,7 +222,9 @@ class ColumnsArea extends ImmutablePureComponent {
<div className='columns-area__panels__pane columns-area__panels__pane--compositional'>
<div className='columns-area__panels__pane__inner'>
<ComposePanel />
</div >
</div >
<div className='columns-area__panels__main'>

View File

@ -4,7 +4,7 @@ import ComposeFormContainer from 'mastodon/features/compose/containers/compose_f
import NavigationContainer from 'mastodon/features/compose/containers/navigation_container';
import InstantMessaging from './messaging/instantMessaging';
const showIM = false;
const showIM = true;
const ComposePanel = () => (
<div className='compose-panel'>
<SearchContainer openInRoute />

View File

@ -23,22 +23,26 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
},
});
// const themeIsDark = true;
// const displaythemetoggler = true;
export default @injectIntl
@connect(null, mapDispatchToProps)
class LinkFooter extends React.PureComponent {
static propTypes = {
enableChristmasSnow: PropTypes.bool,
snowActive : PropTypes.bool,
withHotkeys : PropTypes.bool,
snow : PropTypes.func,
onLogout : PropTypes.func.isRequired,
intl : PropTypes.object.isRequired,
enableChristmasSnow : PropTypes.bool,
minimumWeekToShowSnow: PropTypes.number,
snowActive : PropTypes.bool,
withHotkeys : PropTypes.bool,
snow : PropTypes.func,
themeIsDark : PropTypes.bool,
theme : PropTypes.string,
onLogout : PropTypes.func.isRequired,
intl : PropTypes.object.isRequired,
};
static defaultProps = {
enableChristmasSnow: true,
enableChristmasSnow : true,
themeIsDark : true,
minimumWeekToShowSnow: 48,
};
handleLogoutClick = e => {
@ -60,9 +64,12 @@ class LinkFooter extends React.PureComponent {
var weekNumber = (new Date()).getWeek();
// display snow during the last two weeks of the year
console.log('week', weekNumber);
const shouldWeDisplaySnow = (weekNumber > 48) && props.enableChristmasSnow;
const shouldWeDisplaySnow = (weekNumber > props.minimumWeekToShowSnow) && props.enableChristmasSnow;
this.state = { enableChristmasSnow: shouldWeDisplaySnow };
this.state = {
enableChristmasSnow: shouldWeDisplaySnow,
theme : props.theme,
};
// make snow effect
if (shouldWeDisplaySnow) {
@ -84,12 +91,11 @@ class LinkFooter extends React.PureComponent {
if (this.state.snow) {
if (this.state.snowActive) {
this.state.snow.stop();
this.state.snowActive = false;
this.state.enableChristmasSnow = false;
} else {
this.state.snow.start();
this.state.snowActive = true;
this.state.enableChristmasSnow = true;
}
}
};
@ -99,7 +105,7 @@ class LinkFooter extends React.PureComponent {
render() {
const { withHotkeys } = this.props;
var snowClasses = this.props.snowActive ? 'snow-button active' : 'snow-button ';
var snowClasses = this.props.enableChristmasSnow ? 'snow-button active' : 'snow-button ';
return (
@ -107,24 +113,24 @@ class LinkFooter extends React.PureComponent {
<div className='extras'>
{/*// TODO*/}
{/*<button className='mod-theme btn btn-block'>*/}
{/* {themeIsDark ? (*/}
{/* <span*/}
{/* onClick={this.changeTheme('light')}*/}
{/* title='set light'*/}
{/* >*/}
{/* <i className='fa fa-pencil-o' />*/}
{/* </span >*/}
{/* ) : (*/}
{/* <span*/}
{/* onClick={this.changeTheme('dark')}*/}
{/* title='set dark'*/}
{/* >*/}
{/* <i className='fa fa-pencil' />*/}
{/* </span >*/}
{/* )}*/}
{/*</button >*/}
// TODO
<button className='mod-theme btn btn-block'>
{this.themeIsDark ? (
<span
onClick={this.setState('theme', 'light')}
title='set light'
>
<i className='fa fa-pencil-o' /> to light
</span >
) : (
<span
onClick={this.changeTheme('dark')}
title='set dark'
>
<i className='fa fa-pencil' /> to dark
</span >
)}
</button >
{this.state.enableChristmasSnow && (
<div
@ -138,45 +144,49 @@ class LinkFooter extends React.PureComponent {
/>
</div >
<div > Joyeuses fêtes!</div >
{isStaff && (
<a href='/admin/tags?pending_review=1'>
<i className='fa fa-fire' />
Trending hashtags</a >
)}
<br />
<div className='external-utilities'>
<a href='https://mastodon.cipherbliss.com/@tykayn'>
<i className='fa fa-paper-plane' />
contactez nous
</a >
<a href='https://liberapay.com/cipherbliss'><i className='fa fa-coffee' /> Supportez Cipherbliss</a >
<a href='https://peertube.cipherbliss.com'> <i className='fa fa-play ' /> Videos</a >
<a href='https://framadate.org/'> <i className='fa fa-calendar' /> FramaDate</a >
<a href='https://framapad.org/'> <i className='fa fa-file-text' /> Pad</a >
<a href='https://framagit.org/tykayn/mastodon'> <i className='fa fa-gitlab' /> Source</a >
<hr />
<a href='/web/timelines/tag/vélo'> <i className='fa fa-bicycle' /> #vélo</a >
<a href='/web/timelines/tag/openstreetmap'> <i className='fa fa-map-o' /> #OpenStreetMap</a >
<a href='/web/timelines/tag/mastoart'> <i className='fa fa-paint-brush' /> #Mastoart</a >
<a href='/web/timelines/tag/ironèmes'> <i className='fa fa-file-text-o' /> #ironèmes</a >
</div >
</div >
)}
{isStaff && (
<a href='/admin/tags?pending_review=1'>
<i className='fa fa-fire' />
Trending hashtags</a >
)}
<br />
<div className='external-utilities'>
<a href='https://mastodon.cipherbliss.com/@tykayn'>
<i className='fa fa-paper-plane' />
contactez nous
</a >
<a href='https://liberapay.com/cipherbliss'><i className='fa fa-coffee' /> Supportez
Cipherbliss</a >
<a href='https://peertube.cipherbliss.com'> <i className='fa fa-play ' /> Videos</a >
<a href='https://framadate.org/'> <i className='fa fa-calendar' /> FramaDate</a >
<a href='https://framapad.org/'> <i className='fa fa-file-text' /> Pad</a >
<a href='https://framagit.org/tykayn/mastodon'> <i className='fa fa-gitlab' /> Source</a >
<hr />
<a href='/web/timelines/tag/vélo'> <i className='fa fa-bicycle' /> #vélo</a >
<a href='/web/timelines/tag/openstreetmap'> <i className='fa fa-map-o' /> #OpenStreetMap</a >
<a href='/web/timelines/tag/mastoart'> <i className='fa fa-paint-brush' /> #Mastoart</a >
<a href='/web/timelines/tag/ironèmes'> <i className='fa fa-file-text-o' /> #ironèmes</a >
</div >
</div >
<ul >
{invitesEnabled && <li ><a
href='/invites'
target='_blank'
><FormattedMessage
id='getting_started.invite'
defaultMessage='Invite people'
/> ·</a >
</li >}
{invitesEnabled && (
<li >
<a
href='/invites'
target='_blank'
>
<FormattedMessage
id='getting_started.invite'
defaultMessage='Invite people'
/> ·</a >
</li >
)}
{withHotkeys && <li ><Link to='/keyboard-shortcuts'>
<FormattedMessage
id='navigation_bar.keyboard_shortcuts'

View File

@ -1,25 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import accounts, { me } from '../../../../initial_state';
export default class ContactsList extends React.PureComponent {
static propTypes = {
// myAccount : PropTypes.any,
showList : PropTypes.bool,
contactList : PropTypes.array,
conversationList: PropTypes.array,
following_count : PropTypes.number,
};
static defaultProps = {
showList : true,
contactList: ['machin', 'bidule', 'chuck norris'],
showList : true,
// myAccount : '',
userID : me,
following_count: 0,
contactList : ['machin', 'bidule', 'chuck norris'],
};
constructor(props) {
super(props);
console.log('me', me);
console.log('account', accounts.accounts[me]);
console.log('i follow accounts.accounts[me].followingCount', accounts.accounts[me].following_count);
// this.props.myAccount = accounts.accounts[me];
// this.props.following_count = accounts.accounts[me].following_count;
this.state = {
showList : true,
following_count : accounts.accounts[me].following_count,
showList : props.showList,
contactList : ['machin', 'bidule', 'chuck norris'],
conversationList: ['machin', 'bidule', 'chuck norris'],
};
// fetchFollowing(1);
}
submitCompose() {
@ -27,9 +41,7 @@ export default class ContactsList extends React.PureComponent {
}
toggleList = () => {
console.log('toggle');
this.setState((state) => {
console.log('state.showList', state.showList);
return {
showList: !state.showList,
};
@ -38,19 +50,16 @@ export default class ContactsList extends React.PureComponent {
render() {
// return (
// <div >
// liste de contacts
// </div >
// );
const renderedList = this.state.contactList.forEach(elem => {
// const renderedList = 'la liste';
console.log('this.state.contactList', this.state.contactList);
const renderedList = this.state.contactList.map(elem => {
console.log('elem', elem);
return (
<li className='contact-item'>
{elem}
<li className='contact-item'> {elem}
</li >
);
});
const classList = 'btn btn-primary toggle-list ' + (this.state.showList ? 'active' : 'inactive');
return (
<div className='messaging-container'>
<div className='messaging-box'>
@ -60,16 +69,21 @@ export default class ContactsList extends React.PureComponent {
className='fa fa-envelope column-header__icon fa-fw'
/>
Messaging box
</div >
<div className='user-list column-header'>
<h2 className='title'>la liste de {this.state.contactList.lengh} contacts
<div className='user-list'>
<h2 className='title'>
la liste de {this.state.following_count} contacts
<button
className='btn btn-primary'
className={classList}
onClick={this.toggleList}
>
<i className='fa fa-caret-up' />
{this.state.showList && (
<i className='fa fa-caret-up' />
)}
{!this.state.showList && (
<i className='fa fa-caret-left' />
)}
</button >
</h2 >
{this.state.showList && (

View File

@ -25,5 +25,5 @@ export const usePendingItems = getMeta('use_pending_items');
export const showTrends = getMeta('trends');
export const title = getMeta('title');
export const cropImages = getMeta('crop_images');
console.log('initialState', initialState);
export default initialState;

View File

@ -1,9 +1,10 @@
import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
import { Map as ImmutableMap, fromJS } from 'immutable';
import { fromJS, Map as ImmutableMap } from 'immutable';
const initialState = ImmutableMap();
const normalizeAccount = (state, account) => {
console.log('account', account);
account = { ...account };
delete account.followers_count;
@ -22,7 +23,7 @@ const normalizeAccounts = (state, accounts) => {
};
export default function accounts(state = initialState, action) {
switch(action.type) {
switch (action.type) {
case ACCOUNT_IMPORT:
return normalizeAccount(state, action.account);
case ACCOUNTS_IMPORT:

View File

@ -141,7 +141,7 @@
position: fixed;
bottom: 0;
left: 1em;
width: 268px;
width: 32vw;
z-index: 10;
text-align: right;

View File

@ -26,10 +26,37 @@ $messagingBoxHeight: 20em;
right: 1em;
width: $messagingBoxWidth;
background: $ui-base-color;
height: 80%;
color: white;
.messager-textarea {
width: 100%;
}
.title {
color: white;
}
}
.contact-list {
display: block;
padding: 1em;
min-height: 5em;
list-style-type: none;
color: white;
}
.toggle-list {
float: right;
margin-left: 1em;
background: $ui-primary-color;
border: 0;
padding: .5em;
&.active {
background: $highlight-text-color;
}
}
.conversation {

View File

@ -2333,6 +2333,9 @@ a.account__display-name {
.columns-area__panels__pane--navigational {
display: none;
}
.getting-started__footer{
width: 250px;
}
}
@media screen and (min-width: 600px + (285px * 2) + (10px * 2)) {