about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2017-07-20 11:24:32 -0400
committerGitHub <noreply@github.com>2017-07-20 11:24:32 -0400
commite7edb4d1eeba6c12a1c71271faa30d2bbf00d054 (patch)
treef373d05c4ea43bd335910f3603fab3d866a2486e /app/javascript
parentd2352246920800e491466d84b0146feb4d1d791f (diff)
parent1fcdaafa6fbe6d746a096c33263d76e6819da46d (diff)
Merge pull request #87 from tootsuite/master
merge upstream
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/actions/statuses.js2
-rw-r--r--app/javascript/mastodon/actions/timelines.js2
-rw-r--r--app/javascript/mastodon/components/status_list.js22
-rw-r--r--app/javascript/mastodon/emoji.js10
-rw-r--r--app/javascript/mastodon/emojione_light.js4
-rw-r--r--app/javascript/mastodon/locales/ja.json2
-rw-r--r--app/javascript/mastodon/locales/pl.json14
-rw-r--r--app/javascript/packs/public.js2
-rw-r--r--app/javascript/styles/components.scss4
9 files changed, 35 insertions, 27 deletions
diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js
index 8d385715c..2204e0b14 100644
--- a/app/javascript/mastodon/actions/statuses.js
+++ b/app/javascript/mastodon/actions/statuses.js
@@ -113,7 +113,7 @@ export function fetchContext(id) {
       dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
 
     }).catch(error => {
-      if (error.response.status === 404) {
+      if (error.response && error.response.status === 404) {
         dispatch(deleteFromTimelines(id));
       }
 
diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js
index dd14cb1cd..5c0cd93c7 100644
--- a/app/javascript/mastodon/actions/timelines.js
+++ b/app/javascript/mastodon/actions/timelines.js
@@ -105,7 +105,7 @@ export function refreshTimelineFail(timeline, error, skipLoading) {
     timeline,
     error,
     skipLoading,
-    skipAlert: error.response.status === 404,
+    skipAlert: error.response && error.response.status === 404,
   };
 };
 
diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js
index e7b38a07a..59f792920 100644
--- a/app/javascript/mastodon/components/status_list.js
+++ b/app/javascript/mastodon/components/status_list.js
@@ -30,8 +30,8 @@ export default class StatusList extends ImmutablePureComponent {
 
   intersectionObserverWrapper = new IntersectionObserverWrapper();
 
-  handleScroll = debounce((e) => {
-    const { scrollTop, scrollHeight, clientHeight } = e.target;
+  handleScroll = debounce(() => {
+    const { scrollTop, scrollHeight, clientHeight } = this.node;
     const offset = scrollHeight - scrollTop - clientHeight;
     this._oldScrollPosition = scrollHeight - scrollTop;
 
@@ -49,18 +49,22 @@ export default class StatusList extends ImmutablePureComponent {
   componentDidMount () {
     this.attachScrollListener();
     this.attachIntersectionObserver();
+
+    // Handle initial scroll posiiton
+    this.handleScroll();
   }
 
   componentDidUpdate (prevProps) {
     // Reset the scroll position when a new toot comes in in order not to
     // jerk the scrollbar around if you're already scrolled down the page.
-    if (prevProps.statusIds.size < this.props.statusIds.size &&
-        prevProps.statusIds.first() !== this.props.statusIds.first() &&
-        this._oldScrollPosition &&
-        this.node.scrollTop > 0) {
-      let newScrollTop = this.node.scrollHeight - this._oldScrollPosition;
-      if (this.node.scrollTop !== newScrollTop) {
-        this.node.scrollTop = newScrollTop;
+    if (prevProps.statusIds.size < this.props.statusIds.size && this._oldScrollPosition && this.node.scrollTop > 0) {
+      if (prevProps.statusIds.first() !== this.props.statusIds.first()) {
+        let newScrollTop = this.node.scrollHeight - this._oldScrollPosition;
+        if (this.node.scrollTop !== newScrollTop) {
+          this.node.scrollTop = newScrollTop;
+        }
+      } else {
+        this._oldScrollPosition = this.node.scrollHeight - this.node.scrollTop;
       }
     }
   }
diff --git a/app/javascript/mastodon/emoji.js b/app/javascript/mastodon/emoji.js
index 1de41f572..9b58cacf5 100644
--- a/app/javascript/mastodon/emoji.js
+++ b/app/javascript/mastodon/emoji.js
@@ -1,7 +1,7 @@
-import { unicodeToFilename } from './emojione_light';
+import { unicodeMapping } from './emojione_light';
 import Trie from 'substring-trie';
 
-const trie = new Trie(Object.keys(unicodeToFilename));
+const trie = new Trie(Object.keys(unicodeMapping));
 
 function emojify(str) {
   // This walks through the string from start to end, ignoring any tags (<p>, <br>, etc.)
@@ -19,10 +19,10 @@ function emojify(str) {
       insideTag = true;
     } else if (!insideTag && (match = trie.search(str.substring(i)))) {
       const unicodeStr = match;
-      if (unicodeStr in unicodeToFilename) {
-        const filename = unicodeToFilename[unicodeStr];
+      if (unicodeStr in unicodeMapping) {
+        const [filename, shortCode] = unicodeMapping[unicodeStr];
         const alt      = unicodeStr;
-        const replacement =  `<img draggable="false" class="emojione" alt="${alt}" src="/emoji/${filename}.svg" />`;
+        const replacement =  `<img draggable="false" class="emojione" alt="${alt}" title=":${shortCode}:" src="/emoji/${filename}.svg" />`;
         str = str.substring(0, i) + replacement + str.substring(i + unicodeStr.length);
         i += (replacement.length - unicodeStr.length); // jump ahead the length we've added to the string
       }
diff --git a/app/javascript/mastodon/emojione_light.js b/app/javascript/mastodon/emojione_light.js
index c75e10a98..985e9dbcb 100644
--- a/app/javascript/mastodon/emojione_light.js
+++ b/app/javascript/mastodon/emojione_light.js
@@ -5,7 +5,7 @@ const emojione = require('emojione');
 
 const mappedUnicode = emojione.mapUnicodeToShort();
 
-module.exports.unicodeToFilename = Object.keys(emojione.jsEscapeMap)
+module.exports.unicodeMapping = Object.keys(emojione.jsEscapeMap)
   .map(unicodeStr => [unicodeStr, mappedUnicode[emojione.jsEscapeMap[unicodeStr]]])
-  .map(([unicodeStr, shortCode]) => ({ [unicodeStr]: emojione.emojioneList[shortCode].fname }))
+  .map(([unicodeStr, shortCode]) => ({ [unicodeStr]: [emojione.emojioneList[shortCode].fname, shortCode.slice(1, shortCode.length - 1)] }))
   .reduce((x, y) => Object.assign(x, y), { });
diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json
index b3943f646..7fe27a092 100644
--- a/app/javascript/mastodon/locales/ja.json
+++ b/app/javascript/mastodon/locales/ja.json
@@ -56,7 +56,7 @@
   "confirmations.mute.confirm": "ミュート",
   "confirmations.mute.message": "本当に{name}をミュートしますか?",
   "confirmations.unfollow.confirm": "フォロー解除",
-  "confirmations.unfollow.message": "本当に{name}のフォローを解除しますか?",
+  "confirmations.unfollow.message": "本当に{name}をフォロー解除しますか?",
   "emoji_button.activity": "活動",
   "emoji_button.flags": "国旗",
   "emoji_button.food": "食べ物",
diff --git a/app/javascript/mastodon/locales/pl.json b/app/javascript/mastodon/locales/pl.json
index 683f589b1..348984648 100644
--- a/app/javascript/mastodon/locales/pl.json
+++ b/app/javascript/mastodon/locales/pl.json
@@ -55,8 +55,8 @@
   "confirmations.domain_block.message": "Czy na pewno chcesz zablokować całą domenę {domain}? Zwykle lepszym rozwiązaniem jest blokada lub wyciszenie kilku użytkowników.",
   "confirmations.mute.confirm": "Wycisz",
   "confirmations.mute.message": "Czy na pewno chcesz wyciszyć {name}?",
-  "confirmations.unfollow.confirm": "Unfollow",
-  "confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
+  "confirmations.unfollow.confirm": "Przestań śledzić",
+  "confirmations.unfollow.message": "Czy na pewno zamierzasz przestać śledzić {name}?",
   "emoji_button.activity": "Aktywność",
   "emoji_button.flags": "Flagi",
   "emoji_button.food": "Żywność i napoje",
@@ -111,8 +111,8 @@
   "notifications.column_settings.favourite": "Ulubione:",
   "notifications.column_settings.follow": "Nowi śledzący:",
   "notifications.column_settings.mention": "Wspomniali:",
-  "notifications.column_settings.push": "Push notifications",
-  "notifications.column_settings.push_meta": "This device",
+  "notifications.column_settings.push": "Powiadomienia push",
+  "notifications.column_settings.push_meta": "To urządzenie",
   "notifications.column_settings.reblog": "Podbili:",
   "notifications.column_settings.show": "Pokaż w kolumnie",
   "notifications.column_settings.sound": "Odtwarzaj dźwięk",
@@ -125,7 +125,7 @@
   "onboarding.page_one.handle": "Jesteś na domenie {domain}, więc Twój pełny adres to {handle}",
   "onboarding.page_one.welcome": "Witamy w Mastodon!",
   "onboarding.page_six.admin": "Administratorem tej instancji jest {admin}.",
-  "onboarding.page_six.almost_done": "Prawie gotowe...",
+  "onboarding.page_six.almost_done": "Prawie gotowe…",
   "onboarding.page_six.appetoot": "Bon Appetoot!",
   "onboarding.page_six.apps_available": "Są dostępne {apps} dla Androida, iOS i innych platform.",
   "onboarding.page_six.github": "Mastodon jest oprogramowaniem otwartoźródłwym. Możesz zgłaszać błędy, proponować funkcje i pomóc w rozwoju na {github}.",
@@ -151,7 +151,7 @@
   "report.target": "Zgłaszanie {target}",
   "search.placeholder": "Szukaj",
   "search_results.total": "{count, number} {count, plural, one {wynik} more {wyniki}}",
-  "standalone.public_title": "A look inside...",
+  "standalone.public_title": "Spojrzenie wgłąb…",
   "status.cannot_reblog": "Ten post nie może zostać podbity",
   "status.delete": "Usuń",
   "status.favourite": "Ulubione",
@@ -178,7 +178,7 @@
   "upload_area.title": "Przeciągnij i upuść aby wysłać",
   "upload_button.label": "Dodaj zawartość multimedialną",
   "upload_form.undo": "Cofnij",
-  "upload_progress.label": "Wysyłanie...",
+  "upload_progress.label": "Wysyłanie",
   "video_player.expand": "Przełącz wideo",
   "video_player.toggle_sound": "Przełącz dźwięk",
   "video_player.toggle_visible": "Przełącz widoczność",
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 1e89660f2..e34c47fd0 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -36,7 +36,7 @@ function main() {
 
     [].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {
       const datetime = new Date(content.getAttribute('datetime'));
-      content.textContent = relativeFormat.format(datetime);;
+      content.textContent = relativeFormat.format(datetime);
     });
   });
 
diff --git a/app/javascript/styles/components.scss b/app/javascript/styles/components.scss
index 0a8fa5e6d..0cd082985 100644
--- a/app/javascript/styles/components.scss
+++ b/app/javascript/styles/components.scss
@@ -4091,6 +4091,10 @@ button.icon-button.active i.fa-retweet {
   }
 }
 
+::-webkit-scrollbar-thumb {
+  border-radius: 0;
+}
+
 noscript {
   text-align: center;