Skip to content

Commit

Permalink
[WIP] 誤打防止機能の追加 (#8)
Browse files Browse the repository at this point in the history
* Remove period from the version number (mastodon#6039)

2.1.0. -> 2.1.0

* Add Slovak translation (mastodon#6052)

* Add Slovak translation

* Slovak translation: i18n-normalize

* Update Korean translation (mastodon#6050)

* Update Korean translation

* Translate Korean for javascript

* Add missing translations on simple_form

* Replace <code> to <kbd> in KeyboardShortcuts component (mastodon#6049)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Rename settingKey in setting_toggle to settingPath (mastodon#6046)

* Display deleted users' role as “Suspended” (mastodon#6080)

Deleted users are technically suspended, but the code displaying their status
in the admin interface was broken and displayed a javascript object holding
translations of the possible user roles instead.

* Reduce the number of synchronous resolves when posting toots (mastodon#6075)

* enforce LOCAL_HTTPS=true in production (mastodon#6061)

* enforce https in production

* note changes in production env sample

* typo fix

* Move dropdown transform origin to top edge (mastodon#6091)

* removed references to hideOnMobile in column_link and getting_started (mastodon#6082)

* removed references to hideOnMobile in column_link and getting_started

* move keyboard shortcuts back below blocked users

* Refactor web_push_subscription (mastodon#6047)

* Remove onSave method in mapped properties for column_settings

* Make web_push_subscription.register an action

* Reduce motion for boost animation (mastodon#5871)

* Reduce motion for boost animation

Fixes mastodon#5833

* Fix ternary expression

* Add validation for onMuteNotifications (mastodon#6092)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Add validation for onMuteNotifications

* Add rake task to check and purge accounts that are missing in origin (mastodon#6085)

* Add rake task to check and purge accounts that are missing in origin

* Add progress bar and --force options to mastodon:maintenance:purge_removed_accounts

* Add supported Node.js version to package.json (mastodon#6096)

* Additional prop name change. (mastodon#6098)

* Add mute, block, conversation mute actions to detailed status dropdown menu (mastodon#6099)

* removed references to hideOnMobile in column_link and getting_started

* add mute, block, conversationMute actions to detailed status dropdown (fixes mastodon#1226)

* remove unused withDismiss in detailed status

* more faster index on notifications table (mastodon#6108)

* add ruby-progressbar to gemfile (fixes mastodon#6110) (mastodon#6111)

* Fix XML oEmbed support discovery (mastodon#6104)

* Move the mastodon on Getting Started column to drawer column (mastodon#6109)

Getting Started column obtained many links, and it became much taller.
Because of its height, Getting Started column required long scrolling on
devices with small screen, such as 4 inch phones and 10 inch laptops.

This change moves the mastodon which took large space on the column to
drawer column. The drawer column has only the compose form and has more
space.

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100) (mastodon#6101)

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100)

Drop common code for handling users and sessions as webfinger queries
are very basic, public APIs.

Also explicitly mark results as cacheable with “expires_in”.

* Add “Vary: Accept” header for caching since content-negociation is used

* bug fix (WebPush does not work) (mastodon#6120)

* Add more instance stats APIs (mastodon#6125)

* Add GET /api/v1/instance/peers API to reveal known domains

* Add GET /api/v1/instance/activity API

* Make new APIs disableable, exclude private statuses from activity stats

* Fix code style issue

* Fix week timestamps

* keep the same filters and page when doing custom emojo stuff (fixes mastodon#6112) (mastodon#6114)

* Translate Korean (mastodon#6131)

Relates to mastodon#6125, mastodon#6099

* Adding Serbian translation (mastodon#6133)

* Adding Serbian translation

* i18n-tasks normalize

* Delete elephant-fren.png

オリジナル画像に置換するため

*  Substitution 2 images.

オリジナルへの置換

* Update docker-compose.yml

Remove some #

* Show mastodon on modal (mastodon#6129)

* Use const instead of let for constant (mastodon#6106)

* Adding Serbian latin translations (mastodon#6146)

Serbian latin (sr-Latn) is generated automatically from Serbian (sr) translation. Also changed some wording in original (Serbian) translation.

* delete X-UA-Compatible (mastodon#6068)

* delete X-UA-Compatible

* undo

* restore

* Rename key to path in actions and reducers for settings (mastodon#6105)

* Fix stats expiring too quickly because of variable mistake (mastodon#6155)

* Display a warning when composing unlisted toots with something looking like a hashtag (mastodon#6132)

* Add confirmation step for email changes (mastodon#6071)

* Add confirmation step for email changes

This adds a confirmation step for email changes of existing users.
Like the initial account confirmation, a confirmation link is sent
to the new address.

Additionally, a notification is sent to the existing address when
the change is initiated. This message includes instruction to reset
the password immediately or to contact the instance admin if the
change was not initiated by the account owner.

Fixes mastodon#3871

* Add review fixes

* Fix newlines-to-spaces functionality (mastodon#6158)

yay for regexes, amirite

* Don't leave behind husk of remotely-deleted profile (mastodon#6159)

There's no reason for an Account record to persist after Delete->Actor is received. SuspendAccountService is necessary to make sure deleted toots get sent over streaming API properly and home feeds get cleaned up. By removing Account record, we can ensure that if in the future the account is restored remotely (or username reused), it can start with a clean slate.

* Update moved-to property when it's removed too (mastodon#6160)

* Fix mastodon#6140 - Update moved-to property when it's removed too

* Remove trailing whitespace

* [!] Sanitize incoming classlist properly (mastodon#6162)

* Sanitize classlist properly

* Actually properly sanitize every class after the first

* Improve Formatter spec to check for multiple classes and non-space whitespace

* Set background to the navigation of Getting Started column (mastodon#6163)

The background of the navigation matters because its scrollbar is
transparent.

* Allow HTTP caching of json view of public statuses (mastodon#6115)

* Allow HTTP caching of json view of public statuses

HTML views are not cached as they can contain private statuses as well

* Disable session cookies for ActivityPub json rendering of public toots

* Add Japanese translations mastodon#5997, mastodon#6003, mastodon#6004, mastodon#6071, mastodon#6099, mastodon#6125 and mastodon#6132 (mastodon#6167)

* yarn manage:translations

* Add Japanese translation for mastodon#5997

* Add Japanese translation for mastodon#6003

* Add Japanese translation for mastodon#6004

* Add Japanese translation for mastodon#6071

* Add Japanese translation for mastodon#6099

* Add Japanese translation for mastodon#6125

* Add Japanese translation for mastodon#6132

* i18n: Update Polish translation (mastodon#6168)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Allow to dereference Follow object for ActivityPub (mastodon#5772)

* Allow to dereference Follow object for ActivityPub

* Accept IRI as object representation for Accept activity

* Don't normalize URLs in toots (mastodon#6134)

* Don't normalize URLs in toots

URL normalization is ill-defined and may cause certain links to break.

* Change specs since we are not normalizing user-provided URLs

* l10n OC language (mastodon#6169)

* new strings: hashtag+unlisted, mute, block

* Add confirmation step for email changes

* Add more instance stats APIs

* Cache JSON of immutable ActivityPub representations (mastodon#6171)

* Fix OpenSSL dependency in ostatus2 (mastodon#6174)

* Fix nil error in log_target_from_history helper (mastodon#6173)

* Rearrange items in Getting Started navigation (mastodon#6126)

Though the subsections are representing features such as navigation and
settings, they are categorized by the ways how they are implemented
(internal navigation or external links.) They are irrelevant and some
arrangements were confusing because of that. (It is nonsense that instance
information is in settings subsection, for example.)

This fixes the issue by rearranging.

* Fix FetchAtomService not finding alternatives if there's a Link header (mastodon#6170)

without them, such as is the case with GNU social

Fixes the ability to find GNU social accounts via URL in search and
when using remote follow function

* Improve Traditional Chinese translation (mastodon#6166)

* Improve Traditional Chinese translations

* Sort alphabetically

* Make sure private toots remain private and do not end up in HTTP caches (mastodon#6175)

* Send one Delete of Actor in ActivityPub when account is suspended (mastodon#6172)

* i18n: Update Polish translation (mastodon#6176)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Fallback default thumbnail in instance status API (mastodon#6177)

* Bump version to 2.1.1 (mastodon#6164)

* Use disable_ddl_transaction! to prevent warnings on migration (mastodon#6183)

Migration is wrapped by transaction, so manual `commit_db_transaction` without transaction restarting causes "there is no transaction in progress" warnings. We should use `disable_ddl_transaction!` instead, if we can omit transaction completely.

* Fix overflowing audit logs (mastodon#6184)

* Fix email confirmation link not updating email (mastodon#6187)

A change introduced in mastodon#6125 prevents
`Devise::Models::Confirmable#confirm` from being called for existing
users, which in turn leads to `email` not being set to
`unconfirmed_email`, breaking email updates. This also adds a test
that would've caught this issue.

* Small translation fixes for Serbian (and sr@Latn too) (mastodon#6188)

* Fix RFC 5646 Regular Expression (mastodon#6190)

* Bump version to 2.1.2

* Remove some #

* Substitution some image.

* fixup! v3

* Substitution mastodon-ui.png

* ME3をv2.1.2に追従。 (#6)

* Remove period from the version number (mastodon#6039)

2.1.0. -> 2.1.0

* Add Slovak translation (mastodon#6052)

* Add Slovak translation

* Slovak translation: i18n-normalize

* Update Korean translation (mastodon#6050)

* Update Korean translation

* Translate Korean for javascript

* Add missing translations on simple_form

* Replace <code> to <kbd> in KeyboardShortcuts component (mastodon#6049)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Rename settingKey in setting_toggle to settingPath (mastodon#6046)

* Display deleted users' role as “Suspended” (mastodon#6080)

Deleted users are technically suspended, but the code displaying their status
in the admin interface was broken and displayed a javascript object holding
translations of the possible user roles instead.

* Reduce the number of synchronous resolves when posting toots (mastodon#6075)

* enforce LOCAL_HTTPS=true in production (mastodon#6061)

* enforce https in production

* note changes in production env sample

* typo fix

* Move dropdown transform origin to top edge (mastodon#6091)

* removed references to hideOnMobile in column_link and getting_started (mastodon#6082)

* removed references to hideOnMobile in column_link and getting_started

* move keyboard shortcuts back below blocked users

* Refactor web_push_subscription (mastodon#6047)

* Remove onSave method in mapped properties for column_settings

* Make web_push_subscription.register an action

* Reduce motion for boost animation (mastodon#5871)

* Reduce motion for boost animation

Fixes mastodon#5833

* Fix ternary expression

* Add validation for onMuteNotifications (mastodon#6092)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Add validation for onMuteNotifications

* Add rake task to check and purge accounts that are missing in origin (mastodon#6085)

* Add rake task to check and purge accounts that are missing in origin

* Add progress bar and --force options to mastodon:maintenance:purge_removed_accounts

* Add supported Node.js version to package.json (mastodon#6096)

* Additional prop name change. (mastodon#6098)

* Add mute, block, conversation mute actions to detailed status dropdown menu (mastodon#6099)

* removed references to hideOnMobile in column_link and getting_started

* add mute, block, conversationMute actions to detailed status dropdown (fixes mastodon#1226)

* remove unused withDismiss in detailed status

* more faster index on notifications table (mastodon#6108)

* add ruby-progressbar to gemfile (fixes mastodon#6110) (mastodon#6111)

* Fix XML oEmbed support discovery (mastodon#6104)

* Move the mastodon on Getting Started column to drawer column (mastodon#6109)

Getting Started column obtained many links, and it became much taller.
Because of its height, Getting Started column required long scrolling on
devices with small screen, such as 4 inch phones and 10 inch laptops.

This change moves the mastodon which took large space on the column to
drawer column. The drawer column has only the compose form and has more
space.

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100) (mastodon#6101)

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100)

Drop common code for handling users and sessions as webfinger queries
are very basic, public APIs.

Also explicitly mark results as cacheable with “expires_in”.

* Add “Vary: Accept” header for caching since content-negociation is used

* bug fix (WebPush does not work) (mastodon#6120)

* Add more instance stats APIs (mastodon#6125)

* Add GET /api/v1/instance/peers API to reveal known domains

* Add GET /api/v1/instance/activity API

* Make new APIs disableable, exclude private statuses from activity stats

* Fix code style issue

* Fix week timestamps

* keep the same filters and page when doing custom emojo stuff (fixes mastodon#6112) (mastodon#6114)

* Translate Korean (mastodon#6131)

Relates to mastodon#6125, mastodon#6099

* Adding Serbian translation (mastodon#6133)

* Adding Serbian translation

* i18n-tasks normalize

* Show mastodon on modal (mastodon#6129)

* Use const instead of let for constant (mastodon#6106)

* Adding Serbian latin translations (mastodon#6146)

Serbian latin (sr-Latn) is generated automatically from Serbian (sr) translation. Also changed some wording in original (Serbian) translation.

* delete X-UA-Compatible (mastodon#6068)

* delete X-UA-Compatible

* undo

* restore

* Rename key to path in actions and reducers for settings (mastodon#6105)

* Fix stats expiring too quickly because of variable mistake (mastodon#6155)

* Display a warning when composing unlisted toots with something looking like a hashtag (mastodon#6132)

* Add confirmation step for email changes (mastodon#6071)

* Add confirmation step for email changes

This adds a confirmation step for email changes of existing users.
Like the initial account confirmation, a confirmation link is sent
to the new address.

Additionally, a notification is sent to the existing address when
the change is initiated. This message includes instruction to reset
the password immediately or to contact the instance admin if the
change was not initiated by the account owner.

Fixes mastodon#3871

* Add review fixes

* Fix newlines-to-spaces functionality (mastodon#6158)

yay for regexes, amirite

* Don't leave behind husk of remotely-deleted profile (mastodon#6159)

There's no reason for an Account record to persist after Delete->Actor is received. SuspendAccountService is necessary to make sure deleted toots get sent over streaming API properly and home feeds get cleaned up. By removing Account record, we can ensure that if in the future the account is restored remotely (or username reused), it can start with a clean slate.

* Update moved-to property when it's removed too (mastodon#6160)

* Fix mastodon#6140 - Update moved-to property when it's removed too

* Remove trailing whitespace

* [!] Sanitize incoming classlist properly (mastodon#6162)

* Sanitize classlist properly

* Actually properly sanitize every class after the first

* Improve Formatter spec to check for multiple classes and non-space whitespace

* Set background to the navigation of Getting Started column (mastodon#6163)

The background of the navigation matters because its scrollbar is
transparent.

* Allow HTTP caching of json view of public statuses (mastodon#6115)

* Allow HTTP caching of json view of public statuses

HTML views are not cached as they can contain private statuses as well

* Disable session cookies for ActivityPub json rendering of public toots

* Add Japanese translations mastodon#5997, mastodon#6003, mastodon#6004, mastodon#6071, mastodon#6099, mastodon#6125 and mastodon#6132 (mastodon#6167)

* yarn manage:translations

* Add Japanese translation for mastodon#5997

* Add Japanese translation for mastodon#6003

* Add Japanese translation for mastodon#6004

* Add Japanese translation for mastodon#6071

* Add Japanese translation for mastodon#6099

* Add Japanese translation for mastodon#6125

* Add Japanese translation for mastodon#6132

* i18n: Update Polish translation (mastodon#6168)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Allow to dereference Follow object for ActivityPub (mastodon#5772)

* Allow to dereference Follow object for ActivityPub

* Accept IRI as object representation for Accept activity

* Don't normalize URLs in toots (mastodon#6134)

* Don't normalize URLs in toots

URL normalization is ill-defined and may cause certain links to break.

* Change specs since we are not normalizing user-provided URLs

* l10n OC language (mastodon#6169)

* new strings: hashtag+unlisted, mute, block

* Add confirmation step for email changes

* Add more instance stats APIs

* Cache JSON of immutable ActivityPub representations (mastodon#6171)

* Fix OpenSSL dependency in ostatus2 (mastodon#6174)

* Fix nil error in log_target_from_history helper (mastodon#6173)

* Rearrange items in Getting Started navigation (mastodon#6126)

Though the subsections are representing features such as navigation and
settings, they are categorized by the ways how they are implemented
(internal navigation or external links.) They are irrelevant and some
arrangements were confusing because of that. (It is nonsense that instance
information is in settings subsection, for example.)

This fixes the issue by rearranging.

* Fix FetchAtomService not finding alternatives if there's a Link header (mastodon#6170)

without them, such as is the case with GNU social

Fixes the ability to find GNU social accounts via URL in search and
when using remote follow function

* Improve Traditional Chinese translation (mastodon#6166)

* Improve Traditional Chinese translations

* Sort alphabetically

* Make sure private toots remain private and do not end up in HTTP caches (mastodon#6175)

* Send one Delete of Actor in ActivityPub when account is suspended (mastodon#6172)

* i18n: Update Polish translation (mastodon#6176)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Fallback default thumbnail in instance status API (mastodon#6177)

* Bump version to 2.1.1 (mastodon#6164)

* Use disable_ddl_transaction! to prevent warnings on migration (mastodon#6183)

Migration is wrapped by transaction, so manual `commit_db_transaction` without transaction restarting causes "there is no transaction in progress" warnings. We should use `disable_ddl_transaction!` instead, if we can omit transaction completely.

* Fix overflowing audit logs (mastodon#6184)

* Fix email confirmation link not updating email (mastodon#6187)

A change introduced in mastodon#6125 prevents
`Devise::Models::Confirmable#confirm` from being called for existing
users, which in turn leads to `email` not being set to
`unconfirmed_email`, breaking email updates. This also adds a test
that would've caught this issue.

* Small translation fixes for Serbian (and sr@Latn too) (mastodon#6188)

* Fix RFC 5646 Regular Expression (mastodon#6190)

* Bump version to 2.1.2

* l10n Occitan language: mailer update (mastodon#6193)

* Create email_changed.oc.html.erb

* Create email_changed.oc.text.erb

* Update email_changed.oc.html.erb

* Update email_changed.oc.html.erb

* Create reconfirmation_instructions.oc.html.erb

* Create reconfirmation_instructions.oc.text.erb

* Update confirmation_instructions.oc.html.erb

* Update confirmation_instructions.oc.text.erb

* Update confirmation_instructions.oc.html.erb

* Update reconfirmation_instructions.oc.html.erb

* Update reconfirmation_instructions.oc.text.erb

* Update reconfirmation_instructions.oc.html.erb

* Fix enforce HTTPS in production. (mastodon#6180)

* Represent numbers by strings in instance activity API (mastodon#6198)

Fixes mastodon#6197.

* When fetching an ActivityPub-enabled status, do not re-request it as text/html (mastodon#6196)

* Fix PuSH workers (mastodon#6200)

* 誤打防止機能を追加

* トゥートボタンを改善
  • Loading branch information
GenbuHase committed Jan 9, 2018
1 parent 2a8bc21 commit 246e38e
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 161 deletions.
130 changes: 70 additions & 60 deletions app/javascript/mastodon/actions/UtilBtns.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,89 @@ export const UTILBTNS_RISA = 'UTILBTNS_RISA';
export const UTILBTNS_GOJI = 'UTILBTNS_GOJI';
export const UTILBTNS_HARUKIN = 'UTILBTNS_HARUKIN';

export function submitRisa (content = "") {
return function (dispatch, getState) {
let text = `@RISA ${content}`;
export function submitRisa (textarea) {
return function (dispatch, getState) {
let text = `@RISA ${textarea.value}`;

dispatch(submitRisaRequest());
dispatch(changeCompose(text));
}
dispatch(submitRisaRequest());
dispatch(changeCompose(text));

textarea.focus();
}
}

export function submitRisaRequest () {
return {
type: UTILBTNS_RISA
}
return {
type: UTILBTNS_RISA
}
}

export function submitGoji () {
return function (dispatch, getState) {
let text = [
"#誤字に淫夢厨",
":goji:"
].join("\r\n");
export function submitGoji (textarea) {
return function (dispatch, getState) {
if (!textarea.value) {
let text = [
"#誤字に淫夢厨",
":goji:"
].join("\r\n");

dispatch(submitGojiRequest());
dispatch(changeCompose(text));

dispatch(submitGojiRequest());
dispatch(changeCompose(text));
}
textarea.focus();
}
}
}

export function submitGojiRequest () {
return {
type: UTILBTNS_GOJI
}
return {
type: UTILBTNS_GOJI
}
}

export function submitHarukin () {
return function (dispatch, getState) {
let text = "";

let quantity = Math.round(Math.random() * 6 + 1),
type = Math.round(Math.random() + 1);

let harukin = "";

switch (type) {
case 1:
harukin = ":harukin: ";
break;

case 2:
harukin = ":harukin_old: ";
break;
}

switch (quantity) {
default:
text = [
harukin.repeat(quantity),
"🔥 ".repeat(quantity)
].join("\r\n");

break;

case 7:
text = `${harukin}💕\r\n`.repeat(6);
break;
}

dispatch(submitHarukinRequest());
dispatch(changeCompose(text));
}
export function submitHarukin (textarea) {
return function (dispatch, getState) {
if (!textarea.value) {
let text = "";

let quantity = Math.round(Math.random() * 6 + 1),
type = Math.round(Math.random() + 1);

let harukin = "";

switch (type) {
case 1:
harukin = ":harukin: ";
break;

case 2:
harukin = ":harukin_old: ";
break;
}

switch (quantity) {
default:
text = [
harukin.repeat(quantity),
"🔥 ".repeat(quantity)
].join("\r\n");

break;

case 7:
text = `${harukin}💕\r\n`.repeat(6);
break;
}

dispatch(submitHarukinRequest());
dispatch(changeCompose(text));

textarea.focus();
}
}
}

export function submitHarukinRequest () {
return {
type: UTILBTNS_HARUKIN
}
return {
type: UTILBTNS_HARUKIN
}
}
33 changes: 0 additions & 33 deletions app/javascript/mastodon/features/compose/components/UtilBtns.js

This file was deleted.

36 changes: 25 additions & 11 deletions app/javascript/mastodon/features/compose/components/compose_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ import { isMobile } from '../../../is_mobile';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz';
import { countableText } from '../util/counter';
import UtilBtns from '../containers/UtilBtns_container';
import { UserCounter } from './user_counter';

const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
publish: { id: 'compose_form.publish', defaultMessage: 'Toot' },
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },

risa: { id: 'compose_form.UtilBtns_risa', defaultMessage: 'RISA' }
utilBtns_risa: { id: 'compose_form.utilBtns_risa', defaultMessage: 'RISA' },
utilBtns_goji: { id: 'compose_form.utilBtns_goji', defaultMessage: 'Typo!!!' },
utilBtns_harukin: { id: 'compose_form.utilBtns_harukin', defaultMessage: 'Burn Harukin' }
});

@injectIntl
Expand Down Expand Up @@ -54,7 +56,9 @@ export default class ComposeForm extends ImmutablePureComponent {
onPickEmoji: PropTypes.func.isRequired,
showSearch: PropTypes.bool,

onRisaSubmit: PropTypes.func.isRequired
onRisaSubmit: PropTypes.func.isRequired,
onGojiSubmit: PropTypes.func.isRequired,
onHarukinSubmit: PropTypes.func.isRequired
};

static defaultProps = {
Expand Down Expand Up @@ -145,11 +149,10 @@ export default class ComposeForm extends ImmutablePureComponent {
this._restoreCaret = position + emojiChar.length + 1;
this.props.onPickEmoji(position, data);
}

handleOnRisaSubmit = () => {
this.props.onRisaSubmit(this.autosuggestTextarea.textarea.value);
this.autosuggestTextarea.textarea.focus();
}

handleOnRisaSubmit = () => this.props.onRisaSubmit(this.autosuggestTextarea.textarea);
handleOnGojiSubmit = () => this.props.onGojiSubmit(this.autosuggestTextarea.textarea);
handleOnHarukinSubmit = () => this.props.onHarukinSubmit(this.autosuggestTextarea.textarea);

render () {
const { intl, onPaste, showSearch } = this.props;
Expand Down Expand Up @@ -213,13 +216,24 @@ export default class ComposeForm extends ImmutablePureComponent {
</div>

<div className='compose-form__publish'>
<div className="user-counter__wrapper">
<i className="fa fa-users"></i>
<span>10人</span>
</div>

<div className='compose-form__publish-button-wrapper'>
<Button id="utilBtns__button--risa" className="utilBtns__button" text={intl.formatMessage(messages.risa)} onClick={this.handleOnRisaSubmit} block />
<Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block />
<Button className="compose-form__utilBtns-risa" text={intl.formatMessage(messages.utilBtns_risa)} onClick={this.handleOnRisaSubmit} />

<Button onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block>
<span className="fa fa-send">{publishText}</span>
</Button>
</div>
</div>

<UtilBtns />
<div className="compose-form__utilBtns">
<Button className="compose-form__utilBtns-goji" text={intl.formatMessage(messages.utilBtns_goji)} onClick={this.handleOnGojiSubmit} block />
<Button className="compose-form__utilBtns-harukin" text={intl.formatMessage(messages.utilBtns_harukin)} onClick={this.handleOnHarukinSubmit} block />
</div>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';

export default class UserCounter extends React.PureComponent {
render () {
return (
<span>10人</span>
);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
insertEmojiCompose,
} from '../../../actions/compose';

import { submitRisa } from '../../../actions/UtilBtns';
import {
submitRisa,
submitGoji,
submitHarukin
} from '../../../actions/UtilBtns';

const mapStateToProps = state => ({
text: state.getIn(['compose', 'text']),
Expand Down Expand Up @@ -61,9 +65,17 @@ const mapDispatchToProps = (dispatch) => ({
onPickEmoji (position, data) {
dispatch(insertEmojiCompose(position, data));
},

onRisaSubmit (textarea) {
dispatch(submitRisa(textarea));
},

onGojiSubmit (textarea) {
dispatch(submitGoji(textarea));
},

onRisaSubmit (content) {
dispatch(submitRisa(content));
onHarukinSubmit (textarea) {
dispatch(submitHarukin(textarea));
},

});
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/locales/defaultMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,15 @@
},
{
"defaultMessage": "RISA",
"id": "compose_form.UtilBtns_risa"
"id": "compose_form.utilBtns_risa"
},
{
"defaultMessage": "Typo!!!",
"id": "compose_form.UtilBtns_goji"
"id": "compose_form.utilBtns_goji"
},
{
"defaultMessage": "Burn Harukin",
"id": "compose_form.UtilBtns_harukin"
"id": "compose_form.utilBtns_harukin"
}
],
"path": "app/javascript/mastodon/features/compose/components/compose_form.json"
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"compose_form.sensitive": "Mark media as sensitive",
"compose_form.spoiler": "Hide text behind warning",
"compose_form.spoiler_placeholder": "Write your warning here",
"compose_form.UtilBtns_risa": "RISA",
"compose_form.UtilBtns_goji": "Typo!!!",
"compose_form.UtilBtns_harukin": "Burn Harukin",
"compose_form.utilBtns_risa": "RISA",
"compose_form.utilBtns_goji": "Typo!!!",
"compose_form.utilBtns_harukin": "Burn Harukin",
"confirmation_modal.cancel": "Cancel",
"confirmations.block.confirm": "Block",
"confirmations.block.message": "Are you sure you want to block {name}?",
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"compose_form.sensitive": "メディアを閲覧注意としてマークする",
"compose_form.spoiler": "テキストを隠す",
"compose_form.spoiler_placeholder": "ここに警告を書いてください",
"compose_form.UtilBtns_risa": "りさ姉",
"compose_form.UtilBtns_goji": "ゴジモリィィィィィィ!!!",
"compose_form.UtilBtns_harukin": "はるきん焼却",
"compose_form.utilBtns_risa": "りさ姉",
"compose_form.utilBtns_goji": "ゴジモリィィィィィィ!!!",
"compose_form.utilBtns_harukin": "はるきん焼却",
"confirmation_modal.cancel": "キャンセル",
"confirmations.block.confirm": "ブロック",
"confirmations.block.message": "本当に{name}さんをブロックしますか?",
Expand Down
18 changes: 0 additions & 18 deletions app/javascript/mastodon/reducers/UtilBtns.js

This file was deleted.

Loading

0 comments on commit 246e38e

Please sign in to comment.