about summary refs log tree commit diff
path: root/app/javascript/mastodon
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon')
-rw-r--r--app/javascript/mastodon/actions/compose.js4
-rw-r--r--app/javascript/mastodon/features/compose/components/compose_form.js7
-rw-r--r--app/javascript/mastodon/features/compose/components/poll_form.js4
-rw-r--r--app/javascript/mastodon/initial_state.js1
-rw-r--r--app/javascript/mastodon/locales/defaultMessages.json13
-rw-r--r--app/javascript/mastodon/locales/en.json5
-rw-r--r--app/javascript/mastodon/locales/index.js10
-rw-r--r--app/javascript/mastodon/locales/ja.json5
-rw-r--r--app/javascript/mastodon/locales/locale-data/README.md221
-rw-r--r--app/javascript/mastodon/locales/locale-data/oc.js108
-rw-r--r--app/javascript/mastodon/locales/pl.json5
11 files changed, 39 insertions, 344 deletions
diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js
index 891403969..a60373fd5 100644
--- a/app/javascript/mastodon/actions/compose.js
+++ b/app/javascript/mastodon/actions/compose.js
@@ -175,7 +175,9 @@ export function submitCompose(routerHistory) {
 
       if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
         insertIfOnline('community');
-        insertIfOnline('public');
+        if (!response.data.local_only) {
+          insertIfOnline('public');
+        }
         insertIfOnline(`account:${response.data.account.id}`);
       }
     }).catch(function (error) {
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index 47e189251..46c52d9e4 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -20,6 +20,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
 import { length } from 'stringz';
 import { countableText } from '../util/counter';
 import Icon from 'mastodon/components/icon';
+import { maxChars } from '../../../initial_state';
 
 const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
 
@@ -88,7 +89,7 @@ class ComposeForm extends ImmutablePureComponent {
     const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
     const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
 
-    if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
+    if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
       return;
     }
 
@@ -181,7 +182,7 @@ class ComposeForm extends ImmutablePureComponent {
     const { intl, onPaste, showSearch, anyMedia } = this.props;
     const disabled = this.props.isSubmitting;
     const text     = [this.props.spoilerText, countableText(this.props.text)].join('');
-    const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
+    const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
     let publishText = '';
 
     if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
@@ -243,7 +244,7 @@ class ComposeForm extends ImmutablePureComponent {
             <PrivacyDropdownContainer />
             <SpoilerButtonContainer />
           </div>
-          <div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
+          <div className='character-counter__wrapper'><CharacterCounter max={maxChars} text={text} /></div>
         </div>
 
         <div className='compose-form__publish'>
diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js
index db49f90eb..88894ae59 100644
--- a/app/javascript/mastodon/features/compose/components/poll_form.js
+++ b/app/javascript/mastodon/features/compose/components/poll_form.js
@@ -89,7 +89,7 @@ class Option extends React.PureComponent {
 
           <AutosuggestInput
             placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
-            maxLength={50}
+            maxLength={100}
             value={title}
             onChange={this.handleOptionTitleChange}
             suggestions={this.props.suggestions}
@@ -157,7 +157,7 @@ class PollForm extends ImmutablePureComponent {
         </ul>
 
         <div className='poll__footer'>
-          <button disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
+          <button disabled={options.size >= 5} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
 
           {/* eslint-disable-next-line jsx-a11y/no-onchange */}
           <select value={expiresIn} onChange={this.handleSelectDuration}>
diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js
index 80d43907d..89b59051c 100644
--- a/app/javascript/mastodon/initial_state.js
+++ b/app/javascript/mastodon/initial_state.js
@@ -12,6 +12,7 @@ export const boostModal = getMeta('boost_modal');
 export const deleteModal = getMeta('delete_modal');
 export const me = getMeta('me');
 export const searchEnabled = getMeta('search_enabled');
+export const maxChars = (initialState && initialState.max_toot_chars) || 500;
 export const invitesEnabled = getMeta('invites_enabled');
 export const repository = getMeta('repository');
 export const source_url = getMeta('source_url');
diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json
index c49c6399d..bf7576975 100644
--- a/app/javascript/mastodon/locales/defaultMessages.json
+++ b/app/javascript/mastodon/locales/defaultMessages.json
@@ -2817,6 +2817,19 @@
   {
     "descriptors": [
       {
+        "defaultMessage": "Favourite",
+        "id": "status.favourite"
+      },
+      {
+        "defaultMessage": "You can press {combo} to skip this next time",
+        "id": "favourite_modal.combo"
+      }
+    ],
+    "path": "app/javascript/mastodon/features/ui/components/favourite_modal.json"
+  },
+  {
+    "descriptors": [
+      {
         "defaultMessage": "Network error",
         "id": "bundle_column_error.title"
       },
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index ccc95db7a..df9782efd 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -80,6 +80,10 @@
   "column_header.pin": "Pin",
   "column_header.show_settings": "Show settings",
   "column_header.unpin": "Unpin",
+  "column.heading": "Misc",
+  "column.subheading": "Miscellaneous options",
+  "column_subheading.lists": "Lists",
+  "column_subheading.navigation": "Navigation",
   "column_subheading.settings": "Settings",
   "community.column_settings.local_only": "Local only",
   "community.column_settings.media_only": "Media Only",
@@ -296,6 +300,7 @@
   "navigation_bar.info": "About this server",
   "navigation_bar.keyboard_shortcuts": "Hotkeys",
   "navigation_bar.lists": "Lists",
+  "navigation_bar.misc": "Misc",
   "navigation_bar.logout": "Logout",
   "navigation_bar.mutes": "Muted users",
   "navigation_bar.personal": "Personal",
diff --git a/app/javascript/mastodon/locales/index.js b/app/javascript/mastodon/locales/index.js
index 421cb7fab..7e7297561 100644
--- a/app/javascript/mastodon/locales/index.js
+++ b/app/javascript/mastodon/locales/index.js
@@ -1,9 +1 @@
-let theLocale;
-
-export function setLocale(locale) {
-  theLocale = locale;
-}
-
-export function getLocale() {
-  return theLocale;
-}
+export * from 'locales';
diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json
index 207bcf441..540fef36f 100644
--- a/app/javascript/mastodon/locales/ja.json
+++ b/app/javascript/mastodon/locales/ja.json
@@ -80,6 +80,10 @@
   "column_header.pin": "ピン留めする",
   "column_header.show_settings": "設定を表示",
   "column_header.unpin": "ピン留めを外す",
+  "column.heading": "その他",
+  "column.subheading": "その他のオプション",
+  "column_subheading.lists": "リスト",
+  "column_subheading.navigation": "ナビゲーション",
   "column_subheading.settings": "設定",
   "community.column_settings.local_only": "ローカルのみ表示",
   "community.column_settings.media_only": "メディアのみ表示",
@@ -302,6 +306,7 @@
   "navigation_bar.pins": "固定したトゥート",
   "navigation_bar.preferences": "ユーザー設定",
   "navigation_bar.public_timeline": "連合タイムライン",
+  "navigation_bar.misc": "その他",
   "navigation_bar.security": "セキュリティ",
   "notification.favourite": "{name}さんがあなたのトゥートをお気に入りに登録しました",
   "notification.follow": "{name}さんにフォローされました",
diff --git a/app/javascript/mastodon/locales/locale-data/README.md b/app/javascript/mastodon/locales/locale-data/README.md
deleted file mode 100644
index 83368fae7..000000000
--- a/app/javascript/mastodon/locales/locale-data/README.md
+++ /dev/null
@@ -1,221 +0,0 @@
-# Custom Locale Data
-
-This folder is used to store custom locale data. These custom locale data are
-not yet provided by [Unicode Common Locale Data Repository](http://cldr.unicode.org/development/new-cldr-developers)
-and hence not provided in [react-intl/locale-data/*](https://github.com/yahoo/react-intl).
-
-The locale data should support [Locale Data APIs](https://github.com/yahoo/react-intl/wiki/API#locale-data-apis)
-of the react-intl library.
-
-It is recommended to start your custom locale data from this sample English
-locale data ([*](#plural-rules)):
-
-```javascript
-/*eslint eqeqeq: "off"*/
-/*eslint no-nested-ternary: "off"*/
-
-export default [
-  {
-    locale: "en",
-    pluralRuleFunction: function(e, a) {
-      var n = String(e).split("."),
-        l = !n[1],
-        o = Number(n[0]) == e,
-        t = o && n[0].slice(-1),
-        r = o && n[0].slice(-2);
-      return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other"
-    },
-    fields: {
-      year: {
-        displayName: "year",
-        relative: {
-          0: "this year",
-          1: "next year",
-          "-1": "last year"
-        },
-        relativeTime: {
-          future: {
-            one: "in {0} year",
-            other: "in {0} years"
-          },
-          past: {
-            one: "{0} year ago",
-            other: "{0} years ago"
-          }
-        }
-      },
-      month: {
-        displayName: "month",
-        relative: {
-          0: "this month",
-          1: "next month",
-          "-1": "last month"
-        },
-        relativeTime: {
-          future: {
-            one: "in {0} month",
-            other: "in {0} months"
-          },
-          past: {
-            one: "{0} month ago",
-            other: "{0} months ago"
-          }
-        }
-      },
-      day: {
-        displayName: "day",
-        relative: {
-          0: "today",
-          1: "tomorrow",
-          "-1": "yesterday"
-        },
-        relativeTime: {
-          future: {
-            one: "in {0} day",
-            other: "in {0} days"
-          },
-          past: {
-            one: "{0} day ago",
-            other: "{0} days ago"
-          }
-        }
-      },
-      hour: {
-        displayName: "hour",
-        relativeTime: {
-          future: {
-            one: "in {0} hour",
-            other: "in {0} hours"
-          },
-          past: {
-            one: "{0} hour ago",
-            other: "{0} hours ago"
-          }
-        }
-      },
-      minute: {
-        displayName: "minute",
-        relativeTime: {
-          future: {
-            one: "in {0} minute",
-            other: "in {0} minutes"
-          },
-          past: {
-            one: "{0} minute ago",
-            other: "{0} minutes ago"
-          }
-        }
-      },
-      second: {
-        displayName: "second",
-        relative: {
-          0: "now"
-        },
-        relativeTime: {
-          future: {
-            one: "in {0} second",
-            other: "in {0} seconds"
-          },
-          past: {
-            one: "{0} second ago",
-            other: "{0} seconds ago"
-          }
-        }
-      }
-    }
-  }
-]
-
-```
-
-## Notes
-
-### Plural Rules
-
-The function `pluralRuleFunction()` should return the key to proper string of
-a plural form(s). The purpose of the function is to provide key of translate
-strings of correct plural form according. The different forms are described in
-[CLDR's Plural Rules][cldr-plural-rules],
-
-[cldr-plural-rules]: http://cldr.unicode.org/index/cldr-spec/plural-rules
-
-#### Quick Overview on CLDR Rules
-
-Let's take English as an example.
-
-When you describe a number, you can be either describe it as:
-* Cardinals: 1st, 2nd, 3rd ... 11th, 12th ... 21st, 22nd, 23nd ....
-* Ordinals: 1, 2, 3 ...
-
-In any of these cases, the nouns will reflect the number with singular or plural
-form. For example:
-* in 0 days
-* in 1 day
-* in 2 days
-
-The `pluralRuleFunction` receives 2 parameters:
-* `e`: a string representation of the number. Such as, "`1`", "`2`", "`2.1`".
-* `a`: `true` if this is "cardinal" type of description. `false` for ordinal and other case.
-
-#### How you should write `pluralRuleFunction`
-
-The first rule to write pluralRuleFunction is never translate the output string
-into your language. [Plural Rules][cldr-plural-rules] specified you should use
-these as the return values:
-
-  * "`zero`"
-  * "`one`" (singular)
-  * "`two`" (dual)
-  * "`few`" (paucal)
-  * "`many`" (also used for fractions if they have a separate class)
-  * "`other`" (required—general plural form—also used if the language only has a single form)
-
-Again, we'll use English as the example here.
-
-Let's read the `return` statement in the pluralRuleFunction above:
-```javascript
-  return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other"
-```
-
-This nested ternary is hard to read. It basically means:
-```javascript
-// e: the number variable to examine
-// a: "true" if cardinals
-// l: "true" if the variable e has nothin after decimal mark (e.g. "1.0" would be false)
-// o: "true" if the variable e is an integer
-// t: the "ones" of the number. e.g. "3" for number "9123"
-// r: the "ones" and "tens" of the number. e.g. "23" for number "9123"
-if (a == true) {
-  if (t == 1 && r != 11) {
-    return "one"; // i.e. 1st, 21st, 101st, 121st ...
-  } else if (t == 2 && r != 12) {
-    return "two"; // i.e. 2nd, 22nd, 102nd, 122nd ...
-  } else if (t == 3 && r != 13) {
-    return "few"; // i.e. 3rd, 23rd, 103rd, 123rd ...
-  } else {
-    return "other"; // i.e. 4th, 11th, 12th, 24th ...
-  }
-} else {
-  if (e == 1 && l) {
-    return "one"; // i.e. 1 day
-  } else {
-    return "other"; // i.e. 0 days, 2 days, 3 days
-  }
-}
-```
-
-If your language, like French, do not have complicated cardinal rules, you may
-use the French's version of it:
-```javascript
-function (e, a) {
-  return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other";
-}
-```
-
-If your language, like Chinese, do not have any pluralization rule at all you
-may use the Chinese's version of it:
-```javascript
-function (e, a) {
-  return "other";
-}
-```
diff --git a/app/javascript/mastodon/locales/locale-data/oc.js b/app/javascript/mastodon/locales/locale-data/oc.js
deleted file mode 100644
index d4adc42eb..000000000
--- a/app/javascript/mastodon/locales/locale-data/oc.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/*eslint eqeqeq: "off"*/
-/*eslint no-nested-ternary: "off"*/
-/*eslint quotes: "off"*/
-
-export default [{
-  locale: "oc",
-  pluralRuleFunction: function (e, a) {
-    return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other";
-  },
-  fields: {
-    year: {
-      displayName: "an",
-      relative: {
-        0: "ongan",
-        1: "l'an que ven",
-        "-1": "l'an passat",
-      },
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} an",
-          other: "d’aquí {0} ans",
-        },
-        past: {
-          one: "fa {0} an",
-          other: "fa {0} ans",
-        },
-      },
-    },
-    month: {
-      displayName: "mes",
-      relative: {
-        0: "aqueste mes",
-        1: "lo mes que ven",
-        "-1": "lo mes passat",
-      },
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} mes",
-          other: "d’aquí {0} meses",
-        },
-        past: {
-          one: "fa {0} mes",
-          other: "fa {0} meses",
-        },
-      },
-    },
-    day: {
-      displayName: "jorn",
-      relative: {
-        0: "uèi",
-        1: "deman",
-        "-1": "ièr",
-      },
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} jorn",
-          other: "d’aquí {0} jorns",
-        },
-        past: {
-          one: "fa {0} jorn",
-          other: "fa {0} jorns",
-        },
-      },
-    },
-    hour: {
-      displayName: "ora",
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} ora",
-          other: "d’aquí {0} oras",
-        },
-        past: {
-          one: "fa {0} ora",
-          other: "fa {0} oras",
-        },
-      },
-    },
-    minute: {
-      displayName: "minuta",
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} minuta",
-          other: "d’aquí {0} minutas",
-        },
-        past: {
-          one: "fa {0} minuta",
-          other: "fa {0} minutas",
-        },
-      },
-    },
-    second: {
-      displayName: "segonda",
-      relative: {
-        0: "ara",
-      },
-      relativeTime: {
-        future: {
-          one: "d’aquí {0} segonda",
-          other: "d’aquí {0} segondas",
-        },
-        past: {
-          one: "fa {0} segonda",
-          other: "fa {0} segondas",
-        },
-      },
-    },
-  },
-}];
diff --git a/app/javascript/mastodon/locales/pl.json b/app/javascript/mastodon/locales/pl.json
index e06952d19..02baf6465 100644
--- a/app/javascript/mastodon/locales/pl.json
+++ b/app/javascript/mastodon/locales/pl.json
@@ -80,6 +80,10 @@
   "column_header.pin": "Przypnij",
   "column_header.show_settings": "Pokaż ustawienia",
   "column_header.unpin": "Cofnij przypięcie",
+  "column.heading": "Różne",
+  "column.subheading": "Różne opcje",
+  "column_subheading.lists": "Listy",
+  "column_subheading.navigation": "Nawigacja",
   "column_subheading.settings": "Ustawienia",
   "community.column_settings.local_only": "Tylko Lokalne",
   "community.column_settings.media_only": "Tylko zawartość multimedialna",
@@ -297,6 +301,7 @@
   "navigation_bar.keyboard_shortcuts": "Skróty klawiszowe",
   "navigation_bar.lists": "Listy",
   "navigation_bar.logout": "Wyloguj",
+  "navigation_bar.misc": "Różne",
   "navigation_bar.mutes": "Wyciszeni użytkownicy",
   "navigation_bar.personal": "Osobiste",
   "navigation_bar.pins": "Przypięte wpisy",