diff --git a/.gitignore b/.gitignore index 4545270b3..8b7cb2eaa 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,11 @@ yarn-debug.log # Ignore Docker option files docker-compose.override.yml + + +/public/packs +/public/packs-test +/node_modules +/yarn-error.log +yarn-debug.log* +.yarn-integrity diff --git a/.nope_browserlistrc b/.nope_browserlistrc new file mode 100644 index 000000000..e94f8140c --- /dev/null +++ b/.nope_browserlistrc @@ -0,0 +1 @@ +defaults diff --git a/README.md b/README.md index 3c6daf4f8..8407d4ed4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Mastodon](https://i.imgur.com/NhZc40l.png) +![Mastodon](https://i.imgur.com/NhZc40l.png) - [mastodon.CipherBliss.com](https://mastodon.CipherBliss.com) version ======== [![GitHub release](https://img.shields.io/github/release/tootsuite/mastodon.svg)][releases] diff --git a/app/assets/javascripts/user_groups.js b/app/assets/javascripts/user_groups.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/user_groups.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/scaffold.css b/app/assets/stylesheets/scaffold.css new file mode 100644 index 000000000..cd4f3de38 --- /dev/null +++ b/app/assets/stylesheets/scaffold.css @@ -0,0 +1,80 @@ +body { + background-color: #fff; + color: #333; + margin: 33px; +} + +body, p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; +} + +a:visited { + color: #666; +} + +a:hover { + color: #fff; + background-color: #000; +} + +th { + padding-bottom: 5px; +} + +td { + padding: 0 5px 7px; +} + +div.field, +div.actions { + margin-bottom: 10px; +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px 7px 0; + margin-bottom: 20px; + background-color: #f0f0f0; +} + +#error_explanation h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px -7px 0; + background-color: #c00; + color: #fff; +} + +#error_explanation ul li { + font-size: 12px; + list-style: square; +} + +label { + display: block; +} diff --git a/app/assets/stylesheets/user_groups.css b/app/assets/stylesheets/user_groups.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/user_groups.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/user_groups_controller.rb b/app/controllers/user_groups_controller.rb new file mode 100644 index 000000000..d4ec0a2b4 --- /dev/null +++ b/app/controllers/user_groups_controller.rb @@ -0,0 +1,58 @@ +class UserGroupsController < ApplicationController + before_action :set_user_group, only: [:show, :edit, :update, :destroy] + + # GET /user_groups + def index + @user_groups = UserGroup.all + end + + # GET /user_groups/1 + def show + end + + # GET /user_groups/new + def new + @user_group = UserGroup.new + end + + # GET /user_groups/1/edit + def edit + end + + # POST /user_groups + def create + @user_group = UserGroup.new(user_group_params) + + if @user_group.save + redirect_to @user_group, notice: 'User group was successfully created.' + else + render :new + end + end + + # PATCH/PUT /user_groups/1 + def update + if @user_group.update(user_group_params) + redirect_to @user_group, notice: 'User group was successfully updated.' + else + render :edit + end + end + + # DELETE /user_groups/1 + def destroy + @user_group.destroy + redirect_to user_groups_url, notice: 'User group was successfully destroyed.' + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_user_group + @user_group = UserGroup.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def user_group_params + params.require(:user_group).permit(:name, :createAt, :visibility, :members) + end +end diff --git a/app/helpers/user_groups_helper.rb b/app/helpers/user_groups_helper.rb new file mode 100644 index 000000000..83cd8f3cd --- /dev/null +++ b/app/helpers/user_groups_helper.rb @@ -0,0 +1,2 @@ +module UserGroupsHelper +end diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index cb2c682a4..a7b4acd8f 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -118,20 +118,20 @@ 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 { @@ -140,7 +140,7 @@ export function fetchAccountFail(id, error) { 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,7 +167,7 @@ export function unfollowAccount(id) { dispatch(unfollowAccountFail(error)); }); }; -}; +} export function followAccountRequest(id, locked) { return { @@ -176,7 +176,7 @@ export function followAccountRequest(id, locked) { locked, skipLoading: true, }; -}; +} export function followAccountSuccess(relationship, alreadyFollowing) { return { @@ -185,7 +185,7 @@ export function followAccountSuccess(relationship, alreadyFollowing) { alreadyFollowing, skipLoading: true, }; -}; +} export function followAccountFail(error, locked) { return { @@ -194,7 +194,7 @@ export function followAccountFail(error, locked) { locked, skipLoading: true, }; -}; +} export function unfollowAccountRequest(id) { return { @@ -202,7 +202,7 @@ export function unfollowAccountRequest(id) { id, skipLoading: true, }; -}; +} export function unfollowAccountSuccess(relationship, statuses) { return { @@ -211,7 +211,7 @@ export function unfollowAccountSuccess(relationship, statuses) { statuses, skipLoading: true, }; -}; +} export function unfollowAccountFail(error) { return { @@ -219,7 +219,7 @@ export function unfollowAccountFail(error) { 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,35 +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) { @@ -301,7 +301,7 @@ export function muteAccount(id, notifications) { dispatch(muteAccountFail(id, error)); }); }; -}; +} export function unmuteAccount(id) { return (dispatch, getState) => { @@ -313,14 +313,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,35 +328,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) { @@ -373,14 +373,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,16 +389,16 @@ export function fetchFollowersSuccess(id, accounts, next) { accounts, next, }; -}; +} export function fetchFollowersFail(id, error) { return { - type: FOLLOWERS_FETCH_FAIL, + type : FOLLOWERS_FETCH_FAIL, id, error, skipNotFound: true, }; -}; +} export function expandFollowers(id) { return (dispatch, getState) => { @@ -420,14 +420,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 { @@ -436,7 +436,7 @@ export function expandFollowersSuccess(id, accounts, next) { accounts, next, }; -}; +} export function expandFollowersFail(id, error) { return { @@ -444,7 +444,7 @@ export function expandFollowersFail(id, error) { id, error, }; -}; +} export function fetchFollowing(id) { return (dispatch, getState) => { @@ -460,14 +460,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 { @@ -476,16 +476,16 @@ export function fetchFollowingSuccess(id, accounts, next) { accounts, next, }; -}; +} export function fetchFollowingFail(id, error) { return { - type: FOLLOWING_FETCH_FAIL, + type : FOLLOWING_FETCH_FAIL, id, error, skipNotFound: true, }; -}; +} export function expandFollowing(id) { return (dispatch, getState) => { @@ -507,14 +507,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 { @@ -523,7 +523,7 @@ export function expandFollowingSuccess(id, accounts, next) { accounts, next, }; -}; +} export function expandFollowingFail(id, error) { return { @@ -531,7 +531,7 @@ export function expandFollowingFail(id, error) { id, error, }; -}; +} export function fetchRelationships(accountIds) { return (dispatch, getState) => { @@ -550,7 +550,7 @@ export function fetchRelationships(accountIds) { dispatch(fetchRelationshipsFail(error)); }); }; -}; +} export function fetchRelationshipsRequest(ids) { return { @@ -558,7 +558,7 @@ export function fetchRelationshipsRequest(ids) { ids, skipLoading: true, }; -}; +} export function fetchRelationshipsSuccess(relationships) { return { @@ -566,16 +566,16 @@ export function fetchRelationshipsSuccess(relationships) { relationships, skipLoading: true, }; -}; +} export function fetchRelationshipsFail(error) { return { - type: RELATIONSHIPS_FETCH_FAIL, + type : RELATIONSHIPS_FETCH_FAIL, error, - skipLoading: true, + skipLoading : true, skipNotFound: true, }; -}; +} export function fetchFollowRequests() { return (dispatch, getState) => { @@ -587,13 +587,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 { @@ -601,14 +601,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) => { @@ -626,13 +626,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 { @@ -640,14 +640,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) => { @@ -658,21 +658,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 { @@ -680,7 +680,7 @@ export function authorizeFollowRequestFail(id, error) { id, error, }; -}; +} export function rejectFollowRequest(id) { @@ -692,21 +692,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 { @@ -714,7 +714,7 @@ export function rejectFollowRequestFail(id, error) { id, error, }; -}; +} export function pinAccount(id) { return (dispatch, getState) => { @@ -726,7 +726,7 @@ export function pinAccount(id) { dispatch(pinAccountFail(error)); }); }; -}; +} export function unpinAccount(id) { return (dispatch, getState) => { @@ -738,46 +738,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/alerts.js b/app/javascript/mastodon/actions/alerts.js index 1670f9c10..0220b0af5 100644 --- a/app/javascript/mastodon/actions/alerts.js +++ b/app/javascript/mastodon/actions/alerts.js @@ -17,13 +17,13 @@ export function dismissAlert(alert) { type: ALERT_DISMISS, alert, }; -}; +} export function clearAlert() { return { type: ALERT_CLEAR, }; -}; +} export function showAlert(title = messages.unexpectedTitle, message = messages.unexpectedMessage, message_values = undefined) { return { @@ -32,7 +32,7 @@ export function showAlert(title = messages.unexpectedTitle, message = messages.u message, message_values, }; -}; +} export function showAlertForError(error, skipNotFound = false) { if (error.response) { diff --git a/app/javascript/mastodon/actions/announcements.js b/app/javascript/mastodon/actions/announcements.js index 1bdea909f..aec2f94ed 100644 --- a/app/javascript/mastodon/actions/announcements.js +++ b/app/javascript/mastodon/actions/announcements.js @@ -3,21 +3,21 @@ import { normalizeAnnouncement } from './importer/normalizer'; export const ANNOUNCEMENTS_FETCH_REQUEST = 'ANNOUNCEMENTS_FETCH_REQUEST'; export const ANNOUNCEMENTS_FETCH_SUCCESS = 'ANNOUNCEMENTS_FETCH_SUCCESS'; -export const ANNOUNCEMENTS_FETCH_FAIL = 'ANNOUNCEMENTS_FETCH_FAIL'; -export const ANNOUNCEMENTS_UPDATE = 'ANNOUNCEMENTS_UPDATE'; -export const ANNOUNCEMENTS_DELETE = 'ANNOUNCEMENTS_DELETE'; +export const ANNOUNCEMENTS_FETCH_FAIL = 'ANNOUNCEMENTS_FETCH_FAIL'; +export const ANNOUNCEMENTS_UPDATE = 'ANNOUNCEMENTS_UPDATE'; +export const ANNOUNCEMENTS_DELETE = 'ANNOUNCEMENTS_DELETE'; export const ANNOUNCEMENTS_DISMISS_REQUEST = 'ANNOUNCEMENTS_DISMISS_REQUEST'; export const ANNOUNCEMENTS_DISMISS_SUCCESS = 'ANNOUNCEMENTS_DISMISS_SUCCESS'; -export const ANNOUNCEMENTS_DISMISS_FAIL = 'ANNOUNCEMENTS_DISMISS_FAIL'; +export const ANNOUNCEMENTS_DISMISS_FAIL = 'ANNOUNCEMENTS_DISMISS_FAIL'; export const ANNOUNCEMENTS_REACTION_ADD_REQUEST = 'ANNOUNCEMENTS_REACTION_ADD_REQUEST'; export const ANNOUNCEMENTS_REACTION_ADD_SUCCESS = 'ANNOUNCEMENTS_REACTION_ADD_SUCCESS'; -export const ANNOUNCEMENTS_REACTION_ADD_FAIL = 'ANNOUNCEMENTS_REACTION_ADD_FAIL'; +export const ANNOUNCEMENTS_REACTION_ADD_FAIL = 'ANNOUNCEMENTS_REACTION_ADD_FAIL'; export const ANNOUNCEMENTS_REACTION_REMOVE_REQUEST = 'ANNOUNCEMENTS_REACTION_REMOVE_REQUEST'; export const ANNOUNCEMENTS_REACTION_REMOVE_SUCCESS = 'ANNOUNCEMENTS_REACTION_REMOVE_SUCCESS'; -export const ANNOUNCEMENTS_REACTION_REMOVE_FAIL = 'ANNOUNCEMENTS_REACTION_REMOVE_FAIL'; +export const ANNOUNCEMENTS_REACTION_REMOVE_FAIL = 'ANNOUNCEMENTS_REACTION_REMOVE_FAIL'; export const ANNOUNCEMENTS_REACTION_UPDATE = 'ANNOUNCEMENTS_REACTION_UPDATE'; @@ -56,7 +56,7 @@ export const fetchAnnouncementsFail= error => ({ }); export const updateAnnouncements = announcement => ({ - type: ANNOUNCEMENTS_UPDATE, + type : ANNOUNCEMENTS_UPDATE, announcement: normalizeAnnouncement(announcement), }); @@ -72,17 +72,17 @@ export const dismissAnnouncement = announcementId => (dispatch, getState) => { export const dismissAnnouncementRequest = announcementId => ({ type: ANNOUNCEMENTS_DISMISS_REQUEST, - id: announcementId, + id : announcementId, }); export const dismissAnnouncementSuccess = announcementId => ({ type: ANNOUNCEMENTS_DISMISS_SUCCESS, - id: announcementId, + id : announcementId, }); export const dismissAnnouncementFail = (announcementId, error) => ({ type: ANNOUNCEMENTS_DISMISS_FAIL, - id: announcementId, + id : announcementId, error, }); diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 20341f9ec..c46d04fc7 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -7,8 +7,7 @@ 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; @@ -81,7 +80,7 @@ export function changeCompose(text) { type: COMPOSE_CHANGE, text: text, }; -}; +} export function replyCompose(status, routerHistory) { return (dispatch, getState) => { @@ -92,19 +91,19 @@ export function replyCompose(status, routerHistory) { 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) => { @@ -115,7 +114,7 @@ export function mentionCompose(account, routerHistory) { ensureComposeIsVisible(getState, routerHistory); }; -}; +} export function directCompose(account, routerHistory) { return (dispatch, getState) => { @@ -126,7 +125,7 @@ export function directCompose(account, routerHistory) { ensureComposeIsVisible(getState, routerHistory); }; -}; +} export function submitCompose(routerHistory) { return function (dispatch, getState) { @@ -184,27 +183,27 @@ export function submitCompose(routerHistory) { dispatch(submitComposeFail(error)); }); }; -}; +} export function submitComposeRequest() { return { type: COMPOSE_SUBMIT_REQUEST, }; -}; +} export function submitComposeSuccess(status) { return { type: COMPOSE_SUBMIT_SUCCESS, status: status, }; -}; +} export function submitComposeFail(error) { return { type: COMPOSE_SUBMIT_FAIL, error: error, }; -}; +} export function uploadCompose(files) { return function (dispatch, getState) { @@ -236,7 +235,7 @@ export function uploadCompose(files) { total += file.size - f.size; return api(getState).post('/api/v2/media', data, { - onUploadProgress: function({ loaded }){ + onUploadProgress: function ({ loaded }) { progress[i] = loaded; dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total)); }, @@ -261,9 +260,9 @@ export function uploadCompose(files) { } }); }).catch(error => dispatch(uploadComposeFail(error))); - }; + } }; -}; +} export const uploadThumbnail = (id, file) => (dispatch, getState) => { dispatch(uploadThumbnailRequest()); @@ -318,7 +317,7 @@ export function changeUploadCompose(id, params) { dispatch(changeUploadComposeFail(id, error)); }); }; -}; +} export function changeUploadComposeRequest() { return { @@ -333,7 +332,7 @@ export function changeUploadComposeSuccess(media) { media: media, skipLoading: true, }; -}; +} export function changeUploadComposeFail(error) { return { @@ -341,14 +340,14 @@ export function changeUploadComposeFail(error) { error: error, skipLoading: true, }; -}; +} export function uploadComposeRequest() { return { type: COMPOSE_UPLOAD_REQUEST, skipLoading: true, }; -}; +} export function uploadComposeProgress(loaded, total) { return { @@ -356,7 +355,7 @@ export function uploadComposeProgress(loaded, total) { loaded: loaded, total: total, }; -}; +} export function uploadComposeSuccess(media, file) { return { @@ -365,7 +364,7 @@ export function uploadComposeSuccess(media, file) { file: file, skipLoading: true, }; -}; +} export function uploadComposeFail(error) { return { @@ -373,14 +372,14 @@ export function uploadComposeFail(error) { error: error, skipLoading: true, }; -}; +} export function undoUploadCompose(media_id) { return { type: COMPOSE_UPLOAD_UNDO, media_id: media_id, }; -}; +} export function clearComposeSuggestions() { if (cancelFetchComposeSuggestionsAccounts) { @@ -389,7 +388,7 @@ export function clearComposeSuggestions() { return { type: COMPOSE_SUGGESTIONS_CLEAR, }; -}; +} const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => { if (cancelFetchComposeSuggestionsAccounts) { @@ -463,7 +462,7 @@ export function fetchComposeSuggestions(token) { break; } }; -}; +} export function readyComposeSuggestionsEmojis(token, emojis) { return { @@ -471,7 +470,7 @@ export function readyComposeSuggestionsEmojis(token, emojis) { token, emojis, }; -}; +} export function readyComposeSuggestionsAccounts(token, accounts) { return { @@ -479,7 +478,7 @@ export function readyComposeSuggestionsAccounts(token, accounts) { token, accounts, }; -}; +} export const readyComposeSuggestionsTags = (token, tags) => ({ type: COMPOSE_SUGGESTIONS_READY, @@ -512,7 +511,7 @@ export function selectComposeSuggestion(position, token, suggestion, path) { path, }); }; -}; +} export function updateSuggestionTags(token) { return { @@ -560,39 +559,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 { @@ -601,33 +600,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 { @@ -635,14 +634,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 { @@ -650,4 +649,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/identity_proofs.js b/app/javascript/mastodon/actions/identity_proofs.js index 103983956..15fdb8c4e 100644 --- a/app/javascript/mastodon/actions/identity_proofs.js +++ b/app/javascript/mastodon/actions/identity_proofs.js @@ -24,7 +24,7 @@ export const fetchAccountIdentityProofsSuccess = (accountId, identity_proofs) => }); export const fetchAccountIdentityProofsFail = (accountId, err) => ({ - type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, + type : IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, accountId, err, skipNotFound: true, diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 5640201c6..08b1fe8f6 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -3,33 +3,34 @@ 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_REVEAL = 'STATUS_REVEAL'; export const STATUS_COLLAPSE = 'STATUS_COLLAPSE'; +export const STATUS_HIDE = 'STATUS_HIDE'; + export const REDRAFT = 'REDRAFT'; export function fetchStatusRequest(id, skipLoading) { @@ -38,7 +39,7 @@ export function fetchStatusRequest(id, skipLoading) { id, skipLoading, }; -}; +} function getFromDB(dispatch, getState, accountIndex, index, id) { return new Promise((resolve, reject) => { @@ -114,24 +115,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 { @@ -139,7 +140,7 @@ export function redraft(status, raw_text) { status, raw_text, }; -}; +} export function deleteStatus(id, routerHistory, withRedraft = false) { return (dispatch, getState) => { @@ -164,29 +165,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) => { @@ -204,33 +205,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) => { @@ -242,21 +243,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 { @@ -264,7 +265,7 @@ export function muteStatusFail(id, error) { id, error, }; -}; +} export function unmuteStatus(id) { return (dispatch, getState) => { @@ -276,21 +277,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 { @@ -298,7 +299,7 @@ export function unmuteStatusFail(id, error) { id, error, }; -}; +} export function hideStatus(ids) { if (!Array.isArray(ids)) { @@ -309,7 +310,7 @@ export function hideStatus(ids) { type: STATUS_HIDE, ids, }; -}; +} export function revealStatus(ids) { if (!Array.isArray(ids)) { @@ -320,7 +321,7 @@ export function revealStatus(ids) { type: STATUS_REVEAL, ids, }; -}; +} export function toggleStatusCollapse(id, isCollapsed) { return { diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index de1725acf..ea6a6d0ea 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -1,7 +1,7 @@ import { importFetchedStatus, importFetchedStatuses } from './importer'; import { submitMarkers } from './markers'; import api, { getLinks } from 'mastodon/api'; -import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; +import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; import compareId from 'mastodon/compare_id'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; @@ -42,7 +42,7 @@ export function updateTimeline(timeline, status, accept) { dispatch(submitMarkers()); } }; -}; +} export function deleteFromTimelines(id) { return (dispatch, getState) => { @@ -58,13 +58,13 @@ export function deleteFromTimelines(id) { reblogOf, }); }; -}; +} export function clearTimeline(timeline) { return (dispatch) => { dispatch({ type: TIMELINE_CLEAR, timeline }); }; -}; +} const noOp = () => {}; @@ -113,7 +113,7 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) { done(); }); }; -}; +} export const expandHomeTimeline = ({ maxId } = {}, done = noOp) => expandTimeline('home', '/api/v1/timelines/home', { max_id: maxId }, done); export const expandPublicTimeline = ({ maxId, onlyMedia, onlyRemote } = {}, done = noOp) => expandTimeline(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, '/api/v1/timelines/public', { remote: !!onlyRemote, max_id: maxId, only_media: !!onlyMedia }, done); @@ -138,7 +138,7 @@ export function expandTimelineRequest(timeline, isLoadingMore) { timeline, skipLoading: !isLoadingMore, }; -}; +} export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingRecent, isLoadingMore, usePendingItems) { return { @@ -151,17 +151,17 @@ export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadi usePendingItems, skipLoading: !isLoadingMore, }; -}; +} export function expandTimelineFail(timeline, error, isLoadingMore) { return { - type: TIMELINE_EXPAND_FAIL, + type : TIMELINE_EXPAND_FAIL, timeline, error, - skipLoading: !isLoadingMore, + skipLoading : !isLoadingMore, skipNotFound: timeline.startsWith('account:'), }; -}; +} export function scrollTopTimeline(timeline, top) { return { @@ -169,14 +169,14 @@ export function scrollTopTimeline(timeline, top) { timeline, top, }; -}; +} export function connectTimeline(timeline) { return { type: TIMELINE_CONNECT, timeline, }; -}; +} export const disconnectTimeline = timeline => ({ type: TIMELINE_DISCONNECT, diff --git a/app/javascript/mastodon/common.js b/app/javascript/mastodon/common.js index 6818aa5d5..8f3505303 100644 --- a/app/javascript/mastodon/common.js +++ b/app/javascript/mastodon/common.js @@ -9,4 +9,4 @@ export function start() { } catch (e) { // If called twice } -}; +} diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 58ec4f6eb..905032734 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -12,7 +12,7 @@ import classNames from 'classnames'; const textAtCursorMatchesToken = (str, caretPosition) => { let word; - let left = str.slice(0, caretPosition).search(/\S+$/); + let left = str.slice(0, caretPosition).search(/\S+$/); let right = str.slice(caretPosition).search(/\s/); if (right < 0) { @@ -37,34 +37,37 @@ const textAtCursorMatchesToken = (str, caretPosition) => { export default class AutosuggestTextarea extends ImmutablePureComponent { static propTypes = { - value: PropTypes.string, - suggestions: ImmutablePropTypes.list, - disabled: PropTypes.bool, - placeholder: PropTypes.string, - onSuggestionSelected: PropTypes.func.isRequired, + value : PropTypes.string, + suggestions : ImmutablePropTypes.list, + disabled : PropTypes.bool, + placeholder : PropTypes.string, + onSuggestionSelected : PropTypes.func.isRequired, onSuggestionsClearRequested: PropTypes.func.isRequired, onSuggestionsFetchRequested: PropTypes.func.isRequired, - onChange: PropTypes.func.isRequired, - onKeyUp: PropTypes.func, - onKeyDown: PropTypes.func, - onPaste: PropTypes.func.isRequired, - autoFocus: PropTypes.bool, + onChange : PropTypes.func.isRequired, + onKeyUp : PropTypes.func, + onKeyDown : PropTypes.func, + onPaste : PropTypes.func.isRequired, + autoFocus : PropTypes.bool, + directMessage : PropTypes.bool, + directMessageRecipient : PropTypes.string, }; static defaultProps = { - autoFocus: true, + autoFocus : true, + directMessage: false, }; state = { - suggestionsHidden: true, - focused: false, + suggestionsHidden : true, + focused : false, selectedSuggestion: 0, - lastToken: null, - tokenStart: 0, + lastToken : null, + tokenStart : 0, }; onChange = (e) => { - const [ tokenStart, token ] = textAtCursorMatchesToken(e.target.value, e.target.selectionStart); + const [tokenStart, token] = textAtCursorMatchesToken(e.target.value, e.target.selectionStart); if (token !== null && this.state.lastToken !== token) { this.setState({ lastToken: token, selectedSuggestion: 0, tokenStart }); @@ -75,7 +78,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } this.props.onChange(e); - } + }; onKeyDown = (e) => { const { suggestions, disabled } = this.props; @@ -92,7 +95,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { return; } - switch(e.key) { + switch (e.key) { case 'Escape': if (suggestions.size === 0 || suggestionsHidden) { document.querySelector('.ui').parentElement.focus(); @@ -124,7 +127,6 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { e.stopPropagation(); this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestions.get(selectedSuggestion)); } - break; } @@ -133,27 +135,27 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } this.props.onKeyDown(e); - } + }; onBlur = () => { this.setState({ suggestionsHidden: true, focused: false }); - } + }; onFocus = (e) => { this.setState({ focused: true }); if (this.props.onFocus) { this.props.onFocus(e); } - } + }; onSuggestionClick = (e) => { const suggestion = this.props.suggestions.get(e.currentTarget.getAttribute('data-index')); e.preventDefault(); this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion); this.textarea.focus(); - } + }; - componentWillReceiveProps (nextProps) { + componentWillReceiveProps(nextProps) { if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) { this.setState({ suggestionsHidden: false }); } @@ -161,14 +163,14 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { setTextarea = (c) => { this.textarea = c; - } + }; onPaste = (e) => { if (e.clipboardData && e.clipboardData.files.length === 1) { this.props.onPaste(e.clipboardData.files); e.preventDefault(); } - } + }; renderSuggestion = (suggestion, i) => { const { selectedSuggestion } = this.state; @@ -176,23 +178,30 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { if (suggestion.type === 'emoji') { inner = ; - key = suggestion.id; + key = suggestion.id; } else if (suggestion.type === 'hashtag') { inner = ; - key = suggestion.name; + key = suggestion.name; } else if (suggestion.type === 'account') { inner = ; - key = suggestion.id; + key = suggestion.id; } return ( -
+
{inner} -
+
); - } + }; - render () { + render() { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props; const { suggestionsHidden } = this.state; const style = { direction: 'ltr' }; @@ -202,10 +211,13 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } return [ -
+
-