Browse Source

Merge 2.7.1 (#7)

kɜ:ʳ cybredragon 1 week ago
parent
commit
f9722a0aec

+ 14
- 0
CHANGELOG.md View File

@@ -3,6 +3,20 @@ Changelog
3 3
 
4 4
 All notable changes to this project will be documented in this file.
5 5
 
6
+## [2.7.1] - 2019-01-28
7
+### Fixed
8
+
9
+- Fix SSO authentication not working due to missing agreement boolean ([Gargron](https://github.com/tootsuite/mastodon/pull/9915))
10
+- Fix slow fallback of CopyAccountStats migration setting stats to 0 ([Gargron](https://github.com/tootsuite/mastodon/pull/9930))
11
+- Fix wrong command in migration error message ([angristan](https://github.com/tootsuite/mastodon/pull/9877))
12
+- Fix initial value of volume slider in video player and handle volume changes ([ThibG](https://github.com/tootsuite/mastodon/pull/9929))
13
+- Fix missing hotkeys for notifications ([ThibG](https://github.com/tootsuite/mastodon/pull/9927))
14
+- Fix being able to attach unattached media created by other users ([ThibG](https://github.com/tootsuite/mastodon/pull/9921))
15
+- Fix unrescued SSL error during link verification ([renatolond](https://github.com/tootsuite/mastodon/pull/9914))
16
+- Fix Firefox scrollbar color regression ([trwnh](https://github.com/tootsuite/mastodon/pull/9908))
17
+- Fix scheduled status with media immediately creating a status ([ThibG](https://github.com/tootsuite/mastodon/pull/9894))
18
+- Fix missing strong style for landing page description ([Kjwon15](https://github.com/tootsuite/mastodon/pull/9892))
19
+
6 20
 ## [2.7.0] - 2019-01-20
7 21
 ### Added
8 22
 

+ 3
- 1
CONTRIBUTING.md View File

@@ -1,7 +1,7 @@
1 1
 Contributing
2 2
 ============
3 3
 
4
-Thank you for considering contributing to Mastodon 🐘 
4
+Thank you for considering contributing to Mastodon 🐘
5 5
 
6 6
 You can contribute in the following ways:
7 7
 
@@ -10,6 +10,8 @@ You can contribute in the following ways:
10 10
 - Contributing code to Mastodon by fixing bugs or implementing features
11 11
 - Improving the documentation
12 12
 
13
+If your contributions are accepted into Mastodon, you can request to be paid through [our OpenCollective](https://opencollective.com/mastodon).
14
+
13 15
 ## Bug reports
14 16
 
15 17
 Bug reports and feature suggestions can be submitted to [GitHub Issues](https://github.com/tootsuite/mastodon/issues). Please make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected in the past using the search function. Please also use descriptive, concise titles.

+ 1
- 1
Gemfile View File

@@ -23,7 +23,7 @@ gem 'paperclip-av-transcoder', '~> 0.6'
23 23
 gem 'streamio-ffmpeg', '~> 3.0'
24 24
 
25 25
 gem 'active_model_serializers', '~> 0.10'
26
-gem 'addressable', '~> 2.5'
26
+gem 'addressable', '~> 2.6'
27 27
 gem 'bootsnap', '~> 1.3', require: false
28 28
 gem 'browser'
29 29
 gem 'charlock_holmes', '~> 0.7.6'

+ 9
- 9
Gemfile.lock View File

@@ -62,7 +62,7 @@ GEM
62 62
       i18n (>= 0.7, < 2)
63 63
       minitest (~> 5.1)
64 64
       tzinfo (~> 1.1)
65
-    addressable (2.5.2)
65
+    addressable (2.6.0)
66 66
       public_suffix (>= 2.0.2, < 4.0)
67 67
     airbrussh (1.3.0)
68 68
       sshkit (>= 1.6.1, != 1.7.0)
@@ -290,8 +290,8 @@ GEM
290 290
     json-ld (3.0.2)
291 291
       multi_json (~> 1.12)
292 292
       rdf (>= 2.2.8, < 4.0)
293
-    json-ld-preloaded (3.0.0)
294
-      json-ld (>= 2.2, < 4.0)
293
+    json-ld-preloaded (3.0.2)
294
+      json-ld (~> 3.0)
295 295
       multi_json (~> 1.12)
296 296
       rdf (~> 3.0)
297 297
     jsonapi-renderer (0.2.0)
@@ -363,7 +363,7 @@ GEM
363 363
       concurrent-ruby (~> 1.0, >= 1.0.2)
364 364
       sidekiq (>= 3.5)
365 365
       statsd-ruby (~> 1.4, >= 1.4.0)
366
-    oj (3.7.7)
366
+    oj (3.7.8)
367 367
     omniauth (1.9.0)
368 368
       hashie (>= 3.4.6, < 3.7.0)
369 369
       rack (>= 1.6.2, < 3)
@@ -389,7 +389,7 @@ GEM
389 389
     paperclip-av-transcoder (0.6.4)
390 390
       av (~> 0.9.0)
391 391
       paperclip (>= 2.5.2)
392
-    parallel (1.12.1)
392
+    parallel (1.13.0)
393 393
     parallel_tests (2.27.1)
394 394
       parallel
395 395
     parser (2.6.0.0)
@@ -420,7 +420,7 @@ GEM
420 420
       pry (>= 0.10.4)
421 421
     public_suffix (3.0.3)
422 422
     puma (3.12.0)
423
-    pundit (2.0.0)
423
+    pundit (2.0.1)
424 424
       activesupport (>= 3.0.0)
425 425
     raabro (1.1.6)
426 426
     rack (2.0.6)
@@ -513,7 +513,7 @@ GEM
513 513
     rspec-mocks (3.8.0)
514 514
       diff-lcs (>= 1.2.0, < 2.0)
515 515
       rspec-support (~> 3.8.0)
516
-    rspec-rails (3.8.1)
516
+    rspec-rails (3.8.2)
517 517
       actionpack (>= 3.0)
518 518
       activesupport (>= 3.0)
519 519
       railties (>= 3.0)
@@ -525,7 +525,7 @@ GEM
525 525
       rspec-core (~> 3.0, >= 3.0.0)
526 526
       sidekiq (>= 2.4.0)
527 527
     rspec-support (3.8.0)
528
-    rubocop (0.63.0)
528
+    rubocop (0.63.1)
529 529
       jaro_winkler (~> 1.5.1)
530 530
       parallel (~> 1.10)
531 531
       parser (>= 2.5, != 2.5.1.1)
@@ -655,7 +655,7 @@ PLATFORMS
655 655
 DEPENDENCIES
656 656
   active_model_serializers (~> 0.10)
657 657
   active_record_query_trace (~> 1.5)
658
-  addressable (~> 2.5)
658
+  addressable (~> 2.6)
659 659
   annotate (~> 2.7)
660 660
   aws-sdk-s3 (~> 1.30)
661 661
   better_errors (~> 2.5)

+ 2
- 2
README.md View File

@@ -21,7 +21,7 @@ Click below to **learn more** in a video:
21 21
 
22 22
 [youtube_demo]: https://www.youtube.com/watch?v=IPSbNdBmWKE
23 23
 
24
-## Navigation 
24
+## Navigation
25 25
 
26 26
 - [Project homepage 🐘](https://joinmastodon.org)
27 27
 - [Support the development via Patreon][patreon]
@@ -80,7 +80,7 @@ A **Vagrant** configuration is included for development purposes.
80 80
 
81 81
 Mastodon is **free, open source software** licensed under **AGPLv3**.
82 82
 
83
-You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository, or submit translations using Weblate. To get started, take a look at [CONTRIBUTING.md](CONTRIBUTING.md)
83
+You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository, or submit translations using Weblate. To get started, take a look at [CONTRIBUTING.md](CONTRIBUTING.md). If your contributions are accepted into Mastodon, you can request to be paid through [our OpenCollective](https://opencollective.com/mastodon).
84 84
 
85 85
 **IRC channel**: #mastodon on irc.freenode.net
86 86
 

+ 26
- 4
app/javascript/mastodon/features/notifications/components/notification.js View File

@@ -29,6 +29,10 @@ class Notification extends ImmutablePureComponent {
29 29
     onMoveUp: PropTypes.func.isRequired,
30 30
     onMoveDown: PropTypes.func.isRequired,
31 31
     onMention: PropTypes.func.isRequired,
32
+    onFavourite: PropTypes.func.isRequired,
33
+    onReblog: PropTypes.func.isRequired,
34
+    onToggleHidden: PropTypes.func.isRequired,
35
+    status: PropTypes.option,
32 36
     intl: PropTypes.object.isRequired,
33 37
   };
34 38
 
@@ -64,14 +68,32 @@ class Notification extends ImmutablePureComponent {
64 68
     onMention(notification.get('account'), this.context.router.history);
65 69
   }
66 70
 
71
+  handleHotkeyFavourite = () => {
72
+    const { status } = this.props;
73
+    if (status) this.props.onFavourite(status);
74
+  }
75
+
76
+  handleHotkeyBoost = e => {
77
+    const { status } = this.props;
78
+    if (status) this.props.onReblog(status, e);
79
+  }
80
+
81
+  handleHotkeyToggleHidden = () => {
82
+    const { status } = this.props;
83
+    if (status) this.props.onToggleHidden(status);
84
+  }
85
+
67 86
   getHandlers () {
68 87
     return {
69
-      moveUp: this.handleMoveUp,
70
-      moveDown: this.handleMoveDown,
88
+      reply: this.handleMention,
89
+      favourite: this.handleHotkeyFavourite,
90
+      boost: this.handleHotkeyBoost,
91
+      mention: this.handleMention,
71 92
       open: this.handleOpen,
72 93
       openProfile: this.handleOpenProfile,
73
-      mention: this.handleMention,
74
-      reply: this.handleMention,
94
+      moveUp: this.handleMoveUp,
95
+      moveDown: this.handleMoveDown,
96
+      toggleHidden: this.handleHotkeyToggleHidden,
75 97
     };
76 98
   }
77 99
 

+ 53
- 4
app/javascript/mastodon/features/notifications/containers/notification_container.js View File

@@ -1,14 +1,31 @@
1 1
 import { connect } from 'react-redux';
2
-import { makeGetNotification } from '../../../selectors';
2
+import { makeGetNotification, makeGetStatus } from '../../../selectors';
3 3
 import Notification from '../components/notification';
4
+import { openModal } from '../../../actions/modal';
4 5
 import { mentionCompose } from '../../../actions/compose';
6
+import {
7
+  reblog,
8
+  favourite,
9
+  unreblog,
10
+  unfavourite,
11
+} from '../../../actions/interactions';
12
+import {
13
+  hideStatus,
14
+  revealStatus,
15
+} from '../../../actions/statuses';
16
+import { boostModal } from '../../../initial_state';
5 17
 
6 18
 const makeMapStateToProps = () => {
7 19
   const getNotification = makeGetNotification();
20
+  const getStatus = makeGetStatus();
8 21
 
9
-  const mapStateToProps = (state, props) => ({
10
-    notification: getNotification(state, props.notification, props.accountId),
11
-  });
22
+  const mapStateToProps = (state, props) => {
23
+    const notification = getNotification(state, props.notification, props.accountId);
24
+    return {
25
+      notification: notification,
26
+      status: notification.get('status') ? getStatus(state, { id: notification.get('status') }) : null,
27
+    };
28
+  };
12 29
 
13 30
   return mapStateToProps;
14 31
 };
@@ -17,6 +34,38 @@ const mapDispatchToProps = dispatch => ({
17 34
   onMention: (account, router) => {
18 35
     dispatch(mentionCompose(account, router));
19 36
   },
37
+
38
+  onModalReblog (status) {
39
+    dispatch(reblog(status));
40
+  },
41
+
42
+  onReblog (status, e) {
43
+    if (status.get('reblogged')) {
44
+      dispatch(unreblog(status));
45
+    } else {
46
+      if (e.shiftKey || !boostModal) {
47
+        this.onModalReblog(status);
48
+      } else {
49
+        dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
50
+      }
51
+    }
52
+  },
53
+
54
+  onFavourite (status) {
55
+    if (status.get('favourited')) {
56
+      dispatch(unfavourite(status));
57
+    } else {
58
+      dispatch(favourite(status));
59
+    }
60
+  },
61
+
62
+  onToggleHidden (status) {
63
+    if (status.get('hidden')) {
64
+      dispatch(revealStatus(status.get('id')));
65
+    } else {
66
+      dispatch(hideStatus(status.get('id')));
67
+    }
68
+  },
20 69
 });
21 70
 
22 71
 export default connect(makeMapStateToProps, mapDispatchToProps)(Notification);

+ 9
- 1
app/javascript/mastodon/features/video/index.js View File

@@ -136,6 +136,9 @@ class Video extends React.PureComponent {
136 136
 
137 137
   setVideoRef = c => {
138 138
     this.video = c;
139
+    if (this.video) {
140
+      this.setState({ volume: this.video.volume, muted: this.video.muted });
141
+    }
139 142
   }
140 143
 
141 144
   setSeekRef = c => {
@@ -302,6 +305,10 @@ class Video extends React.PureComponent {
302 305
     }
303 306
   }
304 307
 
308
+  handleVolumeChange = () => {
309
+    this.setState({ volume: this.video.volume, muted: this.video.muted });
310
+  }
311
+
305 312
   handleOpenVideo = () => {
306 313
     const { src, preview, width, height, alt } = this.props;
307 314
     const media = fromJS({
@@ -387,6 +394,7 @@ class Video extends React.PureComponent {
387 394
           onTimeUpdate={this.handleTimeUpdate}
388 395
           onLoadedData={this.handleLoadedData}
389 396
           onProgress={this.handleProgress}
397
+          onVolumeChange={this.handleVolumeChange}
390 398
         />
391 399
 
392 400
         <button type='button' className={classNames('video-player__spoiler', { active: !revealed })} onClick={this.toggleReveal}>
@@ -409,7 +417,7 @@ class Video extends React.PureComponent {
409 417
           <div className='video-player__buttons-bar'>
410 418
             <div className='video-player__buttons left'>
411 419
               <button type='button' aria-label={intl.formatMessage(paused ? messages.play : messages.pause)} onClick={this.togglePlay}><i className={classNames('fa fa-fw', { 'fa-play': paused, 'fa-pause': !paused })} /></button>
412
-              <button type='button' aria-label={intl.formatMessage(muted ? messages.unmute : messages.mute)} onMouseEnter={this.volumeSlider} onMouseLeave={this.volumeSlider} onClick={this.toggleMute}><i className={classNames('fa fa-fw', { 'fa-volume-off': muted, 'fa-volume-up': !muted })} /></button>
420
+              <button type='button' aria-label={intl.formatMessage(muted ? messages.unmute : messages.mute)} onClick={this.toggleMute}><i className={classNames('fa fa-fw', { 'fa-volume-off': muted, 'fa-volume-up': !muted })} /></button>
413 421
               <div className='video-player__volume' onMouseDown={this.handleVolumeMouseDown} ref={this.setVolumeRef}>
414 422
                 <div className='video-player__volume__current' style={{ width: `${volumeWidth}px` }} />
415 423
                 <span

+ 12
- 0
app/javascript/styles/mastodon/about.scss View File

@@ -845,6 +845,18 @@ $small-breakpoint: 960px;
845 845
       margin-bottom: 0;
846 846
     }
847 847
 
848
+    strong {
849
+      display: inline;
850
+      margin: 0;
851
+      padding: 0;
852
+      font-weight: 700;
853
+      background: transparent;
854
+      font-family: inherit;
855
+      font-size: inherit;
856
+      line-height: inherit;
857
+      color: lighten($darker-text-color, 10%);
858
+    }
859
+
848 860
     .account {
849 861
       border-bottom: 0;
850 862
       padding: 0;

+ 1
- 1
app/javascript/styles/mastodon/reset.scss View File

@@ -54,7 +54,7 @@ table {
54 54
 }
55 55
 
56 56
 html {
57
-  scrollbar-color: lighten($ui-base-color, 4%) transparent;
57
+  scrollbar-color: lighten($ui-base-color, 4%) rgba($base-overlay-background, 0.1);
58 58
 }
59 59
 
60 60
 ::-webkit-scrollbar {

+ 1
- 0
app/models/concerns/omniauthable.rb View File

@@ -63,6 +63,7 @@ module Omniauthable
63 63
       {
64 64
         email: email || "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
65 65
         password: Devise.friendly_token[0, 20],
66
+        agreement: true,
66 67
         account_attributes: {
67 68
           username: ensure_unique_username(auth.uid),
68 69
           display_name: display_name,

+ 2
- 0
app/models/user.rb View File

@@ -295,6 +295,7 @@ class User < ApplicationRecord
295 295
 
296 296
   def self.pam_get_user(attributes = {})
297 297
     return nil unless attributes[:email]
298
+
298 299
     resource =
299 300
       if Devise.check_at_sign && !attributes[:email].index('@')
300 301
         joins(:account).find_by(accounts: { username: attributes[:email] })
@@ -304,6 +305,7 @@ class User < ApplicationRecord
304 305
 
305 306
     if resource.blank?
306 307
       resource = new(email: attributes[:email], agreement: true)
308
+
307 309
       if Devise.check_at_sign && !resource[:email].index('@')
308 310
         resource[:email] = Rpam2.getenv(resource.find_pam_service, attributes[:email], attributes[:password], 'email', false)
309 311
         resource[:email] = "#{attributes[:email]}@#{resource.find_pam_suffix}" unless resource[:email]

+ 5
- 2
app/services/post_status_service.rb View File

@@ -66,7 +66,10 @@ class PostStatusService < BaseService
66 66
   end
67 67
 
68 68
   def schedule_status!
69
-    if @account.statuses.build(status_attributes).valid?
69
+    status_for_validation = @account.statuses.build(status_attributes)
70
+    if status_for_validation.valid?
71
+      status_for_validation.destroy
72
+
70 73
       # The following transaction block is needed to wrap the UPDATEs to
71 74
       # the media attachments when the scheduled status is created
72 75
 
@@ -90,7 +93,7 @@ class PostStatusService < BaseService
90 93
 
91 94
     raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4
92 95
 
93
-    @media = MediaAttachment.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
96
+    @media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
94 97
 
95 98
     raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:video?)
96 99
   end

+ 1
- 1
app/services/verify_link_service.rb View File

@@ -10,7 +10,7 @@ class VerifyLinkService < BaseService
10 10
     return unless link_back_present?
11 11
 
12 12
     field.mark_verified!
13
-  rescue HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e
13
+  rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e
14 14
     Rails.logger.debug "Error fetching link #{@url}: #{e}"
15 15
     nil
16 16
   end

+ 1
- 1
db/migrate/20181116173541_copy_account_stats.rb View File

@@ -44,7 +44,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2]
44 44
     # uniqueness violations that we need to skip over
45 45
     Account.unscoped.select('id, statuses_count, following_count, followers_count, created_at, updated_at').find_each do |account|
46 46
       begin
47
-        params = [[nil, account.id], [nil, account.statuses_count], [nil, account.following_count], [nil, account.followers_count], [nil, account.created_at], [nil, account.updated_at]]
47
+        params = [[nil, account.id], [nil, account[:statuses_count]], [nil, account[:following_count]], [nil, account[:followers_count]], [nil, account.created_at], [nil, account.updated_at]]
48 48
         exec_insert('INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)', nil, params)
49 49
       rescue ActiveRecord::RecordNotUnique
50 50
         next

+ 1
- 1
lib/mastodon/migration_helpers.rb View File

@@ -889,7 +889,7 @@ table #{table}.
889 889
 If you are using PostgreSQL you can solve this by logging in to the GitLab
890 890
 database (#{dbname}) using a super user and running:
891 891
 
892
-    ALTER #{user} WITH SUPERUSER
892
+    ALTER USER #{user} WITH SUPERUSER
893 893
 
894 894
 For MySQL you instead need to run:
895 895
 

+ 1
- 1
lib/mastodon/version.rb View File

@@ -13,7 +13,7 @@ module Mastodon
13 13
     end
14 14
 
15 15
     def patch
16
-      0
16
+      1
17 17
     end
18 18
 
19 19
     def pre

+ 28
- 1
spec/services/post_status_service_spec.rb View File

@@ -36,6 +36,20 @@ RSpec.describe PostStatusService, type: :service do
36 36
     expect(status.params['text']).to eq 'Hi future!'
37 37
   end
38 38
 
39
+  it 'does not immediately create a status when scheduling a status' do
40
+    account = Fabricate(:account)
41
+    media = Fabricate(:media_attachment)
42
+    future  = Time.now.utc + 2.hours
43
+
44
+    status = subject.call(account, text: 'Hi future!', media_ids: [media.id], scheduled_at: future)
45
+
46
+    expect(status).to be_a ScheduledStatus
47
+    expect(status.scheduled_at).to eq future
48
+    expect(status.params['text']).to eq 'Hi future!'
49
+    expect(media.reload.status).to be_nil
50
+    expect(Status.where(text: 'Hi future!').exists?).to be_falsey
51
+  end
52
+
39 53
   it 'creates response to the original status of boost' do
40 54
     boosted_status = Fabricate(:status)
41 55
     in_reply_to_status = Fabricate(:status, reblog: boosted_status)
@@ -153,7 +167,7 @@ RSpec.describe PostStatusService, type: :service do
153 167
 
154 168
   it 'attaches the given media to the created status' do
155 169
     account = Fabricate(:account)
156
-    media = Fabricate(:media_attachment)
170
+    media = Fabricate(:media_attachment, account: account)
157 171
 
158 172
     status = subject.call(
159 173
       account,
@@ -164,6 +178,19 @@ RSpec.describe PostStatusService, type: :service do
164 178
     expect(media.reload.status).to eq status
165 179
   end
166 180
 
181
+  it 'does not attach media from another account to the created status' do
182
+    account = Fabricate(:account)
183
+    media = Fabricate(:media_attachment, account: Fabricate(:account))
184
+
185
+    status = subject.call(
186
+      account,
187
+      text: "test status update",
188
+      media_ids: [media.id],
189
+    )
190
+
191
+    expect(media.reload.status).to eq nil
192
+  end
193
+
167 194
   it 'does not allow attaching more than 4 files' do
168 195
     account = Fabricate(:account)
169 196
 

Loading…
Cancel
Save