Removed accidental n+1 query from notifications, updated some deps,
improved how "show more" link looks
This commit is contained in:
parent
2f18c77e44
commit
cc5c1e5feb
7 changed files with 36 additions and 25 deletions
4
Gemfile
4
Gemfile
|
@ -79,7 +79,7 @@ end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem 'rails_12factor'
|
gem 'rails_12factor'
|
||||||
gem 'lograge'
|
|
||||||
gem 'redis-rails'
|
gem 'redis-rails'
|
||||||
gem 'rack-timeout-puma'
|
gem 'lograge'
|
||||||
|
gem 'rack-timeout'
|
||||||
end
|
end
|
||||||
|
|
14
Gemfile.lock
14
Gemfile.lock
|
@ -72,7 +72,7 @@ GEM
|
||||||
browserify-rails (3.1.0)
|
browserify-rails (3.1.0)
|
||||||
railties (>= 4.0.0, < 5.1)
|
railties (>= 4.0.0, < 5.1)
|
||||||
sprockets (>= 3.5.2)
|
sprockets (>= 3.5.2)
|
||||||
builder (3.2.2)
|
builder (3.2.3)
|
||||||
bullet (5.3.0)
|
bullet (5.3.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.10.0)
|
uniform_notifier (~> 1.10.0)
|
||||||
|
@ -198,7 +198,7 @@ GEM
|
||||||
minitest (5.10.1)
|
minitest (5.10.1)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
nio4r (1.2.1)
|
nio4r (1.2.1)
|
||||||
nokogiri (1.6.8.1)
|
nokogiri (1.7.0.1)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
oj (2.17.3)
|
oj (2.17.3)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
|
@ -244,8 +244,6 @@ GEM
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rack-timeout (0.4.2)
|
rack-timeout (0.4.2)
|
||||||
rack-timeout-puma (0.0.1)
|
|
||||||
rack-timeout (~> 0.2, >= 0.2.0)
|
|
||||||
rails (5.0.1)
|
rails (5.0.1)
|
||||||
actioncable (= 5.0.1)
|
actioncable (= 5.0.1)
|
||||||
actionmailer (= 5.0.1)
|
actionmailer (= 5.0.1)
|
||||||
|
@ -258,9 +256,9 @@ GEM
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 5.0.1)
|
railties (= 5.0.1)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (2.0.1)
|
rails-dom-testing (2.0.2)
|
||||||
activesupport (>= 4.2.0, < 6.0)
|
activesupport (>= 4.2.0, < 6.0)
|
||||||
nokogiri (~> 1.6.0)
|
nokogiri (~> 1.6)
|
||||||
rails-html-sanitizer (1.0.3)
|
rails-html-sanitizer (1.0.3)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.0)
|
||||||
rails-settings-cached (0.6.5)
|
rails-settings-cached (0.6.5)
|
||||||
|
@ -450,7 +448,7 @@ DEPENDENCIES
|
||||||
rabl
|
rabl
|
||||||
rack-attack
|
rack-attack
|
||||||
rack-cors
|
rack-cors
|
||||||
rack-timeout-puma
|
rack-timeout
|
||||||
rails (~> 5.0.1.0)
|
rails (~> 5.0.1.0)
|
||||||
rails-settings-cached
|
rails-settings-cached
|
||||||
rails_12factor
|
rails_12factor
|
||||||
|
@ -476,4 +474,4 @@ RUBY VERSION
|
||||||
ruby 2.3.1p112
|
ruby 2.3.1p112
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.13.7
|
1.14.3
|
||||||
|
|
|
@ -3,6 +3,17 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||||
import emojify from '../emoji';
|
import emojify from '../emoji';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
const spoilerStyle = {
|
||||||
|
display: 'inline-block',
|
||||||
|
borderRadius: '2px',
|
||||||
|
color: '#363c4b',
|
||||||
|
fontWeight: '500',
|
||||||
|
fontSize: '11px',
|
||||||
|
padding: '0px 6px',
|
||||||
|
textTransform: 'uppercase',
|
||||||
|
lineHeight: 'inherit'
|
||||||
|
};
|
||||||
|
|
||||||
const StatusContent = React.createClass({
|
const StatusContent = React.createClass({
|
||||||
|
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
|
@ -86,16 +97,6 @@ const StatusContent = React.createClass({
|
||||||
|
|
||||||
const content = { __html: emojify(status.get('content')) };
|
const content = { __html: emojify(status.get('content')) };
|
||||||
const spoilerContent = { __html: emojify(status.get('spoiler_text', '')) };
|
const spoilerContent = { __html: emojify(status.get('spoiler_text', '')) };
|
||||||
const spoilerStyle = {
|
|
||||||
backgroundColor: '#616b86',
|
|
||||||
borderRadius: '4px',
|
|
||||||
color: '#363c4b',
|
|
||||||
fontWeight: '500',
|
|
||||||
fontSize: '12px',
|
|
||||||
padding: '0 4px',
|
|
||||||
textTransform: 'uppercase'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (status.get('spoiler_text').length > 0) {
|
if (status.get('spoiler_text').length > 0) {
|
||||||
const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />;
|
const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />;
|
||||||
|
@ -103,7 +104,7 @@ const StatusContent = React.createClass({
|
||||||
return (
|
return (
|
||||||
<div className='status__content' style={{ cursor: 'pointer' }} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
|
<div className='status__content' style={{ cursor: 'pointer' }} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
|
||||||
<p style={{ marginBottom: hidden ? '0px' : '' }} >
|
<p style={{ marginBottom: hidden ? '0px' : '' }} >
|
||||||
<span dangerouslySetInnerHTML={spoilerContent} /> <a style={spoilerStyle} onClick={this.handleSpoilerClick}>[{toggleText}]</a>
|
<span dangerouslySetInnerHTML={spoilerContent} /> <a className='status__content__spoiler-link' style={spoilerStyle} onClick={this.handleSpoilerClick}>{toggleText}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div style={{ display: hidden ? 'none' : 'block' }} dangerouslySetInnerHTML={content} />
|
<div style={{ display: hidden ? 'none' : 'block' }} dangerouslySetInnerHTML={content} />
|
||||||
|
|
|
@ -137,6 +137,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status__content__spoiler-link {
|
||||||
|
background: lighten($color1, 26%);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: lighten($color1, 29%);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailed-status {
|
.detailed-status {
|
||||||
|
|
|
@ -66,6 +66,8 @@ class Notification < ApplicationRecord
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_from_account
|
def set_from_account
|
||||||
|
return unless new_record?
|
||||||
|
|
||||||
case activity_type
|
case activity_type
|
||||||
when 'Status', 'Follow', 'Favourite', 'FollowRequest'
|
when 'Status', 'Follow', 'Favourite', 'FollowRequest'
|
||||||
self.from_account_id = activity(false)&.account_id
|
self.from_account_id = activity(false)&.account_id
|
||||||
|
|
|
@ -81,4 +81,4 @@ end
|
||||||
require 'sidekiq/testing'
|
require 'sidekiq/testing'
|
||||||
Sidekiq::Testing.inline!
|
Sidekiq::Testing.inline!
|
||||||
|
|
||||||
ActiveRecordQueryTrace.enabled = true
|
ActiveRecordQueryTrace.enabled = ENV.fetch('QUERY_TRACE_ENABLED') { false }
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
|
web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
|
||||||
web_app.save!
|
web_app.save!
|
||||||
|
|
||||||
if Rails.env.development?
|
if Rails.env.development?
|
||||||
domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
|
domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
|
||||||
account = Account.where(username: 'admin').first_or_initialize(username: 'admin').save!
|
admin = Account.where(username: 'admin').first_or_initialize(username: 'admin').save!
|
||||||
user = User.where(email: "admin@#{domain}").first_or_initialize(:email => "admin@#{domain}", :password => 'mastodonadmin', :password_confirmation => 'mastodonadmin', :confirmed_at => Time.now, :admin => true, :account => Account.where(username: 'admin').first).save!
|
User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, admin: true, account: admin).save!
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue