diff --git a/app/javascript/mastodon/features/emoji_reactions/index.jsx b/app/javascript/mastodon/features/emoji_reactions/index.jsx index 821bc601ef..8c649700eb 100644 --- a/app/javascript/mastodon/features/emoji_reactions/index.jsx +++ b/app/javascript/mastodon/features/emoji_reactions/index.jsx @@ -52,7 +52,6 @@ class EmojiReactions extends ImmutablePureComponent { render () { const { intl, accountIds, multiColumn } = this.props; - console.dir(accountIds); if (!accountIds) { return ( diff --git a/app/javascript/mastodon/features/notifications/components/notification.jsx b/app/javascript/mastodon/features/notifications/components/notification.jsx index eab219dfbd..ba686d45a7 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.jsx +++ b/app/javascript/mastodon/features/notifications/components/notification.jsx @@ -12,6 +12,7 @@ import FollowRequestContainer from '../containers/follow_request_container'; import Icon from 'mastodon/components/icon'; import { Link } from 'react-router-dom'; import classNames from 'classnames'; +import EmojiView from '../../../components/emoji_view'; const messages = defineMessages({ favourite: { id: 'notification.favourite', defaultMessage: '{name} favourited your status' }, @@ -215,14 +216,16 @@ class Notification extends ImmutablePureComponent { } renderEmojiReaction (notification, link) { + console.dir(notification) const { intl, unread } = this.props; + const emoji_reaction = notification.get('emoji_reaction'); return (
- +
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 44fa1c6134..5a658fd371 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -50,6 +50,7 @@ const notificationToMap = notification => ImmutableMap({ id: notification.id, type: notification.type, account: notification.account.id, + emoji_reaction: ImmutableMap(notification.emoji_reaction), created_at: notification.created_at, status: notification.status ? notification.status.id : null, report: notification.report ? fromJS(notification.report) : null, diff --git a/app/serializers/rest/emoji_reaction_serializer.rb b/app/serializers/rest/emoji_reaction_serializer.rb index 1d8f903685..fd58a125f5 100644 --- a/app/serializers/rest/emoji_reaction_serializer.rb +++ b/app/serializers/rest/emoji_reaction_serializer.rb @@ -1,15 +1,20 @@ # frozen_string_literal: true class REST::EmojiReactionSerializer < ActiveModel::Serializer - attributes :name, :count + attributes :name + attribute :count, if: :count? attribute :url, if: :custom_emoji? attribute :static_url, if: :custom_emoji? attribute :domain, if: :custom_emoji? attribute :account_ids, if: :account_ids? + def count? + object.respond_to?(:count) + end + def custom_emoji? - object.url.present? + object.respond_to?(:url) end def account_ids? diff --git a/app/serializers/rest/notification_serializer.rb b/app/serializers/rest/notification_serializer.rb index 2d9ab53ef5..15c62476dc 100644 --- a/app/serializers/rest/notification_serializer.rb +++ b/app/serializers/rest/notification_serializer.rb @@ -6,6 +6,7 @@ class REST::NotificationSerializer < ActiveModel::Serializer belongs_to :from_account, key: :account, serializer: REST::AccountSerializer belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer + belongs_to :emoji_reaction, if: :emoji_reaction_type?, serializer: REST::EmojiReactionSerializer def id object.id.to_s @@ -18,4 +19,8 @@ class REST::NotificationSerializer < ActiveModel::Serializer def report_type? object.type == :'admin.report' end + + def emoji_reaction_type? + object.type == :emoji_reaction + end end