From d1ca0f69a81a5daaaace361682af3ea0fe470100 Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Mon, 6 Jan 2020 20:50:36 +0100 Subject: [PATCH] :zap: list fake contacts --- app/javascript/mastodon/actions/accounts.js | 62 ++++---- app/javascript/mastodon/actions/compose.js | 132 ++++++++-------- .../containers/compose_form_container.js | 46 +++--- .../mastodon/features/following/index.js | 65 ++++---- .../features/ui/components/columns_area.js | 2 + .../features/ui/components/compose_panel.js | 2 +- .../features/ui/components/link_footer.js | 142 ++++++++++-------- .../ui/components/messaging/contacts-list.js | 52 ++++--- app/javascript/mastodon/initial_state.js | 2 +- app/javascript/mastodon/reducers/accounts.js | 5 +- app/javascript/styles/bliss/footer.scss | 2 +- app/javascript/styles/bliss/messaging.scss | 27 ++++ .../styles/mastodon/components.scss | 3 + 13 files changed, 304 insertions(+), 238 deletions(-) diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index d4a824e2c..ad77dfb6f 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -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)); diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index c3c6ff1a1..f4d987294 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -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) { diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js index 37a0e8845..4f4d5f5d4 100644 --- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js +++ b/app/javascript/mastodon/features/compose/containers/compose_form_container.js @@ -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)); }, diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index 284ae2c11..fc13aa7d3 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -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 ( - + - + ); } if (!accountIds) { return ( - + - + ); } - const emptyMessage = blockedBy ? : ; + const emptyMessage = blockedBy ? : ; return ( - + } + prepend={} alwaysPrepend emptyMessage={emptyMessage} bindToDocument={!multiColumn} > {blockedBy ? [] : accountIds.map(id => - + , )} - - + + ); } diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js index 76541ca03..e0f15313a 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -222,7 +222,9 @@ class ColumnsArea extends ImmutablePureComponent {
+
+
diff --git a/app/javascript/mastodon/features/ui/components/compose_panel.js b/app/javascript/mastodon/features/ui/components/compose_panel.js index efc4ea0f8..639310995 100644 --- a/app/javascript/mastodon/features/ui/components/compose_panel.js +++ b/app/javascript/mastodon/features/ui/components/compose_panel.js @@ -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 = () => (
diff --git a/app/javascript/mastodon/features/ui/components/link_footer.js b/app/javascript/mastodon/features/ui/components/link_footer.js index d263fd86e..dd89aee0c 100644 --- a/app/javascript/mastodon/features/ui/components/link_footer.js +++ b/app/javascript/mastodon/features/ui/components/link_footer.js @@ -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 {
- {/*// TODO*/} - {/**/} + // TODO + {this.state.enableChristmasSnow && (
Joyeuses fêtes!
- {isStaff && ( - - - Trending hashtags - - )} -
-
)} + {isStaff && ( + + + + Trending hashtags + + )} +
+
-
    - - {invitesEnabled &&
  • · -
  • } + {invitesEnabled && ( +
  • + + · +
  • + )} {withHotkeys &&
  • { - 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 ( - //
    - // liste de contacts - //
    - // ); - - 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 ( -
  • - {elem} +
  • {elem}
  • ); }); + const classList = 'btn btn-primary toggle-list ' + (this.state.showList ? 'active' : 'inactive'); return (
    @@ -60,16 +69,21 @@ export default class ContactsList extends React.PureComponent { className='fa fa-envelope column-header__icon fa-fw' /> Messaging box -
    -
    -

    la liste de {this.state.contactList.lengh} contacts +
    +

    + la liste de {this.state.following_count} contacts

    {this.state.showList && ( diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 1134c55db..e691b2f38 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -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; diff --git a/app/javascript/mastodon/reducers/accounts.js b/app/javascript/mastodon/reducers/accounts.js index 530ed8e60..cbb5b49b2 100644 --- a/app/javascript/mastodon/reducers/accounts.js +++ b/app/javascript/mastodon/reducers/accounts.js @@ -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: diff --git a/app/javascript/styles/bliss/footer.scss b/app/javascript/styles/bliss/footer.scss index e325bd161..0d5cc445b 100644 --- a/app/javascript/styles/bliss/footer.scss +++ b/app/javascript/styles/bliss/footer.scss @@ -141,7 +141,7 @@ position: fixed; bottom: 0; left: 1em; - width: 268px; + width: 32vw; z-index: 10; text-align: right; diff --git a/app/javascript/styles/bliss/messaging.scss b/app/javascript/styles/bliss/messaging.scss index fb2f030b2..0d15eee8a 100644 --- a/app/javascript/styles/bliss/messaging.scss +++ b/app/javascript/styles/bliss/messaging.scss @@ -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 { diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 4c7ce9ba7..f44265606 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -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)) {