diff --git a/.gitignore b/.gitignore index d314bca08..8cdcc8d27 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ /db/*.sqlite3-journal # Ignore all logfiles and tempfiles. +.eslintcache /log/* !/log/.keep /tmp diff --git a/AUTHORS.md b/AUTHORS.md index 5f5985fba..a03aaf7ca 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -3,6 +3,7 @@ Authors Mastodon is available on [GitHub](https://github.com/tootsuite/mastodon) and provided thanks to the work of the following contributors: +* [Tykayn](https://framagit.org/tykayn) for the Bliss version * [Gargron](https://github.com/Gargron) * [ThibG](https://github.com/ThibG) diff --git a/Gemfile b/Gemfile index 43696f461..3a0161c45 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,8 @@ ruby '>= 2.4.0', '< 2.7.0' gem 'pkg-config', '~> 1.4' gem 'puma', '~> 4.3' -gem 'rails', '~> 5.2.3' +gem 'rails', '~> 5.2.4' +gem 'sprockets', '~> 3.7' gem 'thor', '~> 0.20' gem 'hamlit-rails', '~> 0.2' @@ -122,7 +123,7 @@ group :test do gem 'rspec-sidekiq', '~> 3.0' gem 'simplecov', '~> 0.17', require: false gem 'webmock', '~> 3.7' - gem 'parallel_tests', '~> 2.29' + gem 'parallel_tests', '~> 2.30' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index b68bcccfb..1aea709e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,25 +44,25 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (5.2.4) + actionpack (= 5.2.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailer (5.2.4) + actionpack (= 5.2.4) + actionview (= 5.2.4) + activejob (= 5.2.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) + actionpack (5.2.4) + actionview (= 5.2.4) + activesupport (= 5.2.4) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + actionview (5.2.4) + activesupport (= 5.2.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -73,20 +73,20 @@ GEM case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) active_record_query_trace (1.7) - activejob (5.2.3) - activesupport (= 5.2.3) + activejob (5.2.4) + activesupport (= 5.2.4) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) + activemodel (5.2.4) + activesupport (= 5.2.4) + activerecord (5.2.4) + activemodel (= 5.2.4) + activesupport (= 5.2.4) arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) + activestorage (5.2.4) + actionpack (= 5.2.4) + activerecord (= 5.2.4) marcel (~> 0.3.1) - activesupport (5.2.3) + activesupport (5.2.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -218,7 +218,7 @@ GEM docile (1.3.2) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.2.2) + doorkeeper (5.2.3) railties (>= 5) dotenv (2.7.5) dotenv-rails (2.7.5) @@ -238,9 +238,9 @@ GEM erubi (1.9.0) et-orbi (1.1.6) tzinfo - excon (0.62.0) + excon (0.71.0) fabrication (2.21.0) - faker (2.8.0) + faker (2.8.1) i18n (>= 1.6, < 1.8) faraday (0.15.4) multipart-post (>= 1.2, < 3) @@ -324,7 +324,7 @@ GEM jmespath (1.4.0) json (2.2.0) json-canonicalization (0.1.0) - json-ld-preloaded (3.0.4) + json-ld-preloaded (3.0.6) json-ld (~> 3.0) multi_json (~> 1.12) rdf (~> 3.0) @@ -380,7 +380,7 @@ GEM mini_portile2 (2.4.0) minitest (5.13.0) msgpack (1.3.1) - multi_json (1.13.1) + multi_json (1.14.1) multipart-post (2.1.1) necromancer (0.5.1) net-ldap (0.16.2) @@ -424,7 +424,7 @@ GEM av (~> 0.9.0) paperclip (>= 2.5.2) parallel (1.19.1) - parallel_tests (2.29.2) + parallel_tests (2.30.0) parallel parser (2.6.5.0) ast (~> 2.4.0) @@ -469,18 +469,18 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (5.2.4) + actioncable (= 5.2.4) + actionmailer (= 5.2.4) + actionpack (= 5.2.4) + actionview (= 5.2.4) + activejob (= 5.2.4) + activemodel (= 5.2.4) + activerecord (= 5.2.4) + activestorage (= 5.2.4) + activesupport (= 5.2.4) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 5.2.4) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -496,15 +496,15 @@ GEM railties (>= 5.0, < 6) rails-settings-cached (0.6.6) rails (>= 4.2.0) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + railties (5.2.4) + actionpack (= 5.2.4) + activesupport (= 5.2.4) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) rake (13.0.1) - rdf (3.0.12) + rdf (3.0.13) hamster (~> 3.0) link_header (~> 0.0, >= 0.0.8) rdf-normalize (0.3.3) @@ -615,7 +615,7 @@ GEM sshkit (1.20.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - stackprof (0.2.13) + stackprof (0.2.14) statsd-ruby (1.4.0) stoplight (2.2.0) streamio-ffmpeg (3.0.2) @@ -667,9 +667,9 @@ GEM webpush (0.3.8) hkdf (~> 0.2) jwt (~> 2.0) - websocket-driver (0.7.0) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) wisper (2.0.1) xpath (3.2.0) nokogiri (~> 1.8) @@ -753,7 +753,7 @@ DEPENDENCIES paperclip (~> 6.0) paperclip-av-transcoder (~> 0.6) parallel (~> 1.19) - parallel_tests (~> 2.29) + parallel_tests (~> 2.30) parslet pg (~> 1.1) pghero (~> 2.4) @@ -767,7 +767,7 @@ DEPENDENCIES pundit (~> 2.1) rack-attack (~> 6.2) rack-cors (~> 1.1) - rails (~> 5.2.3) + rails (~> 5.2.4) rails-controller-testing (~> 1.0) rails-i18n (~> 5.1) rails-settings-cached (~> 0.6) @@ -789,6 +789,7 @@ DEPENDENCIES simple-navigation (~> 4.1) simple_form (~> 5.0) simplecov (~> 0.17) + sprockets (~> 3.7) sprockets-rails (~> 3.2) stackprof stoplight (~> 2.2.0) diff --git a/README.md b/README.md index 54a738c83..995c3911d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,23 @@ ![Mastodon](https://i.imgur.com/NhZc40l.png) ======== +# CipherBliss version of Mastodon + + +features: + +* liks to free tools +* snow fall during the end of the yar. + +## Todo +* proper responsive columning +* **instant Messaging** in the web front end. + + uses the api to get accounts + ```bash + GET /api/v1/accounts/[id of my account]/following + ``` + +======== [![GitHub release](https://img.shields.io/github/release/tootsuite/mastodon.svg)][releases] [![Build Status](https://img.shields.io/circleci/project/github/tootsuite/mastodon.svg)][circleci] @@ -72,7 +90,7 @@ Mastodon acts as an OAuth2 provider so 3rd party apps can use the REST and Strea - **Ruby** 2.4+ - **Node.js** 8+ -The repository includes deployment configurations for **Docker and docker-compose**, but also a few specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. The [**stand-alone** installation guide](https://docs.joinmastodon.org/administration/installation/) is available in the documentation. +The repository includes deployment configurations for **Docker and docker-compose**, but also a few specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. The [**stand-alone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation. A **Vagrant** configuration is included for development purposes. diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index d4a824e2c..b1b7b0678 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; @@ -118,29 +118,29 @@ export function fetchAccount(id) { dispatch(fetchAccountFail(id, error)); }); }; -}; +} export function fetchAccountRequest(id) { return { type: ACCOUNT_FETCH_REQUEST, id, }; -}; +} export function fetchAccountSuccess() { return { type: ACCOUNT_FETCH_SUCCESS, }; -}; +} export function fetchAccountFail(id, error) { return { - type: ACCOUNT_FETCH_FAIL, + type : ACCOUNT_FETCH_FAIL, id, error, skipAlert: true, }; -}; +} export function followAccount(id, reblogs = true) { return (dispatch, getState) => { @@ -155,7 +155,7 @@ export function followAccount(id, reblogs = true) { dispatch(followAccountFail(error, locked)); }); }; -}; +} export function unfollowAccount(id) { return (dispatch, getState) => { @@ -167,59 +167,59 @@ export function unfollowAccount(id) { dispatch(unfollowAccountFail(error)); }); }; -}; +} export function followAccountRequest(id, locked) { return { - type: ACCOUNT_FOLLOW_REQUEST, + type : ACCOUNT_FOLLOW_REQUEST, id, locked, skipLoading: true, }; -}; +} export function followAccountSuccess(relationship, alreadyFollowing) { return { - type: ACCOUNT_FOLLOW_SUCCESS, + type : ACCOUNT_FOLLOW_SUCCESS, relationship, alreadyFollowing, skipLoading: true, }; -}; +} export function followAccountFail(error, locked) { return { - type: ACCOUNT_FOLLOW_FAIL, + type : ACCOUNT_FOLLOW_FAIL, error, locked, skipLoading: true, }; -}; +} export function unfollowAccountRequest(id) { return { - type: ACCOUNT_UNFOLLOW_REQUEST, + type : ACCOUNT_UNFOLLOW_REQUEST, id, skipLoading: true, }; -}; +} export function unfollowAccountSuccess(relationship, statuses) { return { - type: ACCOUNT_UNFOLLOW_SUCCESS, + type : ACCOUNT_UNFOLLOW_SUCCESS, relationship, statuses, skipLoading: true, }; -}; +} export function unfollowAccountFail(error) { return { - type: ACCOUNT_UNFOLLOW_FAIL, + type : ACCOUNT_UNFOLLOW_FAIL, error, skipLoading: true, }; -}; +} export function blockAccount(id) { return (dispatch, getState) => { @@ -232,7 +232,7 @@ export function blockAccount(id) { dispatch(blockAccountFail(id, error)); }); }; -}; +} export function unblockAccount(id) { return (dispatch, getState) => { @@ -244,14 +244,14 @@ export function unblockAccount(id) { dispatch(unblockAccountFail(id, error)); }); }; -}; +} export function blockAccountRequest(id) { return { type: ACCOUNT_BLOCK_REQUEST, id, }; -}; +} export function blockAccountSuccess(relationship, statuses) { return { @@ -259,36 +259,35 @@ export function blockAccountSuccess(relationship, statuses) { relationship, statuses, }; -}; +} export function blockAccountFail(error) { return { type: ACCOUNT_BLOCK_FAIL, error, }; -}; +} export function unblockAccountRequest(id) { return { type: ACCOUNT_UNBLOCK_REQUEST, id, }; -}; +} export function unblockAccountSuccess(relationship) { return { type: ACCOUNT_UNBLOCK_SUCCESS, relationship, }; -}; +} export function unblockAccountFail(error) { return { type: ACCOUNT_UNBLOCK_FAIL, error, }; -}; - +} export function muteAccount(id, notifications) { return (dispatch, getState) => { @@ -301,7 +300,7 @@ export function muteAccount(id, notifications) { dispatch(muteAccountFail(id, error)); }); }; -}; +} export function unmuteAccount(id) { return (dispatch, getState) => { @@ -313,14 +312,14 @@ export function unmuteAccount(id) { dispatch(unmuteAccountFail(id, error)); }); }; -}; +} export function muteAccountRequest(id) { return { type: ACCOUNT_MUTE_REQUEST, id, }; -}; +} export function muteAccountSuccess(relationship, statuses) { return { @@ -328,36 +327,35 @@ export function muteAccountSuccess(relationship, statuses) { relationship, statuses, }; -}; +} export function muteAccountFail(error) { return { type: ACCOUNT_MUTE_FAIL, error, }; -}; +} export function unmuteAccountRequest(id) { return { type: ACCOUNT_UNMUTE_REQUEST, id, }; -}; +} export function unmuteAccountSuccess(relationship) { return { type: ACCOUNT_UNMUTE_SUCCESS, relationship, }; -}; +} export function unmuteAccountFail(error) { return { type: ACCOUNT_UNMUTE_FAIL, error, }; -}; - +} export function fetchFollowers(id) { return (dispatch, getState) => { @@ -373,14 +371,14 @@ export function fetchFollowers(id) { dispatch(fetchFollowersFail(id, error)); }); }; -}; +} export function fetchFollowersRequest(id) { return { type: FOLLOWERS_FETCH_REQUEST, id, }; -}; +} export function fetchFollowersSuccess(id, accounts, next) { return { @@ -389,7 +387,7 @@ export function fetchFollowersSuccess(id, accounts, next) { accounts, next, }; -}; +} export function fetchFollowersFail(id, error) { return { @@ -397,7 +395,7 @@ export function fetchFollowersFail(id, error) { id, error, }; -}; +} export function expandFollowers(id) { return (dispatch, getState) => { @@ -419,14 +417,14 @@ export function expandFollowers(id) { dispatch(expandFollowersFail(id, error)); }); }; -}; +} export function expandFollowersRequest(id) { return { type: FOLLOWERS_EXPAND_REQUEST, id, }; -}; +} export function expandFollowersSuccess(id, accounts, next) { return { @@ -435,7 +433,7 @@ export function expandFollowersSuccess(id, accounts, next) { accounts, next, }; -}; +} export function expandFollowersFail(id, error) { return { @@ -443,7 +441,7 @@ export function expandFollowersFail(id, error) { id, error, }; -}; +} export function fetchFollowing(id) { return (dispatch, getState) => { @@ -459,14 +457,14 @@ export function fetchFollowing(id) { dispatch(fetchFollowingFail(id, error)); }); }; -}; +} export function fetchFollowingRequest(id) { return { type: FOLLOWING_FETCH_REQUEST, id, }; -}; +} export function fetchFollowingSuccess(id, accounts, next) { return { @@ -475,7 +473,7 @@ export function fetchFollowingSuccess(id, accounts, next) { accounts, next, }; -}; +} export function fetchFollowingFail(id, error) { return { @@ -483,7 +481,7 @@ export function fetchFollowingFail(id, error) { id, error, }; -}; +} export function expandFollowing(id) { return (dispatch, getState) => { @@ -505,14 +503,14 @@ export function expandFollowing(id) { dispatch(expandFollowingFail(id, error)); }); }; -}; +} export function expandFollowingRequest(id) { return { type: FOLLOWING_EXPAND_REQUEST, id, }; -}; +} export function expandFollowingSuccess(id, accounts, next) { return { @@ -521,7 +519,7 @@ export function expandFollowingSuccess(id, accounts, next) { accounts, next, }; -}; +} export function expandFollowingFail(id, error) { return { @@ -529,7 +527,7 @@ export function expandFollowingFail(id, error) { id, error, }; -}; +} export function fetchRelationships(accountIds) { return (dispatch, getState) => { @@ -548,31 +546,31 @@ export function fetchRelationships(accountIds) { dispatch(fetchRelationshipsFail(error)); }); }; -}; +} export function fetchRelationshipsRequest(ids) { return { - type: RELATIONSHIPS_FETCH_REQUEST, + type : RELATIONSHIPS_FETCH_REQUEST, ids, skipLoading: true, }; -}; +} export function fetchRelationshipsSuccess(relationships) { return { - type: RELATIONSHIPS_FETCH_SUCCESS, + type : RELATIONSHIPS_FETCH_SUCCESS, relationships, skipLoading: true, }; -}; +} export function fetchRelationshipsFail(error) { return { - type: RELATIONSHIPS_FETCH_FAIL, + type : RELATIONSHIPS_FETCH_FAIL, error, skipLoading: true, }; -}; +} export function fetchFollowRequests() { return (dispatch, getState) => { @@ -584,13 +582,13 @@ export function fetchFollowRequests() { dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null)); }).catch(error => dispatch(fetchFollowRequestsFail(error))); }; -}; +} export function fetchFollowRequestsRequest() { return { type: FOLLOW_REQUESTS_FETCH_REQUEST, }; -}; +} export function fetchFollowRequestsSuccess(accounts, next) { return { @@ -598,14 +596,14 @@ export function fetchFollowRequestsSuccess(accounts, next) { accounts, next, }; -}; +} export function fetchFollowRequestsFail(error) { return { type: FOLLOW_REQUESTS_FETCH_FAIL, error, }; -}; +} export function expandFollowRequests() { return (dispatch, getState) => { @@ -623,13 +621,13 @@ export function expandFollowRequests() { dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null)); }).catch(error => dispatch(expandFollowRequestsFail(error))); }; -}; +} export function expandFollowRequestsRequest() { return { type: FOLLOW_REQUESTS_EXPAND_REQUEST, }; -}; +} export function expandFollowRequestsSuccess(accounts, next) { return { @@ -637,14 +635,14 @@ export function expandFollowRequestsSuccess(accounts, next) { accounts, next, }; -}; +} export function expandFollowRequestsFail(error) { return { type: FOLLOW_REQUESTS_EXPAND_FAIL, error, }; -}; +} export function authorizeFollowRequest(id) { return (dispatch, getState) => { @@ -655,21 +653,21 @@ export function authorizeFollowRequest(id) { .then(() => dispatch(authorizeFollowRequestSuccess(id))) .catch(error => dispatch(authorizeFollowRequestFail(id, error))); }; -}; +} export function authorizeFollowRequestRequest(id) { return { type: FOLLOW_REQUEST_AUTHORIZE_REQUEST, id, }; -}; +} export function authorizeFollowRequestSuccess(id) { return { type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS, id, }; -}; +} export function authorizeFollowRequestFail(id, error) { return { @@ -677,8 +675,7 @@ export function authorizeFollowRequestFail(id, error) { id, error, }; -}; - +} export function rejectFollowRequest(id) { return (dispatch, getState) => { @@ -689,21 +686,21 @@ export function rejectFollowRequest(id) { .then(() => dispatch(rejectFollowRequestSuccess(id))) .catch(error => dispatch(rejectFollowRequestFail(id, error))); }; -}; +} export function rejectFollowRequestRequest(id) { return { type: FOLLOW_REQUEST_REJECT_REQUEST, id, }; -}; +} export function rejectFollowRequestSuccess(id) { return { type: FOLLOW_REQUEST_REJECT_SUCCESS, id, }; -}; +} export function rejectFollowRequestFail(id, error) { return { @@ -711,7 +708,7 @@ export function rejectFollowRequestFail(id, error) { id, error, }; -}; +} export function pinAccount(id) { return (dispatch, getState) => { @@ -723,7 +720,7 @@ export function pinAccount(id) { dispatch(pinAccountFail(error)); }); }; -}; +} export function unpinAccount(id) { return (dispatch, getState) => { @@ -735,46 +732,46 @@ export function unpinAccount(id) { dispatch(unpinAccountFail(error)); }); }; -}; +} export function pinAccountRequest(id) { return { type: ACCOUNT_PIN_REQUEST, id, }; -}; +} export function pinAccountSuccess(relationship) { return { type: ACCOUNT_PIN_SUCCESS, relationship, }; -}; +} export function pinAccountFail(error) { return { type: ACCOUNT_PIN_FAIL, error, }; -}; +} export function unpinAccountRequest(id) { return { type: ACCOUNT_UNPIN_REQUEST, id, }; -}; +} export function unpinAccountSuccess(relationship) { return { type: ACCOUNT_UNPIN_SUCCESS, relationship, }; -}; +} export function unpinAccountFail(error) { return { type: ACCOUNT_UNPIN_FAIL, error, }; -}; +} diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index c3c6ff1a1..e80f33526 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); @@ -76,57 +75,57 @@ export function changeCompose(text) { type: COMPOSE_CHANGE, text: text, }; -}; +} export function replyCompose(status, routerHistory) { return (dispatch, getState) => { dispatch({ - type: COMPOSE_REPLY, + type : COMPOSE_REPLY, status: status, }); ensureComposeIsVisible(getState, routerHistory); }; -}; +} export function cancelReplyCompose() { return { type: COMPOSE_REPLY_CANCEL, }; -}; +} export function resetCompose() { return { type: COMPOSE_RESET, }; -}; +} export function mentionCompose(account, routerHistory) { return (dispatch, getState) => { dispatch({ - type: COMPOSE_MENTION, + type : COMPOSE_MENTION, account: account, }); ensureComposeIsVisible(getState, routerHistory); }; -}; +} export function directCompose(account, routerHistory) { return (dispatch, getState) => { dispatch({ - type: COMPOSE_DIRECT, + type : COMPOSE_DIRECT, account: account, }); ensureComposeIsVisible(getState, 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']), @@ -179,33 +178,33 @@ export function submitCompose(routerHistory) { dispatch(submitComposeFail(error)); }); }; -}; +} export function submitComposeRequest() { return { type: COMPOSE_SUBMIT_REQUEST, }; -}; +} 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, }; -}; +} 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,15 +230,16 @@ 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))); - }; + } + }; -}; +} export function changeUploadCompose(id, params) { return (dispatch, getState) => { @@ -251,68 +251,69 @@ export function changeUploadCompose(id, params) { dispatch(changeUploadComposeFail(id, error)); }); }; -}; +} 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, }; -}; +} export function clearComposeSuggestions() { if (cancelFetchComposeSuggestionsAccounts) { @@ -321,7 +322,7 @@ export function clearComposeSuggestions() { return { type: COMPOSE_SUGGESTIONS_CLEAR, }; -}; +} const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => { if (cancelFetchComposeSuggestionsAccounts) { @@ -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 }) => { @@ -395,7 +396,7 @@ export function fetchComposeSuggestions(token) { break; } }; -}; +} export function readyComposeSuggestionsEmojis(token, emojis) { return { @@ -403,7 +404,7 @@ export function readyComposeSuggestionsEmojis(token, emojis) { token, emojis, }; -}; +} export function readyComposeSuggestionsAccounts(token, accounts) { return { @@ -411,7 +412,7 @@ export function readyComposeSuggestionsAccounts(token, accounts) { token, accounts, }; -}; +} export const readyComposeSuggestionsTags = (token, tags) => ({ type: COMPOSE_SUGGESTIONS_READY, @@ -424,27 +425,27 @@ 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, path, }); }; -}; +} export function updateSuggestionTags(token) { return { @@ -492,39 +493,39 @@ export function mountCompose() { return { type: COMPOSE_MOUNT, }; -}; +} export function unmountCompose() { return { type: COMPOSE_UNMOUNT, }; -}; +} export function changeComposeSensitivity() { return { type: COMPOSE_SENSITIVITY_CHANGE, }; -}; +} export function changeComposeSpoilerness() { return { type: COMPOSE_SPOILERNESS_CHANGE, }; -}; +} export function changeComposeSpoilerText(text) { return { type: COMPOSE_SPOILER_TEXT_CHANGE, text, }; -}; +} export function changeComposeVisibility(value) { return { type: COMPOSE_VISIBILITY_CHANGE, value, }; -}; +} export function insertEmojiCompose(position, emoji, needsSpace) { return { @@ -533,33 +534,33 @@ export function insertEmojiCompose(position, emoji, needsSpace) { emoji, needsSpace, }; -}; +} export function changeComposing(value) { return { type: COMPOSE_COMPOSING_CHANGE, value, }; -}; +} export function addPoll() { return { type: COMPOSE_POLL_ADD, }; -}; +} export function removePoll() { return { type: COMPOSE_POLL_REMOVE, }; -}; +} export function addPollOption(title) { return { type: COMPOSE_POLL_OPTION_ADD, title, }; -}; +} export function changePollOption(index, title) { return { @@ -567,14 +568,14 @@ export function changePollOption(index, title) { index, title, }; -}; +} export function removePollOption(index) { return { type: COMPOSE_POLL_OPTION_REMOVE, index, }; -}; +} export function changePollSettings(expiresIn, isMultiple) { return { @@ -582,4 +583,4 @@ export function changePollSettings(expiresIn, isMultiple) { expiresIn, isMultiple, }; -}; +} diff --git a/app/javascript/mastodon/actions/conversations.js b/app/javascript/mastodon/actions/conversations.js index 4ef654b1f..2027fcb68 100644 --- a/app/javascript/mastodon/actions/conversations.js +++ b/app/javascript/mastodon/actions/conversations.js @@ -1,23 +1,19 @@ import api, { getLinks } from '../api'; -import { - importFetchedAccounts, - importFetchedStatuses, - importFetchedStatus, -} from './importer'; +import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer'; -export const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT'; +export const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT'; export const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT'; export const CONVERSATIONS_FETCH_REQUEST = 'CONVERSATIONS_FETCH_REQUEST'; export const CONVERSATIONS_FETCH_SUCCESS = 'CONVERSATIONS_FETCH_SUCCESS'; -export const CONVERSATIONS_FETCH_FAIL = 'CONVERSATIONS_FETCH_FAIL'; -export const CONVERSATIONS_UPDATE = 'CONVERSATIONS_UPDATE'; +export const CONVERSATIONS_FETCH_FAIL = 'CONVERSATIONS_FETCH_FAIL'; +export const CONVERSATIONS_UPDATE = 'CONVERSATIONS_UPDATE'; export const CONVERSATIONS_READ = 'CONVERSATIONS_READ'; export const CONVERSATIONS_DELETE_REQUEST = 'CONVERSATIONS_DELETE_REQUEST'; export const CONVERSATIONS_DELETE_SUCCESS = 'CONVERSATIONS_DELETE_SUCCESS'; -export const CONVERSATIONS_DELETE_FAIL = 'CONVERSATIONS_DELETE_FAIL'; +export const CONVERSATIONS_DELETE_FAIL = 'CONVERSATIONS_DELETE_FAIL'; export const mountConversations = () => ({ type: CONVERSATIONS_MOUNT, @@ -30,7 +26,7 @@ export const unmountConversations = () => ({ export const markConversationRead = conversationId => (dispatch, getState) => { dispatch({ type: CONVERSATIONS_READ, - id: conversationId, + id : conversationId, }); api(getState).post(`/api/v1/conversations/${conversationId}/read`); diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 06a19afc3..b2f0bf07d 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -3,31 +3,31 @@ import openDB from '../storage/db'; import { evictStatus } from '../storage/modifier'; import { deleteFromTimelines } from './timelines'; -import { importFetchedStatus, importFetchedStatuses, importAccount, importStatus } from './importer'; +import { importAccount, importFetchedStatus, importFetchedStatuses, importStatus } from './importer'; import { ensureComposeIsVisible } from './compose'; export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; -export const STATUS_FETCH_FAIL = 'STATUS_FETCH_FAIL'; +export const STATUS_FETCH_FAIL = 'STATUS_FETCH_FAIL'; export const STATUS_DELETE_REQUEST = 'STATUS_DELETE_REQUEST'; export const STATUS_DELETE_SUCCESS = 'STATUS_DELETE_SUCCESS'; -export const STATUS_DELETE_FAIL = 'STATUS_DELETE_FAIL'; +export const STATUS_DELETE_FAIL = 'STATUS_DELETE_FAIL'; export const CONTEXT_FETCH_REQUEST = 'CONTEXT_FETCH_REQUEST'; export const CONTEXT_FETCH_SUCCESS = 'CONTEXT_FETCH_SUCCESS'; -export const CONTEXT_FETCH_FAIL = 'CONTEXT_FETCH_FAIL'; +export const CONTEXT_FETCH_FAIL = 'CONTEXT_FETCH_FAIL'; export const STATUS_MUTE_REQUEST = 'STATUS_MUTE_REQUEST'; export const STATUS_MUTE_SUCCESS = 'STATUS_MUTE_SUCCESS'; -export const STATUS_MUTE_FAIL = 'STATUS_MUTE_FAIL'; +export const STATUS_MUTE_FAIL = 'STATUS_MUTE_FAIL'; export const STATUS_UNMUTE_REQUEST = 'STATUS_UNMUTE_REQUEST'; export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS'; -export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL'; +export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL'; export const STATUS_REVEAL = 'STATUS_REVEAL'; -export const STATUS_HIDE = 'STATUS_HIDE'; +export const STATUS_HIDE = 'STATUS_HIDE'; export const REDRAFT = 'REDRAFT'; @@ -37,7 +37,7 @@ export function fetchStatusRequest(id, skipLoading) { id, skipLoading, }; -}; +} function getFromDB(dispatch, getState, accountIndex, index, id) { return new Promise((resolve, reject) => { @@ -113,24 +113,24 @@ export function fetchStatus(id) { dispatch(fetchStatusFail(id, error, skipLoading)); }); }; -}; +} export function fetchStatusSuccess(skipLoading) { return { type: STATUS_FETCH_SUCCESS, skipLoading, }; -}; +} export function fetchStatusFail(id, error, skipLoading) { return { - type: STATUS_FETCH_FAIL, + type : STATUS_FETCH_FAIL, id, error, skipLoading, skipAlert: true, }; -}; +} export function redraft(status, raw_text) { return { @@ -138,7 +138,7 @@ export function redraft(status, raw_text) { status, raw_text, }; -}; +} export function deleteStatus(id, routerHistory, withRedraft = false) { return (dispatch, getState) => { @@ -163,29 +163,29 @@ export function deleteStatus(id, routerHistory, withRedraft = false) { dispatch(deleteStatusFail(id, error)); }); }; -}; +} export function deleteStatusRequest(id) { return { type: STATUS_DELETE_REQUEST, - id: id, + id : id, }; -}; +} export function deleteStatusSuccess(id) { return { type: STATUS_DELETE_SUCCESS, - id: id, + id : id, }; -}; +} export function deleteStatusFail(id, error) { return { - type: STATUS_DELETE_FAIL, - id: id, + type : STATUS_DELETE_FAIL, + id : id, error: error, }; -}; +} export function fetchContext(id) { return (dispatch, getState) => { @@ -203,33 +203,33 @@ export function fetchContext(id) { dispatch(fetchContextFail(id, error)); }); }; -}; +} export function fetchContextRequest(id) { return { type: CONTEXT_FETCH_REQUEST, id, }; -}; +} export function fetchContextSuccess(id, ancestors, descendants) { return { - type: CONTEXT_FETCH_SUCCESS, + type : CONTEXT_FETCH_SUCCESS, id, ancestors, descendants, statuses: ancestors.concat(descendants), }; -}; +} export function fetchContextFail(id, error) { return { - type: CONTEXT_FETCH_FAIL, + type : CONTEXT_FETCH_FAIL, id, error, skipAlert: true, }; -}; +} export function muteStatus(id) { return (dispatch, getState) => { @@ -241,21 +241,21 @@ export function muteStatus(id) { dispatch(muteStatusFail(id, error)); }); }; -}; +} export function muteStatusRequest(id) { return { type: STATUS_MUTE_REQUEST, id, }; -}; +} export function muteStatusSuccess(id) { return { type: STATUS_MUTE_SUCCESS, id, }; -}; +} export function muteStatusFail(id, error) { return { @@ -263,7 +263,7 @@ export function muteStatusFail(id, error) { id, error, }; -}; +} export function unmuteStatus(id) { return (dispatch, getState) => { @@ -275,21 +275,21 @@ export function unmuteStatus(id) { dispatch(unmuteStatusFail(id, error)); }); }; -}; +} export function unmuteStatusRequest(id) { return { type: STATUS_UNMUTE_REQUEST, id, }; -}; +} export function unmuteStatusSuccess(id) { return { type: STATUS_UNMUTE_SUCCESS, id, }; -}; +} export function unmuteStatusFail(id, error) { return { @@ -297,7 +297,7 @@ export function unmuteStatusFail(id, error) { id, error, }; -}; +} export function hideStatus(ids) { if (!Array.isArray(ids)) { @@ -308,7 +308,7 @@ export function hideStatus(ids) { type: STATUS_HIDE, ids, }; -}; +} export function revealStatus(ids) { if (!Array.isArray(ids)) { @@ -319,4 +319,4 @@ export function revealStatus(ids) { type: STATUS_REVEAL, ids, }; -}; +} diff --git a/app/javascript/mastodon/components/account.js b/app/javascript/mastodon/components/account.js index 2705a6001..ab36fd472 100644 --- a/app/javascript/mastodon/components/account.js +++ b/app/javascript/mastodon/components/account.js @@ -37,27 +37,27 @@ class Account extends ImmutablePureComponent { handleFollow = () => { this.props.onFollow(this.props.account); - } + }; handleBlock = () => { this.props.onBlock(this.props.account); - } + }; handleMute = () => { this.props.onMute(this.props.account); - } + }; handleMuteNotifications = () => { this.props.onMuteNotifications(this.props.account, true); - } + }; handleUnmuteNotifications = () => { this.props.onMuteNotifications(this.props.account, false); - } + }; handleAction = () => { this.props.onActionClick(this.props.account); - } + }; render () { const { account, intl, hidden, onActionClick, actionIcon, actionTitle } = this.props; @@ -111,7 +111,10 @@ class Account extends ImmutablePureComponent {
-
+
diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/mastodon/components/avatar.js index 570505833..1cfc4897f 100644 --- a/app/javascript/mastodon/components/avatar.js +++ b/app/javascript/mastodon/components/avatar.js @@ -7,16 +7,16 @@ export default class Avatar extends React.PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, - size: PropTypes.number.isRequired, - style: PropTypes.object, - inline: PropTypes.bool, + size : PropTypes.number.isRequired, + style : PropTypes.object, + inline : PropTypes.bool, animate: PropTypes.bool, }; static defaultProps = { animate: autoPlayGif, - size: 20, - inline: false, + size : 20, + inline : false, }; state = { @@ -26,14 +26,14 @@ export default class Avatar extends React.PureComponent { handleMouseEnter = () => { if (this.props.animate) return; this.setState({ hovering: true }); - } + }; handleMouseLeave = () => { if (this.props.animate) return; this.setState({ hovering: false }); - } + }; - render () { + render() { const { account, size, animate, inline } = this.props; const { hovering } = this.state; @@ -48,8 +48,8 @@ export default class Avatar extends React.PureComponent { const style = { ...this.props.style, - width: `${size}px`, - height: `${size}px`, + width : `${size}px`, + height : `${size}px`, backgroundSize: `${size}px ${size}px`, }; diff --git a/app/javascript/mastodon/components/error_boundary.js b/app/javascript/mastodon/components/error_boundary.js index 800b1c270..6f763619c 100644 --- a/app/javascript/mastodon/components/error_boundary.js +++ b/app/javascript/mastodon/components/error_boundary.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import { version, source_url } from 'mastodon/initial_state'; +import { source_url, version } from 'mastodon/initial_state'; export default class ErrorBoundary extends React.PureComponent { @@ -10,17 +10,17 @@ export default class ErrorBoundary extends React.PureComponent { }; state = { - hasError: false, - stackTrace: undefined, + hasError : false, + stackTrace : undefined, componentStack: undefined, }; - componentDidCatch (error, info) { + componentDidCatch(error, info) { this.setState({ - hasError: true, - stackTrace: error.stack, + hasError : true, + stackTrace : error.stack, componentStack: info && info.componentStack, - copied: false, + copied : false, }); } @@ -28,7 +28,7 @@ export default class ErrorBoundary extends React.PureComponent { const { stackTrace } = this.state; const textarea = document.createElement('textarea'); - textarea.textContent = stackTrace; + textarea.textContent = stackTrace; textarea.style.position = 'fixed'; document.body.appendChild(textarea); @@ -44,7 +44,7 @@ export default class ErrorBoundary extends React.PureComponent { this.setState({ copied: true }); setTimeout(() => this.setState({ copied: false }), 700); - } + }; render() { const { hasError, copied } = this.state; @@ -54,13 +54,32 @@ export default class ErrorBoundary extends React.PureComponent { } return ( -
-
-

-

-

Mastodon v{version} · ·

-
-
+
+
+

+

+

Mastodon v{version} · ·

+
+
); } diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/mastodon/components/icon_button.js index fd715bc3c..47ad42e78 100644 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/mastodon/components/icon_button.js @@ -6,41 +6,41 @@ import Icon from 'mastodon/components/icon'; export default class IconButton extends React.PureComponent { static propTypes = { - className: PropTypes.string, - title: PropTypes.string.isRequired, - icon: PropTypes.string.isRequired, - onClick: PropTypes.func, + className : PropTypes.string, + title : PropTypes.string.isRequired, + icon : PropTypes.string.isRequired, + onClick : PropTypes.func, onMouseDown: PropTypes.func, - onKeyDown: PropTypes.func, - onKeyPress: PropTypes.func, - size: PropTypes.number, - active: PropTypes.bool, - pressed: PropTypes.bool, - expanded: PropTypes.bool, - style: PropTypes.object, + onKeyDown : PropTypes.func, + onKeyPress : PropTypes.func, + size : PropTypes.number, + active : PropTypes.bool, + pressed : PropTypes.bool, + expanded : PropTypes.bool, + style : PropTypes.object, activeStyle: PropTypes.object, - disabled: PropTypes.bool, - inverted: PropTypes.bool, - animate: PropTypes.bool, - overlay: PropTypes.bool, - tabIndex: PropTypes.string, + disabled : PropTypes.bool, + inverted : PropTypes.bool, + animate : PropTypes.bool, + overlay : PropTypes.bool, + tabIndex : PropTypes.string, }; static defaultProps = { - size: 18, - active: false, + size : 18, + active : false, disabled: false, - animate: false, - overlay: false, + animate : false, + overlay : false, tabIndex: '0', }; state = { - activate: false, + activate : false, deactivate: false, - } + }; - componentWillReceiveProps (nextProps) { + componentWillReceiveProps(nextProps) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -50,38 +50,38 @@ export default class IconButton extends React.PureComponent { } } - handleClick = (e) => { + handleClick = (e) => { e.preventDefault(); if (!this.props.disabled) { this.props.onClick(e); } - } + }; handleKeyPress = (e) => { if (this.props.onKeyPress && !this.props.disabled) { this.props.onKeyPress(e); } - } + }; handleMouseDown = (e) => { if (!this.props.disabled && this.props.onMouseDown) { this.props.onMouseDown(e); } - } + }; handleKeyDown = (e) => { if (!this.props.disabled && this.props.onKeyDown) { this.props.onKeyDown(e); } - } + }; - render () { + render() { const style = { - fontSize: `${this.props.size}px`, - width: `${this.props.size * 1.28571429}px`, - height: `${this.props.size * 1.28571429}px`, - lineHeight: `${this.props.size}px`, + // fontSize: `${this.props.size}px`, + // width: `${this.props.size * 1.28571429}px`, + // height: `${this.props.size * 1.28571429}px`, + // lineHeight: `${this.props.size}px`, ...this.props.style, ...(this.props.active ? this.props.activeStyle : {}), }; @@ -128,8 +128,12 @@ export default class IconButton extends React.PureComponent { tabIndex={tabIndex} disabled={disabled} > -
); } diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.js b/app/javascript/mastodon/features/compose/components/navigation_bar.js index d7c9c9818..4f3fc90f4 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.js +++ b/app/javascript/mastodon/features/compose/components/navigation_bar.js @@ -26,7 +26,7 @@ export default class NavigationBar extends ImmutablePureComponent { {this.props.account.get('acct')} diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index e9bbb4ba4..907bf1839 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import IconButton from 'mastodon/components/icon_button'; import Icon from 'mastodon/components/icon'; import AutosuggestInput from 'mastodon/components/autosuggest_input'; @@ -56,19 +56,19 @@ class Option extends React.PureComponent { if (e.key === 'Enter' || e.key === ' ') { this.handleToggleMultiple(e); } - } + }; onSuggestionsClearRequested = () => { this.props.onClearSuggestions(); - } + }; onSuggestionsFetchRequested = (token) => { this.props.onFetchSuggestions(token); - } + }; onSuggestionSelected = (tokenStart, token, value) => { this.props.onSuggestionSelected(tokenStart, token, value, ['poll', 'options', this.props.index]); - } + }; render () { const { isPollMultiple, title, index, intl } = this.props; @@ -82,8 +82,8 @@ class Option extends React.PureComponent { onKeyPress={this.handleCheckboxKeypress} role='button' tabIndex='0' - title={intl.formatMessage(isPollMultiple ? messages.switchToMultiple : messages.switchToSingle)} - aria-label={intl.formatMessage(isPollMultiple ? messages.switchToMultiple : messages.switchToSingle)} + title={intl.formatMessage(isPollMultiple ? messages.switchToSingle : messages.switchToMultiple)} + aria-label={intl.formatMessage(isPollMultiple ? messages.switchToSingle : messages.switchToMultiple)} /> ({ - 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/direct_timeline/components/conversation.js b/app/javascript/mastodon/features/direct_timeline/components/conversation.js index 221988ecd..f1ab5f950 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.js @@ -150,7 +150,7 @@ class Conversation extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDelete }); - const names = accounts.map(a => ( - ).reduce((prev, cur) => [prev, ', ', cur]); + )).reduce((prev, cur) => [prev, ', ', cur]); const handlers = { reply : this.handleReply, @@ -179,7 +179,7 @@ class Conversation extends ImmutablePureComponent {
@@ -221,23 +221,24 @@ class Conversation extends ImmutablePureComponent { )}
- -
+
diff --git a/app/javascript/mastodon/features/directory/components/account_card.js b/app/javascript/mastodon/features/directory/components/account_card.js index 50ad74450..828527d03 100644 --- a/app/javascript/mastodon/features/directory/components/account_card.js +++ b/app/javascript/mastodon/features/directory/components/account_card.js @@ -9,10 +9,10 @@ import DisplayName from 'mastodon/components/display_name'; import Permalink from 'mastodon/components/permalink'; import RelativeTimestamp from 'mastodon/components/relative_timestamp'; import IconButton from 'mastodon/components/icon_button'; -import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; +import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { autoPlayGif, me, unfollowModal } from 'mastodon/initial_state'; import { shortNumberFormat } from 'mastodon/utils/numbers'; -import { followAccount, unfollowAccount, blockAccount, unblockAccount, unmuteAccount } from 'mastodon/actions/accounts'; +import { blockAccount, followAccount, unblockAccount, unfollowAccount, unmuteAccount } from 'mastodon/actions/accounts'; import { openModal } from 'mastodon/actions/modal'; import { initMuteModal } from 'mastodon/actions/mutes'; @@ -113,27 +113,27 @@ class AccountCard extends ImmutablePureComponent { handleEmojiMouseEnter = ({ target }) => { target.src = target.getAttribute('data-original'); - } + }; handleEmojiMouseLeave = ({ target }) => { target.src = target.getAttribute('data-static'); - } + }; handleFollow = () => { this.props.onFollow(this.props.account); - } + }; handleBlock = () => { this.props.onBlock(this.props.account); - } + }; handleMute = () => { this.props.onMute(this.props.account); - } + }; setRef = (c) => { this.node = c; - } + }; render () { const { account, intl } = this.props; @@ -165,7 +165,10 @@ class AccountCard extends ImmutablePureComponent {
- + diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js index a3b524db1..87b403e7c 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js @@ -31,7 +31,10 @@ class AccountAuthorize extends ImmutablePureComponent {
-
+
diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index 284ae2c11..304935902 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/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js index 74065e5e2..0ff64725e 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.js +++ b/app/javascript/mastodon/features/notifications/components/notification.js @@ -1,6 +1,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; +import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { HotKeys } from 'react-hotkeys'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -13,10 +13,10 @@ import Permalink from 'mastodon/components/permalink'; const messages = defineMessages({ favourite: { id: 'notification.favourite', defaultMessage: '{name} favourited your status' }, - follow: { id: 'notification.follow', defaultMessage: '{name} followed you' }, - ownPoll: { id: 'notification.own_poll', defaultMessage: 'Your poll has ended' }, - poll: { id: 'notification.poll', defaultMessage: 'A poll you have voted in has ended' }, - reblog: { id: 'notification.reblog', defaultMessage: '{name} boosted your status' }, + follow : { id: 'notification.follow', defaultMessage: '{name} followed you' }, + ownPoll : { id: 'notification.own_poll', defaultMessage: 'Your poll has ended' }, + poll : { id: 'notification.poll', defaultMessage: 'A poll you have voted in has ended' }, + reblog : { id: 'notification.reblog', defaultMessage: '{name} boosted your status' }, }); const notificationForScreenReader = (intl, message, timestamp) => { @@ -35,31 +35,31 @@ class Notification extends ImmutablePureComponent { }; static propTypes = { - notification: ImmutablePropTypes.map.isRequired, - hidden: PropTypes.bool, - onMoveUp: PropTypes.func.isRequired, - onMoveDown: PropTypes.func.isRequired, - onMention: PropTypes.func.isRequired, - onFavourite: PropTypes.func.isRequired, - onReblog: PropTypes.func.isRequired, - onToggleHidden: PropTypes.func.isRequired, - status: ImmutablePropTypes.map, - intl: PropTypes.object.isRequired, - getScrollPosition: PropTypes.func, + notification : ImmutablePropTypes.map.isRequired, + hidden : PropTypes.bool, + onMoveUp : PropTypes.func.isRequired, + onMoveDown : PropTypes.func.isRequired, + onMention : PropTypes.func.isRequired, + onFavourite : PropTypes.func.isRequired, + onReblog : PropTypes.func.isRequired, + onToggleHidden : PropTypes.func.isRequired, + status : ImmutablePropTypes.map, + intl : PropTypes.object.isRequired, + getScrollPosition : PropTypes.func, updateScrollBottom: PropTypes.func, - cacheMediaWidth: PropTypes.func, - cachedMediaWidth: PropTypes.number, + cacheMediaWidth : PropTypes.func, + cachedMediaWidth : PropTypes.number, }; handleMoveUp = () => { const { notification, onMoveUp } = this.props; onMoveUp(notification.get('id')); - } + }; handleMoveDown = () => { const { notification, onMoveDown } = this.props; onMoveDown(notification.get('id')); - } + }; handleOpen = () => { const { notification } = this.props; @@ -69,94 +69,131 @@ class Notification extends ImmutablePureComponent { } else { this.handleOpenProfile(); } - } + }; handleOpenProfile = () => { const { notification } = this.props; this.context.router.history.push(`/accounts/${notification.getIn(['account', 'id'])}`); - } + }; handleMention = e => { e.preventDefault(); const { notification, onMention } = this.props; onMention(notification.get('account'), this.context.router.history); - } + }; handleHotkeyFavourite = () => { const { status } = this.props; if (status) this.props.onFavourite(status); - } + }; handleHotkeyBoost = e => { const { status } = this.props; if (status) this.props.onReblog(status, e); - } + }; handleHotkeyToggleHidden = () => { const { status } = this.props; if (status) this.props.onToggleHidden(status); - } + }; - getHandlers () { + getHandlers() { return { - reply: this.handleMention, - favourite: this.handleHotkeyFavourite, - boost: this.handleHotkeyBoost, - mention: this.handleMention, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, + reply : this.handleMention, + favourite : this.handleHotkeyFavourite, + boost : this.handleHotkeyBoost, + mention : this.handleMention, + open : this.handleOpen, + openProfile : this.handleOpenProfile, + moveUp : this.handleMoveUp, + moveDown : this.handleMoveDown, toggleHidden: this.handleHotkeyToggleHidden, }; } - renderFollow (notification, account, link) { + renderFollow(notification, account, link) { const { intl } = this.props; return ( -
-
-
- -
+
- - - -
-
- + + + + + + + + + + + + + +
+
); } - renderFollowRequest (notification, account, link) { + renderFollowRequest(notification, account, link) { const { intl } = this.props; return ( -
+
- -
+ +
- - -
+ + +
-
- +
+ ); } - renderMention (notification) { + renderMention(notification) { return ( -
+
- -
+ +
- - -
+ + +
-
- + + ); } - renderReblog (notification, link) { + renderReblog(notification, link) { const { intl } = this.props; return ( -
+
- -
+ +
- - -
+ + +
- -
+ + ); } - renderPoll (notification, account) { + renderPoll(notification, account) { const { intl } = this.props; - const ownPoll = me === account.get('id'); - const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll); + const ownPoll = me === account.get('id'); + const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll); return ( -
+
- -
+ +
{ownPoll ? ( - + ) : ( - + )} - -
+ +
- -
+ + ); } - render () { + render() { const { notification } = this.props; - const account = notification.get('account'); - const displayNameHtml = { __html: account.get('display_name_html') }; - const link = ; + const account = notification.get('account'); + const displayNameHtml = { __html: account.get('display_name_html') }; + const link = (); - switch(notification.get('type')) { + switch (notification.get('type')) { case 'follow': return this.renderFollow(notification, account, link); case 'follow_request': diff --git a/app/javascript/mastodon/features/reblogs/index.js b/app/javascript/mastodon/features/reblogs/index.js index 9179e51db..80fecf964 100644 --- a/app/javascript/mastodon/features/reblogs/index.js +++ b/app/javascript/mastodon/features/reblogs/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from '../../components/loading_indicator'; import { fetchReblogs } from '../../actions/interactions'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import ScrollableList from '../../components/scrollable_list'; @@ -25,15 +25,15 @@ export default @connect(mapStateToProps) class Reblogs 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, - multiColumn: PropTypes.bool, - intl: PropTypes.object.isRequired, + accountIds : ImmutablePropTypes.list, + multiColumn : PropTypes.bool, + intl : PropTypes.object.isRequired, }; - componentWillMount () { + componentWillMount() { if (!this.props.accountIds) { this.props.dispatch(fetchReblogs(this.props.params.statusId)); } @@ -47,20 +47,23 @@ class Reblogs extends ImmutablePureComponent { handleRefresh = () => { this.props.dispatch(fetchReblogs(this.props.params.statusId)); - } + }; - render () { + render() { const { intl, shouldUpdateScroll, accountIds, multiColumn } = this.props; if (!accountIds) { return ( - + - + ); } - const emptyMessage = ; + const emptyMessage = (); return ( @@ -68,7 +71,12 @@ class Reblogs extends ImmutablePureComponent { showBackButton multiColumn={multiColumn} extraButton={( - + )} /> @@ -79,10 +87,14 @@ class Reblogs extends ImmutablePureComponent { bindToDocument={!multiColumn} > {accountIds.map(id => - + (), )} - - + + ); } diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index d5bc82735..6952382be 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -45,15 +45,15 @@ export default class DetailedStatus extends ImmutablePureComponent { } e.stopPropagation(); - } + }; handleOpenVideo = (media, startTime) => { this.props.onOpenVideo(media, startTime); - } + }; handleExpandedToggle = () => { this.props.onToggleHidden(this.props.status); - } + }; _measureHeight (heightJustChanged) { if (this.props.measureHeight && this.node) { @@ -68,7 +68,7 @@ export default class DetailedStatus extends ImmutablePureComponent { setRef = c => { this.node = c; this._measureHeight(); - } + }; componentDidUpdate (prevProps, prevState) { this._measureHeight(prevState.height !== this.state.height); @@ -86,7 +86,7 @@ export default class DetailedStatus extends ImmutablePureComponent { } window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes'); - } + }; render () { const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status; @@ -211,8 +211,14 @@ export default class DetailedStatus extends ImmutablePureComponent {
-
- +
+
diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 6cec4d7e9..936142f10 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -551,8 +551,9 @@ class Status extends ImmutablePureComponent { className={classNames('scrollable', { fullscreen })} ref={this.setRef} > + {/*

ancestors:

*/} {ancestors} - + {/*

common:

*/}
- + {/*

Descendants:

*/} {descendants}
diff --git a/app/javascript/mastodon/features/ui/components/actions_modal.js b/app/javascript/mastodon/features/ui/components/actions_modal.js index 875b2b75d..dcd59cfcd 100644 --- a/app/javascript/mastodon/features/ui/components/actions_modal.js +++ b/app/javascript/mastodon/features/ui/components/actions_modal.js @@ -26,16 +26,29 @@ export default class ActionsModal extends ImmutablePureComponent { return (
  • - - {icon && } -
    -
    {text}
    -
    {meta}
    -
    -
    -
  • + + {icon && } +
    +
    {text}
    +
    {meta}
    +
    +
    + ); - } + }; render () { const status = this.props.status && ( @@ -49,7 +62,10 @@ export default class ActionsModal extends ImmutablePureComponent {
    - +
    diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/mastodon/features/ui/components/boost_modal.js index 0e79005f0..eb8439a19 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.js +++ b/app/javascript/mastodon/features/ui/components/boost_modal.js @@ -1,7 +1,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import Button from '../../../components/button'; import StatusContent from '../../../components/status_content'; import Avatar from '../../../components/avatar'; @@ -37,7 +37,7 @@ class BoostModal extends ImmutablePureComponent { handleReblog = () => { this.props.onReblog(this.props.status); this.props.onClose(); - } + }; handleAccountClick = (e) => { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { @@ -45,11 +45,11 @@ class BoostModal extends ImmutablePureComponent { this.props.onClose(); this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); } - } + }; setRef = (c) => { this.button = c; - } + }; render () { const { status, intl } = this.props; @@ -66,7 +66,10 @@ class BoostModal extends ImmutablePureComponent {
    - +
    diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js index 6149da970..2f825547e 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -31,6 +31,8 @@ import NavigationPanel from './navigation_panel'; import detectPassiveEvents from 'detect-passive-events'; import { scrollRight } from '../../../scroll'; +import LinkFooter from './link_footer'; +import InstantMessaging from './messaging/instantMessaging'; const componentMap = { 'COMPOSE' : Compose, @@ -157,10 +159,10 @@ class ColumnsArea extends ImmutablePureComponent { const view = (index === columnIndex) ? React.cloneElement(this.props.children) : - ; + />); return (
    ; + >); const content = columnIndex !== -1 ? ( +
    +
    +
    @@ -233,8 +238,12 @@ class ColumnsArea extends ImmutablePureComponent {
    - + {floatingActionButton} +
    + + +
    ); } @@ -255,17 +264,20 @@ class ColumnsArea extends ImmutablePureComponent { loading={this.renderLoading(column.get('id'))} error={this.renderError} > - {SpecificComponent => (} + multiColumn {...other} + />)} + ); })} {React.Children.map(children, child => React.cloneElement(child, { multiColumn: true }))} - ); + ) + ; } } diff --git a/app/javascript/mastodon/features/ui/components/compose_panel.js b/app/javascript/mastodon/features/ui/components/compose_panel.js index c7821f473..fd7d7710b 100644 --- a/app/javascript/mastodon/features/ui/components/compose_panel.js +++ b/app/javascript/mastodon/features/ui/components/compose_panel.js @@ -2,15 +2,13 @@ import React from 'react'; import SearchContainer from 'mastodon/features/compose/containers/search_container'; import ComposeFormContainer from 'mastodon/features/compose/containers/compose_form_container'; import NavigationContainer from 'mastodon/features/compose/containers/navigation_container'; -import LinkFooter from './link_footer'; const ComposePanel = () => (
    - -
    + ); export default ComposePanel; diff --git a/app/javascript/mastodon/features/ui/components/link_footer.js b/app/javascript/mastodon/features/ui/components/link_footer.js index c484dd7bc..1c102ac28 100644 --- a/app/javascript/mastodon/features/ui/components/link_footer.js +++ b/app/javascript/mastodon/features/ui/components/link_footer.js @@ -2,10 +2,11 @@ import { connect } from 'react-redux'; import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import { Link } from 'react-router-dom'; +import { Link, NavLink } from 'react-router-dom'; import { invitesEnabled, repository, source_url, version } from 'mastodon/initial_state'; import { logOut } from 'mastodon/utils/log_out'; import { openModal } from 'mastodon/actions/modal'; +import { isStaff } from '../../../initial_state'; const messages = defineMessages({ logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' }, @@ -22,14 +23,26 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, }); +// const displaythemetoggler = true; export default @injectIntl @connect(null, mapDispatchToProps) class LinkFooter extends React.PureComponent { static propTypes = { - withHotkeys: PropTypes.bool, - 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, + themeIsDark : true, + minimumWeekToShowSnow: 48, }; handleLogoutClick = e => { @@ -41,35 +54,177 @@ class LinkFooter extends React.PureComponent { return false; }; + constructor(props) { + super(props); + Date.prototype.getWeek = function () { + var onejan = new Date(this.getFullYear(), 0, 1); + return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); + }; + + var weekNumber = (new Date()).getWeek(); + // display snow during the last two weeks of the year + const shouldWeDisplaySnow = (weekNumber > props.minimumWeekToShowSnow) && props.enableChristmasSnow; + + this.state = { + enableChristmasSnow: shouldWeDisplaySnow, + theme : props.theme, + }; + + // make snow effect + if (shouldWeDisplaySnow) { + import('../../../utils/snowstorm-min') + .then((snowstorm) => { + Window.snowstorm = snowstorm.default; + this.state.snow = Window.snowstorm; + // snowstorm.start(); + this.state.snowActive = true; + }) + .catch((err) => console.error(err)); + } + + } + + toggleSnow = () => { + if (this.state.snow) { + if (this.state.snowActive) { + this.state.snow.stop(); + this.state.enableChristmasSnow = false; + } else { + this.state.snow.start(); + this.state.enableChristmasSnow = true; + } + } + }; + + changeTheme(newTheme) { + console.log('change theme en ', newTheme); + } + render() { + const HashTagNavlinks = ['Mastoart', 'OpenStreetMaps', 'Ironèmes', 'vélo']; const { withHotkeys } = this.props; + var snowClasses = this.props.enableChristmasSnow ? 'snow-button active' : 'snow-button '; + const navToTags = HashTagNavlinks.map(element => { + return ( +
  • + + + #{element} + +
  • + ); + }); return ( -
    -