Skip to content

Commit 2e839ad

Browse files
umonacadoubanius
authored andcommitted
Fix win95 theme bug (#17)
* Bump @babel/preset-react from 7.0.0 to 7.6.3 (mastodon#12315) Bumps [@babel/preset-react](https://github.com/babel/babel) from 7.0.0 to 7.6.3. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](babel/babel@v7.0.0...v7.6.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump sass from 1.23.1 to 1.23.3 (mastodon#12314) Bumps [sass](https://github.com/sass/dart-sass) from 1.23.1 to 1.23.3. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md) - [Commits](sass/dart-sass@1.23.1...1.23.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump glob from 7.1.4 to 7.1.5 (mastodon#12312) Bumps [glob](https://github.com/isaacs/node-glob) from 7.1.4 to 7.1.5. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/master/changelog.md) - [Commits](isaacs/node-glob@v7.1.4...v7.1.5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump tesseract.js from 2.0.0-alpha.16 to 2.0.0-beta.2 (mastodon#12311) Bumps [tesseract.js](https://github.com/naptha/tesseract.js) from 2.0.0-alpha.16 to 2.0.0-beta.2. - [Release notes](https://github.com/naptha/tesseract.js/releases) - [Commits](naptha/tesseract.js@v2.0.0-alpha.16...v2.0.0-beta.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump @babel/preset-env from 7.6.0 to 7.7.1 (mastodon#12318) Bumps [@babel/preset-env](https://github.com/babel/babel) from 7.6.0 to 7.7.1. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](babel/babel@v7.6.0...v7.7.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump @babel/runtime from 7.6.0 to 7.7.1 (mastodon#12317) Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.6.0 to 7.7.1. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.7.1/packages/babel-runtime) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Bump sass-loader from 7.1.0 to 8.0.0 (mastodon#12027) * Bump sass-loader from 7.1.0 to 8.0.0 Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 7.1.0 to 8.0.0. - [Release notes](https://github.com/webpack-contrib/sass-loader/releases) - [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md) - [Commits](webpack/sass-loader@v7.1.0...v8.0.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * bump webpack * Fix various issues with account migration (mastodon#12301) * Fix being able to follow oneself by moving to an account that was following the old one * Add specs * Add spec to catch MoveWorker issue with local followers following both accounts * Fix move worker breaking when a local account follows both source and target accounts * Fix migration from remote to local account not sending Undo Follow * Fix show_reblogs not being preserved for moved account's followers * Minor improvements to poll composing UI (mastodon#12319) - Disable the “add option” button instead of hiding it - Allow poll option inputs to scale to full width * Fix WebUI allowing to upload more items than the limit (mastodon#12300) Until this patch, drag'n'drop and copy-paste allowed to start uploading as long as the number of *finished* uploads was below the limit. * Fix relationship caches being broken as result of a follow request (mastodon#12299) * Fix type mismatch (mastodon#12324) This was [causing an issue with feed regeneartion in tootctl](hometown-fork#24), and @davefp fixed the issue. * Fix win95 profile page style * Increase profile page max width * Revert "Increase profile page max width" This reverts commit 4b10c37.
1 parent 5b4e932 commit 2e839ad

15 files changed

Lines changed: 490 additions & 283 deletions

File tree

app/javascript/mastodon/actions/compose.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ export function uploadCompose(files) {
207207
return function (dispatch, getState) {
208208
const uploadLimit = 4;
209209
const media = getState().getIn(['compose', 'media_attachments']);
210+
const pending = getState().getIn(['compose', 'pending_media_attachments']);
210211
const progress = new Array(files.length).fill(0);
211212
let total = Array.from(files).reduce((a, v) => a + v.size, 0);
212213

213-
if (files.length + media.size > uploadLimit) {
214+
if (files.length + media.size + pending > uploadLimit) {
214215
dispatch(showAlert(undefined, messages.uploadErrorLimit));
215216
return;
216217
}
@@ -237,7 +238,7 @@ export function uploadCompose(files) {
237238
dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
238239
},
239240
}).then(({ data }) => dispatch(uploadComposeSuccess(data, f)));
240-
}).catch(error => dispatch(uploadComposeFail(error)));
241+
}).catch(error => dispatch(uploadComposeFail(error, true)));
241242
};
242243
};
243244
};
@@ -268,10 +269,11 @@ export function changeUploadComposeSuccess(media) {
268269
};
269270
};
270271

271-
export function changeUploadComposeFail(error) {
272+
export function changeUploadComposeFail(error, decrement = false) {
272273
return {
273274
type: COMPOSE_UPLOAD_CHANGE_FAIL,
274275
error: error,
276+
decrement: decrement,
275277
skipLoading: true,
276278
};
277279
};

app/javascript/mastodon/features/compose/components/poll_form.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ class PollForm extends ImmutablePureComponent {
142142
</ul>
143143

144144
<div className='poll__footer'>
145-
{options.size < 4 && (
146-
<button className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
147-
)}
145+
<button disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
148146

149147
<select value={expiresIn} onChange={this.handleSelectDuration}>
150148
<option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option>

app/javascript/mastodon/features/compose/containers/upload_button_container.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import UploadButton from '../components/upload_button';
33
import { uploadCompose } from '../../../actions/compose';
44

55
const mapStateToProps = state => ({
6-
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
6+
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) > 3 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
77
unavailable: state.getIn(['compose', 'poll']) !== null,
88
resetFileKey: state.getIn(['compose', 'resetFileKey']),
99
});

app/javascript/mastodon/reducers/compose.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const initialState = ImmutableMap({
6363
is_uploading: false,
6464
progress: 0,
6565
media_attachments: ImmutableList(),
66+
pending_media_attachments: 0,
6667
poll: null,
6768
suggestion_token: null,
6869
suggestions: ImmutableList(),
@@ -118,6 +119,7 @@ function appendMedia(state, media, file) {
118119
map.set('is_uploading', false);
119120
map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
120121
map.set('idempotencyKey', uuid());
122+
map.update('pending_media_attachments', n => n - 1);
121123

122124
if (prevSize === 0 && (state.get('default_sensitive') || state.get('spoiler'))) {
123125
map.set('sensitive', true);
@@ -332,11 +334,11 @@ export default function compose(state = initialState, action) {
332334
case COMPOSE_UPLOAD_CHANGE_FAIL:
333335
return state.set('is_changing_upload', false);
334336
case COMPOSE_UPLOAD_REQUEST:
335-
return state.set('is_uploading', true);
337+
return state.set('is_uploading', true).update('pending_media_attachments', n => n + 1);
336338
case COMPOSE_UPLOAD_SUCCESS:
337339
return appendMedia(state, fromJS(action.media), action.file);
338340
case COMPOSE_UPLOAD_FAIL:
339-
return state.set('is_uploading', false);
341+
return state.set('is_uploading', false).update('pending_media_attachments', n => action.decrement ? n - 1 : n);
340342
case COMPOSE_UPLOAD_UNDO:
341343
return removeMedia(state, action.media_id);
342344
case COMPOSE_UPLOAD_PROGRESS:

app/javascript/styles/mastodon/components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@
392392
.autosuggest-input,
393393
.spoiler-input {
394394
position: relative;
395+
width: 100%;
395396
}
396397

397398
.spoiler-input {

app/javascript/styles/win95.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,3 +2589,7 @@ body {
25892589
.layout-single-column .status__wrapper .status {
25902590
padding-bottom: 50px;
25912591
}
2592+
2593+
.activity-stream .entry .status {
2594+
padding-bottom: 50px;
2595+
}

app/lib/feed_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def populate_feed(account)
153153
crutches = build_crutches(account.id, statuses)
154154

155155
statuses.each do |status|
156-
next if filter_from_home?(status, account, crutches)
156+
next if filter_from_home?(status, account.id, crutches)
157157

158158
add_to_feed(:home, account.id, status, aggregate)
159159
end

app/presenters/account_relationships_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class AccountRelationshipsPresenter
66
:endorsed
77

88
def initialize(account_ids, current_account_id, **options)
9-
@account_ids = account_ids.map { |a| a.is_a?(Account) ? a.id : a }
9+
@account_ids = account_ids.map { |a| a.is_a?(Account) ? a.id : a.to_i }
1010
@current_account_id = current_account_id
1111

1212
@following = cached[:following].merge(Account.following_map(@uncached_account_ids, @current_account_id))

app/services/follow_service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class FollowService < BaseService
88
# @param [Account] source_account From which to follow
99
# @param [String, Account] uri User URI to follow in the form of username@domain (or account record)
1010
# @param [true, false, nil] reblogs Whether or not to show reblogs, defaults to true
11-
def call(source_account, target_account, reblogs: nil)
11+
def call(source_account, target_account, reblogs: nil, bypass_locked: false)
1212
reblogs = true if reblogs.nil?
1313
target_account = ResolveAccountService.new.call(target_account, skip_webfinger: true)
1414

@@ -30,7 +30,7 @@ def call(source_account, target_account, reblogs: nil)
3030

3131
ActivityTracker.increment('activity:interactions')
3232

33-
if target_account.locked? || source_account.silenced? || target_account.activitypub?
33+
if (target_account.locked? && !bypass_locked) || source_account.silenced? || target_account.activitypub?
3434
request_follow(source_account, target_account, reblogs: reblogs)
3535
elsif target_account.local?
3636
direct_follow(source_account, target_account, reblogs: reblogs)

app/workers/move_worker.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def perform(source_account_id, target_account_id)
77
@source_account = Account.find(source_account_id)
88
@target_account = Account.find(target_account_id)
99

10-
if @target_account.local?
10+
if @target_account.local? && @source_account.local?
1111
rewrite_follows!
1212
else
1313
queue_follow_unfollows!
@@ -21,13 +21,17 @@ def perform(source_account_id, target_account_id)
2121
def rewrite_follows!
2222
@source_account.passive_relationships
2323
.where(account: Account.local)
24+
.where.not(account: @target_account.followers.local)
25+
.where.not(account_id: @target_account.id)
2426
.in_batches
2527
.update_all(target_account_id: @target_account.id)
2628
end
2729

2830
def queue_follow_unfollows!
31+
bypass_locked = @target_account.local?
32+
2933
@source_account.followers.local.select(:id).find_in_batches do |accounts|
30-
UnfollowFollowWorker.push_bulk(accounts.map(&:id)) { |follower_id| [follower_id, @source_account.id, @target_account.id] }
34+
UnfollowFollowWorker.push_bulk(accounts.map(&:id)) { |follower_id| [follower_id, @source_account.id, @target_account.id, bypass_locked] }
3135
end
3236
end
3337
end

0 commit comments

Comments
 (0)