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

View File

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

View File

@ -2,62 +2,62 @@ import { connect } from 'react-redux';
import ComposeForm from '../components/compose_form'; import ComposeForm from '../components/compose_form';
import { import {
changeCompose, changeCompose,
submitCompose, changeComposeSpoilerText,
clearComposeSuggestions, clearComposeSuggestions,
fetchComposeSuggestions, fetchComposeSuggestions,
selectComposeSuggestion,
changeComposeSpoilerText,
insertEmojiCompose, insertEmojiCompose,
selectComposeSuggestion,
submitCompose,
uploadCompose, uploadCompose,
} from '../../../actions/compose'; } from '../../../actions/compose';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
text: state.getIn(['compose', 'text']), text : state.getIn(['compose', 'text']),
suggestions: state.getIn(['compose', 'suggestions']), suggestions : state.getIn(['compose', 'suggestions']),
spoiler: state.getIn(['compose', 'spoiler']), spoiler : state.getIn(['compose', 'spoiler']),
spoilerText: state.getIn(['compose', 'spoiler_text']), spoilerText : state.getIn(['compose', 'spoiler_text']),
privacy: state.getIn(['compose', 'privacy']), privacy : state.getIn(['compose', 'privacy']),
focusDate: state.getIn(['compose', 'focusDate']), focusDate : state.getIn(['compose', 'focusDate']),
caretPosition: state.getIn(['compose', 'caretPosition']), caretPosition : state.getIn(['compose', 'caretPosition']),
preselectDate: state.getIn(['compose', 'preselectDate']), preselectDate : state.getIn(['compose', 'preselectDate']),
isSubmitting: state.getIn(['compose', 'is_submitting']), isSubmitting : state.getIn(['compose', 'is_submitting']),
isChangingUpload: state.getIn(['compose', 'is_changing_upload']), isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
isUploading: state.getIn(['compose', 'is_uploading']), isUploading : state.getIn(['compose', 'is_uploading']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), showSearch : state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, anyMedia : state.getIn(['compose', 'media_attachments']).size > 0,
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
onChange (text) { onChange(text) {
dispatch(changeCompose(text)); dispatch(changeCompose(text));
}, },
onSubmit (router) { onSubmit(router) {
dispatch(submitCompose(router)); dispatch(submitCompose(router));
}, },
onClearSuggestions () { onClearSuggestions() {
dispatch(clearComposeSuggestions()); dispatch(clearComposeSuggestions());
}, },
onFetchSuggestions (token) { onFetchSuggestions(token) {
dispatch(fetchComposeSuggestions(token)); dispatch(fetchComposeSuggestions(token));
}, },
onSuggestionSelected (position, token, suggestion, path) { onSuggestionSelected(position, token, suggestion, path) {
dispatch(selectComposeSuggestion(position, token, suggestion, path)); dispatch(selectComposeSuggestion(position, token, suggestion, path));
}, },
onChangeSpoilerText (checked) { onChangeSpoilerText(checked) {
dispatch(changeComposeSpoilerText(checked)); dispatch(changeComposeSpoilerText(checked));
}, },
onPaste (files) { onPaste(files) {
dispatch(uploadCompose(files)); dispatch(uploadCompose(files));
}, },
onPickEmoji (position, data, needsSpace) { onPickEmoji(position, data, needsSpace) {
dispatch(insertEmojiCompose(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 ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator'; import LoadingIndicator from '../../components/loading_indicator';
import { import { expandFollowing, fetchAccount, fetchFollowing } from '../../actions/accounts';
fetchAccount,
fetchFollowing,
expandFollowing,
} from '../../actions/accounts';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../containers/account_container'; import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column'; import Column from '../ui/components/column';
@ -19,34 +15,34 @@ import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator'; import MissingIndicator from 'mastodon/components/missing_indicator';
const mapStateToProps = (state, props) => ({ 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']), accountIds: state.getIn(['user_lists', 'following', props.params.accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', props.params.accountId, 'next']), hasMore : !!state.getIn(['user_lists', 'following', props.params.accountId, 'next']),
blockedBy: state.getIn(['relationships', props.params.accountId, 'blocked_by'], false), blockedBy : state.getIn(['relationships', props.params.accountId, 'blocked_by'], false),
}); });
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class Following extends ImmutablePureComponent { class Following extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params : PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch : PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func, shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list, accountIds : ImmutablePropTypes.list,
hasMore: PropTypes.bool, hasMore : PropTypes.bool,
blockedBy: PropTypes.bool, blockedBy : PropTypes.bool,
isAccount: PropTypes.bool, isAccount : PropTypes.bool,
multiColumn: PropTypes.bool, multiColumn : PropTypes.bool,
}; };
componentWillMount () { componentWillMount() {
if (!this.props.accountIds) { if (!this.props.accountIds) {
this.props.dispatch(fetchAccount(this.props.params.accountId)); this.props.dispatch(fetchAccount(this.props.params.accountId));
this.props.dispatch(fetchFollowing(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) { if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(nextProps.params.accountId)); this.props.dispatch(fetchAccount(nextProps.params.accountId));
this.props.dispatch(fetchFollowing(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)); this.props.dispatch(expandFollowing(this.props.params.accountId));
}, 300, { leading: true }); }, 300, { leading: true });
render () { render() {
const { shouldUpdateScroll, accountIds, hasMore, blockedBy, isAccount, multiColumn } = this.props; const { shouldUpdateScroll, accountIds, hasMore, blockedBy, isAccount, multiColumn } = this.props;
if (!isAccount) { if (!isAccount) {
return ( return (
<Column> <Column >
<MissingIndicator /> <MissingIndicator />
</Column> </Column >
); );
} }
if (!accountIds) { if (!accountIds) {
return ( return (
<Column> <Column >
<LoadingIndicator /> <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 ( return (
<Column> <Column >
<ColumnBackButton multiColumn={multiColumn} /> <ColumnBackButton multiColumn={multiColumn} />
<ScrollableList <ScrollableList
@ -87,16 +89,23 @@ class Following extends ImmutablePureComponent {
hasMore={hasMore} hasMore={hasMore}
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll} shouldUpdateScroll={shouldUpdateScroll}
prepend={<HeaderContainer accountId={this.props.params.accountId} hideTabs />} prepend={<HeaderContainer
accountId={this.props.params.accountId}
hideTabs
/>}
alwaysPrepend alwaysPrepend
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{blockedBy ? [] : accountIds.map(id => {blockedBy ? [] : accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} /> <AccountContainer
key={id}
id={id}
withNote={false}
/>,
)} )}
</ScrollableList> </ScrollableList >
</Column> </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 columns-area__panels__pane--compositional'>
<div className='columns-area__panels__pane__inner'> <div className='columns-area__panels__pane__inner'>
<ComposePanel /> <ComposePanel />
</div > </div >
</div > </div >
<div className='columns-area__panels__main'> <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 NavigationContainer from 'mastodon/features/compose/containers/navigation_container';
import InstantMessaging from './messaging/instantMessaging'; import InstantMessaging from './messaging/instantMessaging';
const showIM = false; const showIM = true;
const ComposePanel = () => ( const ComposePanel = () => (
<div className='compose-panel'> <div className='compose-panel'>
<SearchContainer openInRoute /> <SearchContainer openInRoute />

View File

@ -23,22 +23,26 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
}, },
}); });
// const themeIsDark = true;
// const displaythemetoggler = true; // const displaythemetoggler = true;
export default @injectIntl export default @injectIntl
@connect(null, mapDispatchToProps) @connect(null, mapDispatchToProps)
class LinkFooter extends React.PureComponent { class LinkFooter extends React.PureComponent {
static propTypes = { static propTypes = {
enableChristmasSnow: PropTypes.bool, enableChristmasSnow : PropTypes.bool,
snowActive : PropTypes.bool, minimumWeekToShowSnow: PropTypes.number,
withHotkeys : PropTypes.bool, snowActive : PropTypes.bool,
snow : PropTypes.func, withHotkeys : PropTypes.bool,
onLogout : PropTypes.func.isRequired, snow : PropTypes.func,
intl : PropTypes.object.isRequired, themeIsDark : PropTypes.bool,
theme : PropTypes.string,
onLogout : PropTypes.func.isRequired,
intl : PropTypes.object.isRequired,
}; };
static defaultProps = { static defaultProps = {
enableChristmasSnow: true, enableChristmasSnow : true,
themeIsDark : true,
minimumWeekToShowSnow: 48,
}; };
handleLogoutClick = e => { handleLogoutClick = e => {
@ -60,9 +64,12 @@ class LinkFooter extends React.PureComponent {
var weekNumber = (new Date()).getWeek(); var weekNumber = (new Date()).getWeek();
// display snow during the last two weeks of the year // display snow during the last two weeks of the year
console.log('week', weekNumber); 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 // make snow effect
if (shouldWeDisplaySnow) { if (shouldWeDisplaySnow) {
@ -84,12 +91,11 @@ class LinkFooter extends React.PureComponent {
if (this.state.snow) { if (this.state.snow) {
if (this.state.snowActive) { if (this.state.snowActive) {
this.state.snow.stop(); this.state.snow.stop();
this.state.snowActive = false; this.state.enableChristmasSnow = false;
} else { } else {
this.state.snow.start(); this.state.snow.start();
this.state.snowActive = true; this.state.enableChristmasSnow = true;
} }
} }
}; };
@ -99,7 +105,7 @@ class LinkFooter extends React.PureComponent {
render() { render() {
const { withHotkeys } = this.props; 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 ( return (
@ -107,24 +113,24 @@ class LinkFooter extends React.PureComponent {
<div className='extras'> <div className='extras'>
{/*// TODO*/} // TODO
{/*<button className='mod-theme btn btn-block'>*/} <button className='mod-theme btn btn-block'>
{/* {themeIsDark ? (*/} {this.themeIsDark ? (
{/* <span*/} <span
{/* onClick={this.changeTheme('light')}*/} onClick={this.setState('theme', 'light')}
{/* title='set light'*/} title='set light'
{/* >*/} >
{/* <i className='fa fa-pencil-o' />*/} <i className='fa fa-pencil-o' /> to light
{/* </span >*/} </span >
{/* ) : (*/} ) : (
{/* <span*/} <span
{/* onClick={this.changeTheme('dark')}*/} onClick={this.changeTheme('dark')}
{/* title='set dark'*/} title='set dark'
{/* >*/} >
{/* <i className='fa fa-pencil' />*/} <i className='fa fa-pencil' /> to dark
{/* </span >*/} </span >
{/* )}*/} )}
{/*</button >*/} </button >
{this.state.enableChristmasSnow && ( {this.state.enableChristmasSnow && (
<div <div
@ -138,45 +144,49 @@ class LinkFooter extends React.PureComponent {
/> />
</div > </div >
<div > Joyeuses fêtes!</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 > </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 > </div >
<ul > <ul >
{invitesEnabled && (
{invitesEnabled && <li ><a <li >
href='/invites' <a
target='_blank' href='/invites'
><FormattedMessage target='_blank'
id='getting_started.invite' >
defaultMessage='Invite people' <FormattedMessage
/> ·</a > id='getting_started.invite'
</li >} defaultMessage='Invite people'
/> ·</a >
</li >
)}
{withHotkeys && <li ><Link to='/keyboard-shortcuts'> {withHotkeys && <li ><Link to='/keyboard-shortcuts'>
<FormattedMessage <FormattedMessage
id='navigation_bar.keyboard_shortcuts' id='navigation_bar.keyboard_shortcuts'

View File

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

View File

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

View File

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

View File

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

View File

@ -26,10 +26,37 @@ $messagingBoxHeight: 20em;
right: 1em; right: 1em;
width: $messagingBoxWidth; width: $messagingBoxWidth;
background: $ui-base-color; background: $ui-base-color;
height: 80%;
color: white;
.messager-textarea { .messager-textarea {
width: 100%; 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 { .conversation {

View File

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