Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
4990a50874
7 changed files with 32 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'fastimage'
|
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class CustomEmojisController < BaseController
|
class CustomEmojisController < BaseController
|
||||||
def index
|
def index
|
||||||
|
@ -20,11 +18,7 @@ module Admin
|
||||||
def create
|
def create
|
||||||
authorize :custom_emoji, :create?
|
authorize :custom_emoji, :create?
|
||||||
|
|
||||||
image_size = FastImage.size(params[:custom_emoji][:image])
|
|
||||||
|
|
||||||
@custom_emoji = CustomEmoji.new(resource_params)
|
@custom_emoji = CustomEmoji.new(resource_params)
|
||||||
@custom_emoji.image_width = image_size[0]
|
|
||||||
@custom_emoji.image_height = image_size[1]
|
|
||||||
|
|
||||||
if @custom_emoji.save
|
if @custom_emoji.save
|
||||||
log_action :create, @custom_emoji
|
log_action :create, @custom_emoji
|
||||||
|
|
|
@ -141,6 +141,8 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleEmojiPickInnerButton = () => {};
|
||||||
|
|
||||||
handleReblogClick = e => {
|
handleReblogClick = e => {
|
||||||
const { signedIn } = this.context.identity;
|
const { signedIn } = this.context.identity;
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
|
|
||||||
const emojiPickerButton = (
|
const emojiPickerButton = (
|
||||||
<IconButton className='status__action-bar__button' title={intl.formatMessage(messages.emojiReaction)} icon='smile-o' />
|
<IconButton className='status__action-bar__button' title={intl.formatMessage(messages.emojiReaction)} icon='smile-o' onClick={this.handleEmojiPickInnerButton} />
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -186,6 +186,8 @@ class ActionBar extends React.PureComponent {
|
||||||
this.props.onEmojiReact(this.props.status, data);
|
this.props.onEmojiReact(this.props.status, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleEmojiPickInnerButton = () => {};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { status, relationship, intl } = this.props;
|
const { status, relationship, intl } = this.props;
|
||||||
const { signedIn, permissions } = this.context.identity;
|
const { signedIn, permissions } = this.context.identity;
|
||||||
|
@ -268,7 +270,7 @@ class ActionBar extends React.PureComponent {
|
||||||
);
|
);
|
||||||
|
|
||||||
const emojiPickerButton = (
|
const emojiPickerButton = (
|
||||||
<IconButton icon='smile-o' />
|
<IconButton icon='smile-o' onClick={this.handleEmojiPickInnerButton} />
|
||||||
);
|
);
|
||||||
|
|
||||||
let replyIcon;
|
let replyIcon;
|
||||||
|
|
|
@ -56,6 +56,8 @@ class CustomEmoji < ApplicationRecord
|
||||||
|
|
||||||
after_commit :remove_entity_cache
|
after_commit :remove_entity_cache
|
||||||
|
|
||||||
|
after_post_process :set_size
|
||||||
|
|
||||||
def local?
|
def local?
|
||||||
domain.nil?
|
domain.nil?
|
||||||
end
|
end
|
||||||
|
@ -99,4 +101,15 @@ class CustomEmoji < ApplicationRecord
|
||||||
def downcase_domain
|
def downcase_domain
|
||||||
self.domain = domain.downcase unless domain.nil?
|
self.domain = domain.downcase unless domain.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_size
|
||||||
|
image.queued_for_write.each do |style, file|
|
||||||
|
if style == :original
|
||||||
|
image_size = FastImage.size(file.path)
|
||||||
|
self.image_width = image_size[0]
|
||||||
|
self.image_height = image_size[1]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ module AccountLimitable
|
||||||
end
|
end
|
||||||
|
|
||||||
def scope_status_mentioned(status)
|
def scope_status_mentioned(status)
|
||||||
status.active_mentions.where.joins(:account).merge(Account.local).select('account_id AS id').reorder(nil)
|
status.active_mentions.joins(:account).merge(Account.local).select('account_id AS id').reorder(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: not work
|
# TODO: not work
|
||||||
|
|
|
@ -13,8 +13,13 @@ class UpdateStatusExpirationService < BaseService
|
||||||
expiration_num = expiration[1].to_f
|
expiration_num = expiration[1].to_f
|
||||||
expiration_option = expiration[2]
|
expiration_option = expiration[2]
|
||||||
base_time = status.created_at || Time.now.utc
|
base_time = status.created_at || Time.now.utc
|
||||||
|
due = expiration_option == 'd' ? expiration_num.days :
|
||||||
|
expiration_option == 'h' ? expiration_num.hours :
|
||||||
|
expiration_option == 's' ? expiration_num.seconds : expiration_num.minutes
|
||||||
|
|
||||||
expired_at = base_time + (expiration_option == 'd' ? expiration_num.days : expiration_option == 'h' ? expiration_num.hours : expiration_option == 's' ? expiration_num.seconds : expiration_num.minutes)
|
expired_at = base_time + due
|
||||||
ScheduledExpirationStatus.create!(account: status.account, status: status, scheduled_at: expired_at)
|
expired_status = ScheduledExpirationStatus.create!(account: status.account, status: status, scheduled_at: expired_at)
|
||||||
|
|
||||||
|
RemoveExpiredStatusWorker.perform_at(expired_at, expired_status.id) if due < PostStatusService::MIN_SCHEDULE_OFFSET
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,11 +54,14 @@ class Sanitize
|
||||||
return unless env[:node_name] == 'a'
|
return unless env[:node_name] == 'a'
|
||||||
|
|
||||||
current_node = env[:node]
|
current_node = env[:node]
|
||||||
href = current_node['href']
|
href = current_node['href'] || ''
|
||||||
text = current_node.text
|
text = current_node.text
|
||||||
cls = current_node['class'] || ''
|
cls = current_node['class'] || ''
|
||||||
|
|
||||||
scheme = if current_node['href'] =~ Sanitize::REGEX_PROTOCOL
|
dot_pos = text.index('.')
|
||||||
|
return unless dot_pos.present? && dot_pos > 0 && dot_pos < text.size - 1
|
||||||
|
|
||||||
|
scheme = if href =~ Sanitize::REGEX_PROTOCOL
|
||||||
Regexp.last_match(1).downcase
|
Regexp.last_match(1).downcase
|
||||||
else
|
else
|
||||||
:relative
|
:relative
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue