Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
3a088f3c21
7 changed files with 38 additions and 6 deletions
|
@ -245,4 +245,8 @@ module ApplicationHelper
|
||||||
def prerender_custom_emojis(html, custom_emojis, other_options = {})
|
def prerender_custom_emojis(html, custom_emojis, other_options = {})
|
||||||
EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s
|
EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def prerender_custom_emojis_from_hash(html, custom_emojis_hash)
|
||||||
|
prerender_custom_emojis(html, JSON.parse([custom_emojis_hash].to_json, object_class: OpenStruct))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,10 @@ module FormattingHelper
|
||||||
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
|
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def emoji_name_format(emoji_reaction, status)
|
||||||
|
html_aware_format(emoji_reaction['url'].present? ? ":#{emoji_reaction['name']}:" : emoji_reaction['name'], status.local?)
|
||||||
|
end
|
||||||
|
|
||||||
def rss_status_content_format(status)
|
def rss_status_content_format(status)
|
||||||
html = status_content_format(status)
|
html = status_content_format(status)
|
||||||
|
|
||||||
|
@ -45,7 +49,7 @@ module FormattingHelper
|
||||||
prerender_custom_emojis(
|
prerender_custom_emojis(
|
||||||
safe_join([before_html, html, after_html]),
|
safe_join([before_html, html, after_html]),
|
||||||
status.emojis,
|
status.emojis,
|
||||||
style: 'width: 1.1em; height: 1.1em; object-fit: contain; vertical-align: middle; margin: -.2ex .15em .2ex'
|
style: 'min-width: 1.1em; height: 1.1em; object-fit: contain; vertical-align: middle; margin: -.2ex .15em .2ex'
|
||||||
).to_str
|
).to_str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ class PollForm extends ImmutablePureComponent {
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className='poll__footer'>
|
<div className='poll__footer'>
|
||||||
<button type='button' disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
|
<button type='button' disabled={options.size >= 8} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
|
||||||
|
|
||||||
{/* eslint-disable-next-line jsx-a11y/no-onchange */}
|
{/* eslint-disable-next-line jsx-a11y/no-onchange */}
|
||||||
<select value={expiresIn} onChange={this.handleSelectDuration}>
|
<select value={expiresIn} onChange={this.handleSelectDuration}>
|
||||||
|
|
|
@ -62,7 +62,12 @@ class EmojiFormatter
|
||||||
private
|
private
|
||||||
|
|
||||||
def emoji_map
|
def emoji_map
|
||||||
@emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
|
# from emoji_reactions_grouped_by_name (status_stat)
|
||||||
|
if !custom_emojis.first&.image.present?
|
||||||
|
return @emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.name] = [e.url, e.static_url] }
|
||||||
|
end
|
||||||
|
|
||||||
|
return @emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def count_tag_nesting(tag)
|
def count_tag_nesting(tag)
|
||||||
|
@ -85,7 +90,7 @@ class EmojiFormatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_attributes
|
def image_attributes
|
||||||
{ rel: 'emoji', draggable: false, width: 16, height: 16, class: image_class_names, style: image_style }
|
{ rel: 'emoji', draggable: false, height: 16, class: image_class_names, style: image_style }
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_data_attributes(original_url, static_url)
|
def image_data_attributes(original_url, static_url)
|
||||||
|
@ -97,7 +102,7 @@ class EmojiFormatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_style
|
def image_style
|
||||||
@options[:style]
|
'min-width:16px;' + (@options[:style] || '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def animate?
|
def animate?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PollValidator < ActiveModel::Validator
|
class PollValidator < ActiveModel::Validator
|
||||||
MAX_OPTIONS = 4
|
MAX_OPTIONS = 8
|
||||||
MAX_OPTION_CHARS = 50
|
MAX_OPTION_CHARS = 50
|
||||||
MAX_EXPIRATION = 1.month.freeze
|
MAX_EXPIRATION = 1.month.freeze
|
||||||
MIN_EXPIRATION = 5.minutes.freeze
|
MIN_EXPIRATION = 5.minutes.freeze
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
:ruby
|
||||||
|
grouped_emoji_reactions ||= Oj.load(status.status_stat&.emoji_reactions || '', mode: :strict) || []
|
||||||
|
p '=================== DEBUG ' + grouped_emoji_reactions.first&.to_s
|
||||||
|
|
||||||
.detailed-status.detailed-status--flex{ class: "detailed-status-#{status.visibility}" }
|
.detailed-status.detailed-status--flex{ class: "detailed-status-#{status.visibility}" }
|
||||||
.p-author.h-card
|
.p-author.h-card
|
||||||
= link_to ActivityPub::TagManager.instance.url_for(status.account), class: 'detailed-status__display-name u-url', target: stream_link_target, rel: 'noopener' do
|
= link_to ActivityPub::TagManager.instance.url_for(status.account), class: 'detailed-status__display-name u-url', target: stream_link_target, rel: 'noopener' do
|
||||||
|
@ -36,6 +40,13 @@
|
||||||
- elsif status.preview_card
|
- elsif status.preview_card
|
||||||
= render_card_component(status)
|
= render_card_component(status)
|
||||||
|
|
||||||
|
- if grouped_emoji_reactions.size > 0
|
||||||
|
.status__emoji-reactions-bar
|
||||||
|
- grouped_emoji_reactions.each do |reaction|
|
||||||
|
%button.emoji-reactions-bar__button
|
||||||
|
%span.emojify= prerender_custom_emojis_from_hash(emoji_name_format(reaction, status), reaction)
|
||||||
|
%span.count= reaction['count']
|
||||||
|
|
||||||
.detailed-status__meta
|
.detailed-status__meta
|
||||||
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
||||||
- if status.edited?
|
- if status.edited?
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
:ruby
|
:ruby
|
||||||
hide_show_thread ||= false
|
hide_show_thread ||= false
|
||||||
|
grouped_emoji_reactions ||= Oj.load(status.status_stat&.emoji_reactions || '', mode: :strict) || []
|
||||||
|
|
||||||
.status{ class: "status-#{status.visibility}" }
|
.status{ class: "status-#{status.visibility}" }
|
||||||
.status__info
|
.status__info
|
||||||
|
@ -52,6 +53,13 @@
|
||||||
= link_to ActivityPub::TagManager.instance.url_for(status), class: 'status__content__read-more-button', target: stream_link_target, rel: 'noopener noreferrer' do
|
= link_to ActivityPub::TagManager.instance.url_for(status), class: 'status__content__read-more-button', target: stream_link_target, rel: 'noopener noreferrer' do
|
||||||
= t 'statuses.show_thread'
|
= t 'statuses.show_thread'
|
||||||
|
|
||||||
|
- if grouped_emoji_reactions.size > 0
|
||||||
|
.status__emoji-reactions-bar
|
||||||
|
- grouped_emoji_reactions.each do |reaction|
|
||||||
|
%button.emoji-reactions-bar__button
|
||||||
|
%span.emojify= prerender_custom_emojis_from_hash(emoji_name_format(reaction, status), reaction)
|
||||||
|
%span.count= reaction['count']
|
||||||
|
|
||||||
.status__action-bar
|
.status__action-bar
|
||||||
%span.status__action-bar-button.icon-button.icon-button--with-counter
|
%span.status__action-bar-button.icon-button.icon-button--with-counter
|
||||||
- if status.in_reply_to_id.nil?
|
- if status.in_reply_to_id.nil?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue