Skip to content

Commit

Permalink
Merge branch 'master' into zunda-ninja-master-on-heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
zunda committed Sep 29, 2018
2 parents af9c8a6 + ef69c65 commit 3703fd9
Show file tree
Hide file tree
Showing 74 changed files with 202 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.2', require: 'mime/types/columnar'
gem 'nokogiri', '~> 1.8'
gem 'nsa', '~> 0.2'
gem 'oj', '~> 3.5'
gem 'oj', '~> 3.6'
gem 'ostatus2', '~> 2.0'
gem 'ox', '~> 2.9'
gem 'posix-spawn', git: 'https://github.com/rtomayko/posix-spawn', ref: '58465d2e213991f8afb13b984854a49fcdcc980c'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ GEM
rack (>= 0.9.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.3.0)
bootsnap (1.3.2)
msgpack (~> 1.0)
brakeman (4.2.1)
browser (2.5.3)
Expand Down Expand Up @@ -359,7 +359,7 @@ GEM
concurrent-ruby (~> 1.0.0)
sidekiq (>= 3.5.0)
statsd-ruby (~> 1.2.0)
oj (3.5.1)
oj (3.6.11)
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
Expand Down Expand Up @@ -563,9 +563,9 @@ GEM
thor (~> 0)
simple-navigation (4.0.5)
activesupport (>= 2.3.2)
simple_form (4.0.0)
actionpack (> 4)
activemodel (> 4)
simple_form (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -586,7 +586,7 @@ GEM
stoplight (2.1.3)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
strong_migrations (0.2.2)
strong_migrations (0.2.3)
activerecord (>= 3.2.0)
temple (0.8.0)
terminal-table (1.8.0)
Expand Down Expand Up @@ -708,7 +708,7 @@ DEPENDENCIES
net-ldap (~> 0.10)
nokogiri (~> 1.8)
nsa (~> 0.2)
oj (~> 3.5)
oj (~> 3.6)
omniauth (~> 1.2)
omniauth-cas (~> 1.1)
omniauth-saml (~> 1.10)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def limit_param(default_limit)
[params[:limit].to_i.abs, default_limit * 2].min
end

def params_slice(*keys)
params.slice(*keys).permit(*keys)
end

def current_resource_owner
@current_user ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
end
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/api/v1/accounts/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ def cached_account_statuses

def account_statuses
statuses = truthy_param?(:pinned) ? pinned_scope : permitted_account_statuses
statuses = statuses.paginate_by_max_id(
statuses = statuses.paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params_slice(:max_id, :since_id, :min_id)
)

statuses.merge!(only_media_scope) if truthy_param?(:only_media)
Expand Down Expand Up @@ -82,7 +81,7 @@ def next_path

def prev_path
unless @statuses.empty?
api_v1_account_statuses_url pagination_params(since_id: pagination_since_id)
api_v1_account_statuses_url pagination_params(min_id: pagination_since_id)
end
end

Expand Down
7 changes: 3 additions & 4 deletions app/controllers/api/v1/favourites_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ def cached_favourites
end

def results
@_results ||= account_favourites.paginate_by_max_id(
@_results ||= account_favourites.paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params_slice(:max_id, :since_id, :min_id)
)
end

Expand All @@ -49,7 +48,7 @@ def next_path

def prev_path
unless results.empty?
api_v1_favourites_url pagination_params(since_id: pagination_since_id)
api_v1_favourites_url pagination_params(min_id: pagination_since_id)
end
end

Expand Down
7 changes: 3 additions & 4 deletions app/controllers/api/v1/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ def load_notifications
end

def paginated_notifications
browserable_account_notifications.paginate_by_max_id(
browserable_account_notifications.paginate_by_id(
limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
params[:max_id],
params[:since_id]
params_slice(:max_id, :since_id, :min_id)
)
end

Expand All @@ -64,7 +63,7 @@ def next_path

def prev_path
unless @notifications.empty?
api_v1_notifications_url pagination_params(since_id: pagination_since_id)
api_v1_notifications_url pagination_params(min_id: pagination_since_id)
end
end

Expand Down
5 changes: 0 additions & 5 deletions app/controllers/api/v1/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ class Api::V1::ReportsController < Api::BaseController

respond_to :json

def index
@reports = current_account.reports
render json: @reports, each_serializer: REST::ReportSerializer
end

def create
@report = ReportService.new.call(
current_account,
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/api/v1/timelines/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def home_statuses
account_home_feed.get(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params[:since_id],
params[:min_id]
)
end

Expand All @@ -51,7 +52,7 @@ def next_path
end

def prev_path
api_v1_timelines_home_url pagination_params(since_id: pagination_since_id)
api_v1_timelines_home_url pagination_params(min_id: pagination_since_id)
end

def pagination_max_id
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/api/v1/timelines/list_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def list_statuses
list_feed.get(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params[:since_id],
params[:min_id]
)
end

Expand All @@ -53,7 +54,7 @@ def next_path
end

def prev_path
api_v1_timelines_list_url params[:id], pagination_params(since_id: pagination_since_id)
api_v1_timelines_list_url params[:id], pagination_params(min_id: pagination_since_id)
end

def pagination_max_id
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ def cached_public_statuses
end

def public_statuses
statuses = public_timeline_statuses.paginate_by_max_id(
statuses = public_timeline_statuses.paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params_slice(:max_id, :since_id, :min_id)
)

if truthy_param?(:only_media)
Expand Down Expand Up @@ -53,7 +52,7 @@ def next_path
end

def prev_path
api_v1_timelines_public_url pagination_params(since_id: pagination_since_id)
api_v1_timelines_public_url pagination_params(min_id: pagination_since_id)
end

def pagination_max_id
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/api/v1/timelines/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ def tagged_statuses
if @tag.nil?
[]
else
statuses = tag_timeline_statuses.paginate_by_max_id(
statuses = tag_timeline_statuses.paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params[:max_id],
params[:since_id]
params_slice(:max_id, :since_id, :min_id)
)

if truthy_param?(:only_media)
Expand Down Expand Up @@ -62,7 +61,7 @@ def next_path
end

def prev_path
api_v1_timelines_tag_url params[:id], pagination_params(since_id: pagination_since_id)
api_v1_timelines_tag_url params[:id], pagination_params(min_id: pagination_since_id)
end

def pagination_max_id
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def can?(action, record)

def fa_icon(icon, attributes = {})
class_names = attributes[:class]&.split(' ') || []
class_names << 'fas'
class_names << 'fa'
class_names += icon.split(' ').map { |cl| "fa-#{cl}" }

content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/mastodon/common.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Rails from 'rails-ujs';

export function start() {
require('@fortawesome/fontawesome-free/css/fontawesome.css');
require('@fortawesome/fontawesome-free/css/solid.css');
require('font-awesome/css/font-awesome.css');
require.context('../images/', true);

Rails.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
"width": "100px",
}
}
>
<i
className="fas fa-fw fa-robot bot-icon"
/>
</div>
/>
`;

exports[`<Avatar /> Still renders a still avatar 1`] = `
Expand All @@ -33,9 +29,5 @@ exports[`<Avatar /> Still renders a still avatar 1`] = `
"width": "100px",
}
}
>
<i
className="fas fa-fw fa-robot bot-icon"
/>
</div>
/>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('<Avatar />', () => {
display_name: 'Alice',
avatar: '/animated/alice.gif',
avatar_static: '/static/alice.jpg',
bot: true,
});

const size = 100;
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/components/attachment_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class AttachmentList extends ImmutablePureComponent {

return (
<li key={attachment.get('id')}>
<a href={displayUrl} target='_blank' rel='noopener'><i className='fas fa-link' /> {filename(displayUrl)}</a>
<a href={displayUrl} target='_blank' rel='noopener'><i className='fa fa-link' /> {filename(displayUrl)}</a>
</li>
);
})}
Expand All @@ -36,7 +36,7 @@ export default class AttachmentList extends ImmutablePureComponent {
return (
<div className='attachment-list'>
<div className='attachment-list__icon'>
<i className='fas fa-link' />
<i className='fa fa-link' />
</div>

<ul className='attachment-list__list'>
Expand Down
5 changes: 1 addition & 4 deletions app/javascript/mastodon/components/avatar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import BotIcon from './bot_icon';
import { autoPlayGif } from '../initial_state';

export default class Avatar extends React.PureComponent {
Expand Down Expand Up @@ -66,9 +65,7 @@ export default class Avatar extends React.PureComponent {
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
style={style}
>
<BotIcon account={account} />
</div>
/>
);
}

Expand Down
23 changes: 0 additions & 23 deletions app/javascript/mastodon/components/bot_icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/column_back_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class ColumnBackButton extends React.PureComponent {
render () {
return (
<button onClick={this.handleClick} className='column-back-button'>
<i className='fas fa-fw fa-chevron-left column-back-button__icon' />
<i className='fa fa-fw fa-chevron-left column-back-button__icon' />
<FormattedMessage id='column_back_button.label' defaultMessage='Back' />
</button>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ColumnBackButtonSlim extends ColumnBackButton {
return (
<div className='column-back-button--slim'>
<div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button column-back-button--slim-button'>
<i className='fas fa-fw fa-chevron-left column-back-button__icon' />
<i className='fa fa-fw fa-chevron-left column-back-button__icon' />
<FormattedMessage id='column_back_button.label' defaultMessage='Back' />
</div>
</div>
Expand Down
Loading

0 comments on commit 3703fd9

Please sign in to comment.