about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-10-26 09:18:27 -0500
committerDavid Yip <yipdw@member.fsf.org>2017-10-26 09:18:27 -0500
commitdd28b94cf0ed1ed3b2d75fddb27fc4373298d659 (patch)
tree96e2517363e43e7d435bc1204b97e4769d5a3e20
parenta2612d0d3865fbbd6e8a93572f6d4e4044a8d64b (diff)
parentd556be2968641c265360297fd268a24119c68670 (diff)
Merge remote-tracking branch 'origin/master' into gs-master
-rw-r--r--app/javascript/mastodon/components/column_header.js4
-rw-r--r--app/javascript/styles/mastodon/components.scss18
-rw-r--r--lib/paperclip/gif_transcoder.rb1
-rw-r--r--spec/fixtures/files/mini-static.gifbin0 -> 1188 bytes
-rw-r--r--spec/models/media_attachment_spec.rb31
5 files changed, 36 insertions, 18 deletions
diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js
index c47296a51..71530ffdd 100644
--- a/app/javascript/mastodon/components/column_header.js
+++ b/app/javascript/mastodon/components/column_header.js
@@ -175,7 +175,9 @@ export default class ColumnHeader extends React.PureComponent {
       <div className={wrapperClassName}>
         <h1 tabIndex={focusable ? 0 : null} role='button' className={buttonClassName} aria-label={title} onClick={this.handleTitleClick}>
           <i className={`fa fa-fw fa-${icon} column-header__icon`} />
-          {title}
+          <span className='column-header__title'>
+            {title}
+          </span>
           <div className='column-header__buttons'>
             {backButton}
             { notifCleaning ? (
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index 076aa9576..2506bbe62 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -2503,6 +2503,7 @@ button.icon-button.active i.fa-retweet {
 }
 
 .column-header {
+  display: flex;
   padding: 15px;
   font-size: 16px;
   background: lighten($ui-base-color, 4%);
@@ -2528,12 +2529,10 @@ button.icon-button.active i.fa-retweet {
 }
 
 .column-header__buttons {
-  position: absolute;
-  right: 0;
-  top: 0;
-  height: 100%;
-  display: flex;
   height: 48px;
+  display: flex;
+  margin: -15px;
+  margin-left: 0;
 }
 
 .column-header__button {
@@ -2692,6 +2691,14 @@ button.icon-button.active i.fa-retweet {
   }
 }
 
+.column-header__title {
+  display: inline-block;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+  flex: 1;
+}
+
 .text-btn {
   display: inline-block;
   padding: 0;
@@ -3465,7 +3472,6 @@ button.icon-button.active i.fa-retweet {
   right: 0;
   bottom: 0;
   background: rgba($base-overlay-background, 0.7);
-  transform: translateZ(0);
 }
 
 .modal-root__container {
diff --git a/lib/paperclip/gif_transcoder.rb b/lib/paperclip/gif_transcoder.rb
index cbe53b27b..629e37581 100644
--- a/lib/paperclip/gif_transcoder.rb
+++ b/lib/paperclip/gif_transcoder.rb
@@ -10,6 +10,7 @@ module Paperclip
       unless options[:style] == :original && num_frames > 1
         tmp_file = Paperclip::TempfileFactory.new.generate(attachment.instance.file_file_name)
         tmp_file << file.read
+        tmp_file.flush
         return tmp_file
       end
 
diff --git a/spec/fixtures/files/mini-static.gif b/spec/fixtures/files/mini-static.gif
new file mode 100644
index 000000000..fe597b215
--- /dev/null
+++ b/spec/fixtures/files/mini-static.gif
Binary files differdiff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb
index 9fce5bc4f..435b4f326 100644
--- a/spec/models/media_attachment_spec.rb
+++ b/spec/models/media_attachment_spec.rb
@@ -20,20 +20,29 @@ RSpec.describe MediaAttachment, type: :model do
   end
 
   describe 'non-animated gif non-conversion' do
-    let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.gif')) }
+    fixtures = [
+      { filename: 'attachment.gif', width: 600, height: 400, aspect: 1.5 },
+      { filename: 'mini-static.gif', width: 32, height: 32, aspect: 1.0 },
+    ]
 
-    it 'sets type to image' do
-      expect(media.type).to eq 'image'
-    end
+    fixtures.each do |fixture|
+      context fixture[:filename] do
+        let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture(fixture[:filename])) }
 
-    it 'leaves original file as-is' do
-      expect(media.file_content_type).to eq 'image/gif'
-    end
+        it 'sets type to image' do
+          expect(media.type).to eq 'image'
+        end
 
-    it 'sets meta' do
-      expect(media.file.meta["original"]["width"]).to eq 600
-      expect(media.file.meta["original"]["height"]).to eq 400
-      expect(media.file.meta["original"]["aspect"]).to eq 1.5
+        it 'leaves original file as-is' do
+          expect(media.file_content_type).to eq 'image/gif'
+        end
+
+        it 'sets meta' do
+          expect(media.file.meta["original"]["width"]).to eq fixture[:width]
+          expect(media.file.meta["original"]["height"]).to eq fixture[:height]
+          expect(media.file.meta["original"]["aspect"]).to eq fixture[:aspect]
+        end
+      end
     end
   end