diff --git a/app/controllers/api/v1/chat_conversation_accounts/blocked_chat_accounts_controller.rb b/app/controllers/api/v1/chat_conversations/blocked_chat_accounts_controller.rb similarity index 80% rename from app/controllers/api/v1/chat_conversation_accounts/blocked_chat_accounts_controller.rb rename to app/controllers/api/v1/chat_conversations/blocked_chat_accounts_controller.rb index a7b52de0..9a5b29f0 100644 --- a/app/controllers/api/v1/chat_conversation_accounts/blocked_chat_accounts_controller.rb +++ b/app/controllers/api/v1/chat_conversations/blocked_chat_accounts_controller.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -class Api::V1::ChatConversationAccounts::BlockedChatAccountsController < Api::BaseController +class Api::V1::ChatConversations::BlockedChatAccountsController < Api::BaseController before_action -> { doorkeeper_authorize! :follow, :'read:blocks' } before_action :require_user! after_action :insert_pagination_headers - def show + def index @accounts = load_accounts render json: @accounts, each_serializer: REST::AccountSerializer end @@ -32,13 +32,13 @@ class Api::V1::ChatConversationAccounts::BlockedChatAccountsController < Api::Ba def next_path if records_continue? - api_v1_chat_conversation_accounts_chat_blocked_accounts_url pagination_params(max_id: pagination_max_id) + api_v1_chat_conversations_blocked_chat_accounts_url pagination_params(max_id: pagination_max_id) end end def prev_path unless paginated_blocks.empty? - api_v1_chat_conversation_accounts_blocked_chat_accounts_url pagination_params(since_id: pagination_since_id) + api_v1_chat_conversations_blocked_chat_accounts_url pagination_params(since_id: pagination_since_id) end end diff --git a/app/controllers/api/v1/chat_conversations/messages_controller.rb b/app/controllers/api/v1/chat_conversations/messages_controller.rb index 8cd8f87b..41d3b8e0 100644 --- a/app/controllers/api/v1/chat_conversations/messages_controller.rb +++ b/app/controllers/api/v1/chat_conversations/messages_controller.rb @@ -47,7 +47,7 @@ class Api::V1::ChatConversations::MessagesController < Api::BaseController ).paginate_by_id( limit_param(DEFAULT_CHAT_CONVERSATION_MESSAGE_LIMIT), params_slice(:max_id, :since_id, :min_id) - ) + ).reject { |chat_message| FeedManager.instance.filter?(:chat_message, chat_message, current_account.id) } end def insert_pagination_headers diff --git a/app/controllers/api/v1/chat_conversations/muted_conversations_controller.rb b/app/controllers/api/v1/chat_conversations/muted_conversations_controller.rb new file mode 100644 index 00000000..27039e8e --- /dev/null +++ b/app/controllers/api/v1/chat_conversations/muted_conversations_controller.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +class Api::V1::ChatConversations::MutedConversationsController < Api::BaseController + before_action -> { authorize_if_got_token! :read, :'read:chats' } + + before_action :require_user! + after_action :insert_pagination_headers + + def index + @chat_conversations = load_chat_conversations + render json: @chat_conversations, each_serializer: REST::ChatConversationAccountSerializer + end + + private + + def load_chat_conversations + paginated_chat_conversations + end + + def paginated_chat_conversations + ChatConversationAccount.where( + account: current_account, + is_muted: true, + ).paginate_by_max_id( + limit_param(DEFAULT_CHAT_CONVERSATION_LIMIT), + params[:max_id], + params[:since_id] + ) + end + + def insert_pagination_headers + set_pagination_headers(next_path, prev_path) + end + + def next_path + if records_continue? + api_v1_chat_conversations_muted_conversations_url pagination_params(max_id: pagination_max_id) + end + end + + def prev_path + unless paginated_chat_conversations.empty? + api_v1_chat_conversations_muted_conversations_url pagination_params(since_id: pagination_since_id) + end + end + + def pagination_max_id + paginated_chat_conversations.last.id + end + + def pagination_since_id + paginated_chat_conversations.first.id + end + + def records_continue? + paginated_chat_conversations.size == limit_param(DEFAULT_CHAT_CONVERSATION_LIMIT) + end + + def pagination_params(core_params) + params.slice(:limit).permit(:limit).merge(core_params) + end + +end diff --git a/app/controllers/api/v1/hashtags_controller.rb b/app/controllers/api/v1/hashtags_controller.rb new file mode 100644 index 00000000..e9f7a354 --- /dev/null +++ b/app/controllers/api/v1/hashtags_controller.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class Api::V1::HashtagsController < Api::BaseController + before_action :require_user! + before_action :set_hashtag + + def show + render json: @hashtag, serializer: REST::TagSerializer + end + + private + + def set_hashtag + @hashtag = Tag.where(name: params[:id]).first + end + +end diff --git a/app/controllers/api/web/chat_settings_controller.rb b/app/controllers/api/web/chat_settings_controller.rb index 32fee0ba..10a36f2e 100644 --- a/app/controllers/api/web/chat_settings_controller.rb +++ b/app/controllers/api/web/chat_settings_controller.rb @@ -4,8 +4,8 @@ class Api::Web::ChatSettingsController < Api::Web::BaseController before_action :require_user! def update - setting.data = params[:data] - setting.save! + # setting.data = params[:data] + # setting.save! # todo validate all data objects @@ -15,6 +15,6 @@ class Api::Web::ChatSettingsController < Api::Web::BaseController private def setting - @_setting ||= ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user) + # @_setting ||= ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user) end end diff --git a/app/javascript/gabsocial/actions/chat_conversation_accounts.js b/app/javascript/gabsocial/actions/chat_conversation_accounts.js index 10e68ba5..2cb50a06 100644 --- a/app/javascript/gabsocial/actions/chat_conversation_accounts.js +++ b/app/javascript/gabsocial/actions/chat_conversation_accounts.js @@ -123,7 +123,7 @@ export const fetchChatMessengerBlocks = () => (dispatch, getState) => { dispatch(fetchChatMessengerBlocksRequest()) - api(getState).get('/api/v1/chat_conversation_accounts/blocked_chat_accounts').then(response => { + api(getState).get('/api/v1/chat_conversations/blocked_chat_accounts').then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next') dispatch(importFetchedAccounts(response.data)) dispatch(fetchChatMessengerBlocksSuccess(response.data, next ? next.uri : null)) diff --git a/app/javascript/gabsocial/actions/chat_conversations.js b/app/javascript/gabsocial/actions/chat_conversations.js index 777a099c..e2537650 100644 --- a/app/javascript/gabsocial/actions/chat_conversations.js +++ b/app/javascript/gabsocial/actions/chat_conversations.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api' +import debounce from 'lodash.debounce' import { importFetchedAccounts } from './importer' import { me } from '../initial_state' @@ -12,7 +13,9 @@ export const CHAT_CONVERSATIONS_APPROVED_EXPAND_REQUEST = 'CHAT_CONVERSATIONS_AP export const CHAT_CONVERSATIONS_APPROVED_EXPAND_SUCCESS = 'CHAT_CONVERSATIONS_APPROVED_EXPAND_SUCCESS' export const CHAT_CONVERSATIONS_APPROVED_EXPAND_FAIL = 'CHAT_CONVERSATIONS_APPROVED_EXPAND_FAIL' -export const CHAT_CONVERSATION_APPROVED_UNREAD_COUNT_FETCH_SUCCESS = 'CHAT_CONVERSATIONS_APPROVED_EXPAND_FAIL' +export const CHAT_CONVERSATION_APPROVED_UNREAD_COUNT_FETCH_SUCCESS = 'CHAT_CONVERSATION_APPROVED_UNREAD_COUNT_FETCH_SUCCESS' + +export const CHAT_CONVERSATION_APPROVED_SEARCH_FETCH_SUCCESS = 'CHAT_CONVERSATION_APPROVED_SEARCH_FETCH_SUCCESS' // @@ -38,6 +41,16 @@ export const CHAT_CONVERSATIONS_REQUESTED_EXPAND_FAIL = 'CHAT_CONVERSATIONS_R // +export const CHAT_CONVERSATIONS_MUTED_FETCH_REQUEST = 'CHAT_CONVERSATIONS_MUTED_FETCH_REQUEST' +export const CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS = 'CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS' +export const CHAT_CONVERSATIONS_MUTED_FETCH_FAIL = 'CHAT_CONVERSATIONS_MUTED_FETCH_FAIL' + +export const CHAT_CONVERSATIONS_MUTED_EXPAND_REQUEST = 'CHAT_CONVERSATIONS_MUTED_EXPAND_REQUEST' +export const CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS = 'CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS' +export const CHAT_CONVERSATIONS_MUTED_EXPAND_FAIL = 'CHAT_CONVERSATIONS_MUTED_EXPAND_FAIL' + +// + export const CHAT_CONVERSATION_REQUEST_APPROVE_SUCCESS = 'CHAT_CONVERSATION_REQUEST_APPROVE_SUCCESS' export const CHAT_CONVERSATION_REQUEST_APPROVE_FAIL = 'CHAT_CONVERSATION_REQUEST_APPROVE_FAIL' @@ -215,6 +228,83 @@ export const expandChatConversationRequestedFail = (error) => ({ error, }) +/** + * @description Fetch paginated muted chat conversations, import accounts and set chat converations + */ +export const fetchChatConversationMuted = () => (dispatch, getState) => { + if (!me) return + + dispatch(fetchChatConversationMutedRequest()) + + api(getState).get('/api/v1/chat_conversations/muted_conversations').then((response) => { + const next = getLinks(response).refs.find(link => link.rel === 'next') + const conversationsAccounts = [].concat.apply([], response.data.map((c) => c.other_accounts)) + // const conversationsChatMessages = response.data.map((c) => c.last_chat_message) + + dispatch(importFetchedAccounts(conversationsAccounts)) + // dispatch(importFetchedChatMessages(conversationsChatMessages)) + dispatch(fetchChatConversationMutedSuccess(response.data, next ? next.uri : null)) + }).catch((error) => { + dispatch(fetchChatConversationMutedFail(error)) + }) +} + +export const fetchChatConversationMutedRequest = () => ({ + type: CHAT_CONVERSATIONS_MUTED_FETCH_REQUEST, +}) + +export const fetchChatConversationMutedSuccess = (chatConversations, next) => ({ + type: CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS, + chatConversations, + next, +}) + +export const fetchChatConversationMutedFail = (error) => ({ + type: CHAT_CONVERSATIONS_MUTED_FETCH_FAIL, + showToast: true, + error, +}) + +/** + * @description Expand paginated muted chat conversations, import accounts and set chat converations + */ +export const expandChatConversationMuted = () => (dispatch, getState) => { + if (!me) return + + const url = getState().getIn(['chat_conversations', 'muted', 'next']) + const isLoading = getState().getIn(['chat_conversations', 'muted', 'isLoading']) + + if (url === null || isLoading) return + + dispatch(expandChatConversationMutedRequest()) + + api(getState).get(url).then(response => { + const next = getLinks(response).refs.find(link => link.rel === 'next') + const conversationsAccounts = [].concat.apply([], response.data.map((c) => c.other_accounts)) + // const conversationsChatMessages = response.data.map((c) => c.last_chat_message) + + dispatch(importFetchedAccounts(conversationsAccounts)) + // dispatch(importFetchedChatMessages(conversationsChatMessages)) + dispatch(expandChatConversationMutedSuccess(response.data, next ? next.uri : null)) + }).catch(error => dispatch(expandChatConversationMutedFail(error))) +} + +export const expandChatConversationMutedRequest = () => ({ + type: CHAT_CONVERSATIONS_MUTED_EXPAND_REQUEST, +}) + +export const expandChatConversationMutedSuccess = (chatConversations, next) => ({ + type: CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS, + chatConversations, + next, +}) + +export const expandChatConversationMutedFail = (error) => ({ + type: CHAT_CONVERSATIONS_MUTED_EXPAND_FAIL, + showToast: true, + error, +}) + /** * @description Create a chat conversation with given accountId. May fail because of blocks. * @param {String} accountId @@ -227,6 +317,7 @@ export const createChatConversation = (accountId) => (dispatch, getState) => { api(getState).post('/api/v1/chat_conversation', { account_id: accountId }).then((response) => { dispatch(createChatConversationSuccess(response.data)) }).catch((error) => { + console.log("error:", error) dispatch(createChatConversationFail(error)) }) } @@ -414,3 +505,40 @@ export const setChatConversationExpirationFail = (error) => ({ error, }) +/** + * + */ +export const fetchChatConversationAccountSuggestions = (query) => (dispatch, getState) => { + if (!query) return + debouncedFetchChatConversationAccountSuggestions(query, dispatch, getState) +} + +export const debouncedFetchChatConversationAccountSuggestions = debounce((query, dispatch, getState) => { + if (!query) return + + api(getState).get('/api/v1/accounts/search', { + params: { + q: query, + resolve: false, + limit: 4, + }, + }).then((response) => { + // const next = getLinks(response).refs.find(link => link.rel === 'next') + // const conversationsAccounts = [].concat.apply([], response.data.map((c) => c.other_accounts)) + + dispatch(importFetchedAccounts(response.data)) + + // dispatch(importFetchedAccounts(conversationsAccounts)) + // dispatch(importFetchedChatMessages(conversationsChatMessages)) + // dispatch(fetchChatConversationsSuccess(response.data, next ? next.uri : null)) + + dispatch(fetchChatConversationAccountSuggestionsSuccess(response.data)) + }).catch((error) => { + // + }) +}, 650, { leading: true }) + +const fetchChatConversationAccountSuggestionsSuccess = (chatConversations) => ({ + type: CHAT_CONVERSATION_APPROVED_SEARCH_FETCH_SUCCESS, + chatConversations, +}) \ No newline at end of file diff --git a/app/javascript/gabsocial/actions/chat_settings.js b/app/javascript/gabsocial/actions/chat_settings.js index 7eab5433..ba02bf02 100644 --- a/app/javascript/gabsocial/actions/chat_settings.js +++ b/app/javascript/gabsocial/actions/chat_settings.js @@ -5,11 +5,11 @@ import { me } from '../initial_state' export const CHAT_SETTING_CHANGE = 'CHAT_SETTING_CHANGE' export const CHAT_SETTING_SAVE = 'CHAT_SETTING_SAVE' -export const changeChatSetting = (path, value) => (dispatch) => { +export const changeChatSetting = (path, checked) => (dispatch) => { dispatch({ type: CHAT_SETTING_CHANGE, path, - value, + checked, }) dispatch(saveChatSettings()) diff --git a/app/javascript/gabsocial/actions/hashtags.js b/app/javascript/gabsocial/actions/hashtags.js new file mode 100644 index 00000000..3d114af1 --- /dev/null +++ b/app/javascript/gabsocial/actions/hashtags.js @@ -0,0 +1,29 @@ +import api from '../api' + +export const HASHTAG_FETCH_REQUEST = 'HASHTAG_FETCH_REQUEST' +export const HASHTAG_FETCH_SUCCESS = 'HASHTAG_FETCH_SUCCESS' +export const HASHTAG_FETCH_FAIL = 'HASHTAG_FETCH_FAIL' + +export const fetchHashtag = (tag) => (dispatch, getState) => { + if (!tag) return + + dispatch(fetchHashtagRequest()) + + api(getState).get(`/api/v1/hashtags/${tag.toLowerCase()}`) + .then(({ data }) => dispatch(fetchHashtagSuccess(data))) + .catch(err => dispatch(fetchHashtagFail(err))) +} + +export const fetchHashtagRequest = () => ({ + type: HASHTAG_FETCH_REQUEST, +}) + +export const fetchHashtagSuccess = (hashtag) => ({ + type: HASHTAG_FETCH_SUCCESS, + hashtag, +}) + +export const fetchHashtagFail = error => ({ + type: HASHTAG_FETCH_FAIL, + error, +}) \ No newline at end of file diff --git a/app/javascript/gabsocial/actions/streaming.js b/app/javascript/gabsocial/actions/streaming.js index 578ce57e..806a86ec 100644 --- a/app/javascript/gabsocial/actions/streaming.js +++ b/app/javascript/gabsocial/actions/streaming.js @@ -84,6 +84,8 @@ export const connectChatMessagesStream = (accountId) => { onReceive (data) { if (!data['event'] || !data['payload']) return if (data.event === 'notification') { + // : todo : + //Play sound dispatch(manageIncomingChatMessage(JSON.parse(data.payload))) } }, diff --git a/app/javascript/gabsocial/components/account.js b/app/javascript/gabsocial/components/account.js index 7e4df1f0..129c6cc4 100644 --- a/app/javascript/gabsocial/components/account.js +++ b/app/javascript/gabsocial/components/account.js @@ -51,6 +51,7 @@ class Account extends ImmutablePureComponent { showDismiss, withBio, isCard, + noClick, } = this.props if (!account) return null @@ -105,6 +106,8 @@ class Account extends ImmutablePureComponent { noUnderline: 1, overflowHidden: 1, flexNormal: 1, + outlineNone: 1, + bgTransparent: 1, aiStart: !isCard, aiCenter: isCard, }) @@ -133,26 +136,28 @@ class Account extends ImmutablePureComponent {
- - +
-
{!compact && actionButton} -
+
{dismissBtn} @@ -232,6 +237,7 @@ Account.propTypes = { dismissAction: PropTypes.func, withBio: PropTypes.bool, isCard: PropTypes.bool, + noClick: PropTypes.bool, } export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account)) \ No newline at end of file diff --git a/app/javascript/gabsocial/components/comment.js b/app/javascript/gabsocial/components/comment.js index 430a66c4..9245b4f6 100644 --- a/app/javascript/gabsocial/components/comment.js +++ b/app/javascript/gabsocial/components/comment.js @@ -88,6 +88,14 @@ class Comment extends ImmutablePureComponent { this.moreNode = c } + setContainerNode = (c) => { + this.containerNode = c + + if (this.props.isHighlighted && this.containerNode) { + this.containerNode.scrollIntoView({ behavior: 'smooth' }); + } + } + render() { const { indent, @@ -101,7 +109,7 @@ class Comment extends ImmutablePureComponent { if (isHidden) { return ( -
+
{status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])} {status.get('content')}
@@ -133,7 +141,11 @@ class Comment extends ImmutablePureComponent { }) return ( -
+
{ indent > 0 &&
diff --git a/app/javascript/gabsocial/components/hashtag_item.js b/app/javascript/gabsocial/components/hashtag_item.js index 410b9cf4..e92814b2 100644 --- a/app/javascript/gabsocial/components/hashtag_item.js +++ b/app/javascript/gabsocial/components/hashtag_item.js @@ -1,10 +1,12 @@ import React from 'react' import PropTypes from 'prop-types' +import { Sparklines, SparklinesCurve } from 'react-sparklines' import { FormattedMessage } from 'react-intl' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { NavLink } from 'react-router-dom' import Button from './button' +import Block from './block' import Text from './text' class HashtagItem extends ImmutablePureComponent { @@ -12,44 +14,42 @@ class HashtagItem extends ImmutablePureComponent { render() { const { hashtag, isCompact } = this.props + if (!hashtag) return + const count = hashtag.get('history').map((block) => { return parseInt(block.get('uses')) }).reduce((a, c) => a + c) return ( - -
-
- - #{hashtag.get('name')} - + +
+
+
+
+ + #{hashtag.get('name')} + +
+
+ { + !isCompact && + + + + }
- { - !isCompact && -
- { - !isCompact && - - - - } - +
) } diff --git a/app/javascript/gabsocial/components/popover/chat_conversation_options_popover.js b/app/javascript/gabsocial/components/popover/chat_conversation_options_popover.js index 93393c8b..b4f8a794 100644 --- a/app/javascript/gabsocial/components/popover/chat_conversation_options_popover.js +++ b/app/javascript/gabsocial/components/popover/chat_conversation_options_popover.js @@ -54,6 +54,7 @@ class ChatConversationOptionsPopover extends ImmutablePureComponent { intl, isXS, isMuted, + isChatConversationRequest, } = this.props const items = [ @@ -62,21 +63,23 @@ class ChatConversationOptionsPopover extends ImmutablePureComponent { title: 'Hide Conversation', subtitle: 'Hide until next message', onClick: () => this.handleOnHide(), - }, - { + } + ] + if (!isChatConversationRequest) { + items.push({ hideArrow: true, title: isMuted ? 'Unmute Conversation' : 'Mute Conversation', subtitle: isMuted ? null : "Don't get notified of new messages", onClick: () => this.handleOnMute(), - }, - {}, - { + }) + items.push({}) + items.push({ hideArrow: true, title: 'Purge messages', subtitle: 'Remove all of your messages in this conversation', onClick: () => this.handleOnPurge(), - }, - ] + }) + } return ( ({ accountId: account.get('id'), })) }, - + onMute(account) { + dispatch(closePopover()) + if (account.getIn(['relationship', 'muting'])) { + dispatch(unmuteAccount(account.get('id'))); + } else { + dispatch(openModal('MUTE', { + accountId: account.get('id'), + })) + } + }, onReport(status) { dispatch(closePopover()) dispatch(initReport(status.get('account'), status)) diff --git a/app/javascript/gabsocial/features/chat_conversation_blocked_accounts.js b/app/javascript/gabsocial/features/chat_conversation_blocked_accounts.js index 87a97fbb..3ca9af98 100644 --- a/app/javascript/gabsocial/features/chat_conversation_blocked_accounts.js +++ b/app/javascript/gabsocial/features/chat_conversation_blocked_accounts.js @@ -59,9 +59,9 @@ class ChatConversationBlockedAccounts extends ImmutablePureComponent { key={`blocked-accounts-${id}`} id={id} compact - actionIcon='subtract' + actionIcon='' onActionClick={() => this.props.onRemove(id)} - actionTitle='Remove' + actionTitle='Undo Chat Block' /> )) } diff --git a/app/javascript/gabsocial/features/chat_conversation_create.js b/app/javascript/gabsocial/features/chat_conversation_create.js index 1d986b5f..da11d05e 100644 --- a/app/javascript/gabsocial/features/chat_conversation_create.js +++ b/app/javascript/gabsocial/features/chat_conversation_create.js @@ -56,6 +56,7 @@ class ChatConversationCreate extends React.PureComponent { suggestionsIds.map((accountId) => ( this.handleOnCreateChatConversation(accountId)} diff --git a/app/javascript/gabsocial/features/chat_conversation_mutes.js b/app/javascript/gabsocial/features/chat_conversation_mutes.js index 97d4d858..ced038bf 100644 --- a/app/javascript/gabsocial/features/chat_conversation_mutes.js +++ b/app/javascript/gabsocial/features/chat_conversation_mutes.js @@ -11,7 +11,7 @@ class ChatConversationMutes extends React.PureComponent {
- +
) } diff --git a/app/javascript/gabsocial/features/hashtag_timeline.js b/app/javascript/gabsocial/features/hashtag_timeline.js index 9adcc5e0..19b4c95d 100644 --- a/app/javascript/gabsocial/features/hashtag_timeline.js +++ b/app/javascript/gabsocial/features/hashtag_timeline.js @@ -4,7 +4,9 @@ import { connect } from 'react-redux' import { FormattedMessage } from 'react-intl' import isEqual from 'lodash.isequal' import { expandHashtagTimeline, clearTimeline } from '../actions/timelines' +import { fetchHashtag } from '../actions/hashtags' import StatusList from '../components/status_list' +import HashtagItem from '../components/hashtag_item' class HashtagTimeline extends React.PureComponent { @@ -64,10 +66,11 @@ class HashtagTimeline extends React.PureComponent { } componentDidMount () { - const { dispatch } = this.props + const { dispatch, tagName } = this.props const { id, tags } = this.props.params dispatch(expandHashtagTimeline(id, { tags })) + dispatch(fetchHashtag(tagName)) } componentWillReceiveProps (nextProps) { @@ -86,21 +89,28 @@ class HashtagTimeline extends React.PureComponent { } render () { - const { id } = this.props.params + const { tag, tagName } = this.props + + console.log("tagName:", tag) return ( - } - /> - ); + + { tag && } + } + /> + + ) } } const mapStateToProps = (state, props) => ({ + tagName: props.params.id, + tag: state.getIn(['hashtags', `${props.params.id}`]), hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0, }) diff --git a/app/javascript/gabsocial/features/messages/components/chat_conversations_list.js b/app/javascript/gabsocial/features/messages/components/chat_conversations_list.js index 25a2116e..cc71d984 100644 --- a/app/javascript/gabsocial/features/messages/components/chat_conversations_list.js +++ b/app/javascript/gabsocial/features/messages/components/chat_conversations_list.js @@ -9,6 +9,8 @@ import { expandChatConversations, fetchChatConversationRequested, expandChatConversationRequested, + fetchChatConversationMuted, + expandChatConversationMuted, } from '../../../actions/chat_conversations' import AccountPlaceholder from '../../../components/placeholder/account_placeholder' import ChatConversationsListItem from './chat_conversations_list_item' @@ -72,6 +74,8 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(fetchChatConversations()) } else if (source ==='requested') { dispatch(fetchChatConversationRequested()) + } else if (source ==='muted') { + dispatch(fetchChatConversationMuted()) } }, onExpandChatConversations(source) { @@ -79,6 +83,8 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(expandChatConversations()) } else if (source ==='requested') { dispatch(expandChatConversationRequested()) + } else if (source ==='muted') { + dispatch(expandChatConversationMuted()) } }, }) diff --git a/app/javascript/gabsocial/features/messages/components/chat_conversations_search.js b/app/javascript/gabsocial/features/messages/components/chat_conversations_search.js index 08db977b..291e8872 100644 --- a/app/javascript/gabsocial/features/messages/components/chat_conversations_search.js +++ b/app/javascript/gabsocial/features/messages/components/chat_conversations_search.js @@ -1,29 +1,31 @@ import React from 'react' import PropTypes from 'prop-types' +import { connect } from 'react-redux' import Input from '../../../components/input' class ChatConversationsSearch extends React.PureComponent { - static contextTypes = { - router: PropTypes.object, + state = { + value: '', } - state = { - composeFocused: false, + handleOnChange = (value) => { + this.setState({ value }) + this.props.onChange(value) } render() { - const { - children - } = this.props + const { value } = this.state return (
) @@ -31,8 +33,10 @@ class ChatConversationsSearch extends React.PureComponent { } -ChatConversationsSearch.propTypes = { - // -} +const mapDispatchToProps = (dispatch) => ({ + onChange(value) { + // dispatch() + } +}) -export default ChatConversationsSearch \ No newline at end of file +export default connect(null, mapDispatchToProps)(ChatConversationsSearch) \ No newline at end of file diff --git a/app/javascript/gabsocial/features/messages/components/chat_message_header.js b/app/javascript/gabsocial/features/messages/components/chat_message_header.js index 92100178..a187af4a 100644 --- a/app/javascript/gabsocial/features/messages/components/chat_message_header.js +++ b/app/javascript/gabsocial/features/messages/components/chat_message_header.js @@ -21,7 +21,12 @@ class ChatMessageHeader extends React.PureComponent { } handleOnOpenChatConversationOptionsPopover = () => { - this.props.onOpenChatConversationOptionsPopover(this.props.chatConversationId, this.optionsBtnRef) + const isChatConversationRequest = !!this.props.chatConversation ? !this.props.chatConversation.get('is_approved') : false + this.props.onOpenChatConversationOptionsPopover({ + isChatConversationRequest, + chatConversationId: this.props.chatConversationId, + targetRef: this.optionsBtnRef, + }) } setOptionsBtnRef = (c) => { @@ -63,7 +68,7 @@ class ChatMessageHeader extends React.PureComponent { onClick={this.handleOnApproveMessageRequest} className={_s.ml10} > - + Approve Message Request @@ -82,10 +87,9 @@ const mapDispatchToProps = (dispatch) => ({ onApproveChatConversationRequest(chatConversationId) { dispatch(approveChatConversationRequest(chatConversationId)) }, - onOpenChatConversationOptionsPopover(chatConversationId, targetRef) { + onOpenChatConversationOptionsPopover(options) { dispatch(openPopover(POPOVER_CHAT_CONVERSATION_OPTIONS, { - chatConversationId, - targetRef, + ...options, position: 'left-end', })) }, diff --git a/app/javascript/gabsocial/features/messages/components/chat_message_scrolling_list.js b/app/javascript/gabsocial/features/messages/components/chat_message_scrolling_list.js index b488f86c..a2c2c385 100644 --- a/app/javascript/gabsocial/features/messages/components/chat_message_scrolling_list.js +++ b/app/javascript/gabsocial/features/messages/components/chat_message_scrolling_list.js @@ -22,6 +22,7 @@ import ChatMessagePlaceholder from '../../../components/placeholder/chat_message import ChatMessageItem from './chat_message_item' import ColumnIndicator from '../../../components/column_indicator' import LoadMore from '../../../components/load_more' +import Text from '../../../components/text' class ChatMessageScrollingList extends ImmutablePureComponent { @@ -238,6 +239,7 @@ class ChatMessageScrollingList extends ImmutablePureComponent { isLoading, isPartial, hasMore, + amITalkingToMyself, onScrollToBottom, onScroll, isXS, @@ -299,6 +301,15 @@ class ChatMessageScrollingList extends ImmutablePureComponent { className={[_s.d, _s.h100PC, _s.w100PC, _s.px15, _s.py15, _s.overflowYScroll].join(' ')} ref={this.setScrollContainerRef} > + { + amITalkingToMyself && +
+ + This is a chat conversation with yourself. Use this space to keep messages, links and texts. Please remember that these messages are not encrypted. + +
+ } + { (hasMore && !isLoading) && @@ -349,7 +360,11 @@ class ChatMessageScrollingList extends ImmutablePureComponent { const mapStateToProps = (state, { chatConversationId }) => { if (!chatConversationId) return {} + const otherAccountIds = state.getIn(['chat_conversations', chatConversationId, 'other_account_ids'], null) + const amITalkingToMyself = !!otherAccountIds ? otherAccountIds.size == 1 && otherAccountIds.get(0) === me : false + return { + amITalkingToMyself, chatMessageIds: state.getIn(['chat_conversation_messages', chatConversationId, 'items'], ImmutableList()), isLoading: state.getIn(['chat_conversation_messages', chatConversationId, 'isLoading'], true), isPartial: state.getIn(['chat_conversation_messages', chatConversationId, 'isPartial'], false), diff --git a/app/javascript/gabsocial/features/messages_settings.js b/app/javascript/gabsocial/features/messages_settings.js index 50820c5d..b186531d 100644 --- a/app/javascript/gabsocial/features/messages_settings.js +++ b/app/javascript/gabsocial/features/messages_settings.js @@ -1,36 +1,25 @@ import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' -import { injectIntl, FormattedMessage } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' -import debounce from 'lodash.debounce' import { me } from '../initial_state' -import { fetchMutes, expandMutes } from '../actions/mutes' -import Account from '../components/account' +import { changeChatSetting } from '../actions/chat_settings' import BlockHeading from '../components/block_heading' -import Button from '../components/button' import Form from '../components/form' -import Switch from '../components/switch' -import Text from '../components/text' +import SettingSwitch from '../components/setting_switch' import Divider from '../components/divider' class MessagesSettings extends ImmutablePureComponent { - componentWillMount() { - this.props.onFetchMutes() + handleOnChange = (key, checked) => { + this.props.onSave(key, checked) } - handleLoadMore = debounce(() => { - this.props.onExpandMutes() - }, 300, { leading: true }) - render() { - const { - accountIds, - hasMore, - isLoading, - } = this.props + const { chatSettings } = this.props + + if (!chatSettings) return null return (
@@ -40,23 +29,34 @@ class MessagesSettings extends ImmutablePureComponent {
- + { /* : todo :
-
- +
+ */ }
@@ -66,22 +66,18 @@ class MessagesSettings extends ImmutablePureComponent { } const mapStateToProps = (state) => ({ - accountIds: state.getIn(['user_lists', 'mutes', me, 'items']), - hasMore: !!state.getIn(['user_lists', 'mutes', me, 'next']), - isLoading: state.getIn(['user_lists', 'mutes', me, 'isLoading']), + chatSettings: state.getIn(['chat_settings']), }) const mapDispatchToProps = (dispatch) => ({ - onFetchMutes: () => dispatch(fetchMutes()), - onExpandMutes: () => dispatch(expandMutes()), + onSave(key, checked) { + // dispatch(changeChatSetting(key, checked)) + }, }) MessagesSettings.propTypes = { - accountIds: ImmutablePropTypes.list, - hasMore: PropTypes.bool, - isLoading: PropTypes.bool, - onExpandMutes: PropTypes.func.isRequired, - onFetchMutes: PropTypes.func.isRequired, + chatSettings: ImmutablePropTypes.map, + onSave: PropTypes.func.isRequired, } -export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(MessagesSettings)) \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(MessagesSettings) \ No newline at end of file diff --git a/app/javascript/gabsocial/layouts/messages_layout.js b/app/javascript/gabsocial/layouts/messages_layout.js index d6ace302..87614998 100644 --- a/app/javascript/gabsocial/layouts/messages_layout.js +++ b/app/javascript/gabsocial/layouts/messages_layout.js @@ -76,7 +76,7 @@ class MessagesLayout extends React.PureComponent { actions={[ { icon: 'add', - to: `'/messages/new'`, + to: '/messages/new', }, { icon: 'cog', diff --git a/app/javascript/gabsocial/layouts/search_layout.js b/app/javascript/gabsocial/layouts/search_layout.js index c226aafb..76641f54 100644 --- a/app/javascript/gabsocial/layouts/search_layout.js +++ b/app/javascript/gabsocial/layouts/search_layout.js @@ -79,10 +79,6 @@ class SearchLayout extends React.PureComponent { title: intl.formatMessage(messages.links), to: '/search/links', }, - { - title: intl.formatMessage(messages.hashtags), - to: '/search/hashtags', - }, ] } diff --git a/app/javascript/gabsocial/reducers/chat_conversation_lists.js b/app/javascript/gabsocial/reducers/chat_conversation_lists.js index 371bae18..f12b2788 100644 --- a/app/javascript/gabsocial/reducers/chat_conversation_lists.js +++ b/app/javascript/gabsocial/reducers/chat_conversation_lists.js @@ -15,6 +15,13 @@ import { CHAT_CONVERSATIONS_REQUESTED_EXPAND_FAIL, CHAT_CONVERSATION_REQUEST_APPROVE_SUCCESS, + + CHAT_CONVERSATIONS_MUTED_FETCH_REQUEST, + CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS, + CHAT_CONVERSATIONS_MUTED_FETCH_FAIL, + CHAT_CONVERSATIONS_MUTED_EXPAND_REQUEST, + CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS, + CHAT_CONVERSATIONS_MUTED_EXPAND_FAIL, } from '../actions/chat_conversations' const initialState = ImmutableMap({ @@ -28,6 +35,11 @@ const initialState = ImmutableMap({ isLoading: false, items: ImmutableList(), }), + muted: ImmutableMap({ + next: null, + isLoading: false, + items: ImmutableList(), + }), }) const normalizeList = (state, source, chatConversations, next) => { @@ -79,6 +91,18 @@ export default function chat_conversation_lists(state = initialState, action) { case CHAT_CONVERSATION_REQUEST_APPROVE_SUCCESS: return removeOneFromList(state, 'requested', action.chatConversation.chat_conversation_id) + + case CHAT_CONVERSATIONS_MUTED_FETCH_REQUEST: + case CHAT_CONVERSATIONS_MUTED_EXPAND_REQUEST: + return state.setIn(['muted', 'isLoading'], true) + case CHAT_CONVERSATIONS_MUTED_FETCH_FAIL: + case CHAT_CONVERSATIONS_MUTED_EXPAND_FAIL: + return state.setIn(['muted', 'isLoading'], false) + case CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS: + return normalizeList(state, 'muted', action.chatConversations, action.next) + case CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS: + return appendToList(state, 'muted', action.chatConversations, action.next) + default: return state } diff --git a/app/javascript/gabsocial/reducers/chat_settings.js b/app/javascript/gabsocial/reducers/chat_settings.js index 58d2b3aa..fa025ad2 100644 --- a/app/javascript/gabsocial/reducers/chat_settings.js +++ b/app/javascript/gabsocial/reducers/chat_settings.js @@ -17,9 +17,7 @@ const initialState = ImmutableMap({ export default function chat_settings(state = initialState, action) { switch(action.type) { case CHAT_SETTING_CHANGE: - return state - .setIn(action.path, action.value) - .set('saved', false) + return state.set(action.path, action.checked).set('saved', false) default: return state } diff --git a/app/javascript/gabsocial/reducers/hashtags.js b/app/javascript/gabsocial/reducers/hashtags.js new file mode 100644 index 00000000..651ab3d8 --- /dev/null +++ b/app/javascript/gabsocial/reducers/hashtags.js @@ -0,0 +1,20 @@ +import { + HASHTAG_FETCH_REQUEST, + HASHTAG_FETCH_SUCCESS, + HASHTAG_FETCH_FAIL, +} from '../actions/hashtags' +import { Map as ImmutableMap, fromJS } from 'immutable' + +const importHashtag = (state, hashtag) => state.set(`${hashtag.name}`.toLowerCase(), fromJS(hashtag)) + +const initialState = ImmutableMap() + +export default function hashtags(state = initialState, action) { + switch (action.type) { + case HASHTAG_FETCH_SUCCESS: + console.log("HASHTAG_FETCH_SUCCESS:", action) + return importHashtag(state, action.hashtag) + default: + return state + } +} diff --git a/app/javascript/gabsocial/reducers/index.js b/app/javascript/gabsocial/reducers/index.js index 3a2eb9dc..0e8e8f16 100644 --- a/app/javascript/gabsocial/reducers/index.js +++ b/app/javascript/gabsocial/reducers/index.js @@ -21,6 +21,7 @@ import group_categories from './group_categories' import group_editor from './group_editor' import group_lists from './group_lists' import group_relationships from './group_relationships' +import hashtags from './hashtags' import height_cache from './height_cache' import links from './links.js' import lists from './lists' @@ -75,6 +76,7 @@ const reducers = { group_editor, group_lists, group_relationships, + hashtags, height_cache, links, lists, diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 72d1d2cf..02de4d28 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -17,9 +17,12 @@ class FeedManager "feed:#{type}:#{id}:#{subtype}" end + # status or chatMessage def filter?(timeline_type, status, receiver_id) if timeline_type == :home filter_from_home?(status, receiver_id) + elsif timeline_type == :chat_message + filter_from_chat_messages?(status, receiver_id) elsif timeline_type == :mentions filter_from_mentions?(status, receiver_id) else @@ -140,6 +143,10 @@ class FeedManager (context == :home ? Mute.where(account_id: receiver_id, target_account_id: account_ids).any? : Mute.where(account_id: receiver_id, target_account_id: account_ids, hide_notifications: true).any?) end + def chat_blocks?(receiver_id, account_ids) + ChatBlock.where(account_id: receiver_id, target_account_id: account_ids).any? + end + def filter_from_home?(status, receiver_id) return false if receiver_id == status.account_id return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) @@ -170,6 +177,18 @@ class FeedManager false end + def filter_from_chat_messages?(chat_message, receiver_id) + return false if receiver_id == chat_message.from_account_id + return true if phrase_filtered_from_chat_message?(chat_message, receiver_id, :thread) + + check_for_blocks = [chat_message.from_account_id] + + return true if blocks_or_mutes?(receiver_id, check_for_blocks, :home) + return true if chat_blocks?(receiver_id, check_for_blocks) + + false + end + def filter_from_mentions?(status, receiver_id) return true if receiver_id == status.account_id return true if phrase_filtered?(status, receiver_id, :notifications) @@ -211,6 +230,29 @@ class FeedManager (status.spoiler_text.present? && !combined_regex.match(status.spoiler_text).nil?) end + def phrase_filtered_from_chat_message?(chat_message, receiver_id, context) + active_filters = Rails.cache.fetch("filters:#{receiver_id}") { CustomFilter.where(account_id: receiver_id).active_irreversible.to_a }.to_a + + active_filters.select! { |filter| filter.context.include?(context.to_s) && !filter.expired? } + + active_filters.map! do |filter| + if filter.whole_word + sb = filter.phrase =~ /\A[[:word:]]/ ? '\b' : '' + eb = filter.phrase =~ /[[:word:]]\z/ ? '\b' : '' + + /(?mix:#{sb}#{Regexp.escape(filter.phrase)}#{eb})/ + else + /#{Regexp.escape(filter.phrase)}/i + end + end + + return false if active_filters.empty? + + combined_regex = active_filters.reduce { |memo, obj| Regexp.union(memo, obj) } + + !combined_regex.match(chat_message.text).nil? + end + # Adds a status to an account's feed, returning true if a status was # added, and false if it was not added to the feed. Note that this is # an internal helper: callers must call trim or push updates if diff --git a/app/lib/sorting_query_builder.rb b/app/lib/sorting_query_builder.rb index ad0791e1..67d0ea3d 100644 --- a/app/lib/sorting_query_builder.rb +++ b/app/lib/sorting_query_builder.rb @@ -39,6 +39,7 @@ class SortingQueryBuilder < BaseService query = query.where('statuses.id > ? AND statuses.id <> ?', max_id, max_id) unless max_id.nil? || max_id.empty? query = query.limit(20) + # : todo : reject blocks, etc. in feedmanager # SELECT "statuses".* # FROM "statuses" # INNER JOIN "status_stats" ON "status_stats"."status_id" = "statuses"."id" diff --git a/app/models/chat_conversation_account.rb b/app/models/chat_conversation_account.rb index 34191256..f4a84020 100644 --- a/app/models/chat_conversation_account.rb +++ b/app/models/chat_conversation_account.rb @@ -37,8 +37,6 @@ class ChatConversationAccount < ApplicationRecord belongs_to :chat_conversation belongs_to :last_chat_message, class_name: 'ChatMessage', optional: true - validate :validate_total_limit - def participant_accounts if participant_account_ids.empty? [account] @@ -50,8 +48,4 @@ class ChatConversationAccount < ApplicationRecord private - def validate_total_limit - # errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: PER_ACCOUNT_APPROVED_LIMIT)) if account.scheduled_statuses.count >= PER_ACCOUNT_APPROVED_LIMIT - end - end diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 48260181..19c265dd 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -84,8 +84,8 @@ class MediaAttachment < ApplicationRecord }, }.freeze - IMAGE_LIMIT = Proc.new { |account| account.is_pro ? 50.megabytes : 8.megabytes } - VIDEO_LIMIT = Proc.new { |account| account.is_pro ? 1.gigabytes : 40.megabytes} + IMAGE_LIMIT = Proc.new { |account| account.is_pro ? 100.megabytes : 20.megabytes } + VIDEO_LIMIT = Proc.new { |account| account.is_pro ? 2.gigabytes : 250.megabytes} belongs_to :account, inverse_of: :media_attachments, optional: true belongs_to :status, inverse_of: :media_attachments, optional: true diff --git a/app/services/create_chat_conversation_service.rb b/app/services/create_chat_conversation_service.rb index 0f65da10..00fef0ca 100644 --- a/app/services/create_chat_conversation_service.rb +++ b/app/services/create_chat_conversation_service.rb @@ -15,26 +15,36 @@ class CreateChatConversationService < BaseService # : todo : # check if allow anyone to message then create with approved:true - # unique account id, participants - chat_conversation = ChatConversation.create + @chat_conversation = ChatConversation.create my_chat = ChatConversationAccount.create!( - account: current_account, - participant_account_ids: [@account.id.to_s], - chat_conversation: chat_conversation, + account: @current_account, + participant_account_ids: account_ids_as_array, + chat_conversation: @chat_conversation, is_approved: true ) - # : todo : if multiple ids - if @account.id != current_account.id - their_chat = ChatConversationAccount.create!( - account: @account, - participant_account_ids: [current_account.id.to_s], - chat_conversation: chat_conversation, - is_approved: false # : todo : check if allow all else default as request - ) + if @other_accounts.length == 1 && @other_accounts[0].id == @current_account.id + # dont create two conversations if you are chatting with yourself + else + for other_account in @other_accounts + this_conversation_participants = @other_accounts.map { |account| + account.id.to_s + }.reject { |id| id == other_account.id.to_s } << @current_account.id.to_s + + # is_approved = other_account&.user&.setting_chat_messages_restrict_non_followers == true + + ChatConversationAccount.create!( + account: other_account, + participant_account_ids: this_conversation_participants, + chat_conversation: @chat_conversation, + is_approved: false + ) + end end + + my_chat end def account_ids_as_array diff --git a/app/services/post_chat_message_service.rb b/app/services/post_chat_message_service.rb index 6f9b2481..98033773 100644 --- a/app/services/post_chat_message_service.rb +++ b/app/services/post_chat_message_service.rb @@ -54,13 +54,16 @@ class PostChatMessageService < BaseService # Get not mine if @account_conversation.id != recipient.id - recipient.unread_count = recipient.unread_count + 1 - recipient.is_hidden = false + # check if recipient is blocking me + unless recipient.account.chat_blocking?(@account) + recipient.unread_count = recipient.unread_count + 1 + recipient.is_hidden = false - # check if muting - unless recipient.is_muted - payload = InlineRenderer.render(@chat, recipient.account, :chat_message) - Redis.current.publish("chat_messages:#{recipient.account.id}", Oj.dump(event: :notification, payload: payload)) + # check if muting + unless recipient.is_muted + payload = InlineRenderer.render(@chat, recipient.account, :chat_message) + Redis.current.publish("chat_messages:#{recipient.account.id}", Oj.dump(event: :notification, payload: payload)) + end end else recipient.unread_count = 0 @@ -72,21 +75,7 @@ class PostChatMessageService < BaseService def set_chat_conversation_recipients! @account_conversation = ChatConversationAccount.where(account: @account, chat_conversation: @chat_conversation).first - @chat_conversation_recipients_accounts = ChatConversationAccount.where(chat_conversation: @chat_conversation) - - # if 1-to-1 chat, check for blocking and dont allow message to send if blocking - # if 1-to-many let chat go through but keep is_hidden - @chat_conversation_recipients_accounts.each do |recipient| - # : todo : - # check if chat blocked - # check if normal blocked - - if recipient.account.blocking?(@account) || recipient.account.chat_blocking?(@account) - raise GabSocial::NotPermittedError - end - end - - + @chat_conversation_recipients_accounts = ChatConversationAccount.where(chat_conversation: @chat_conversation) rescue ArgumentError raise ActiveRecord::RecordInvalid end diff --git a/config/routes.rb b/config/routes.rb index 044177db..0d7e5114 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -227,7 +227,7 @@ Rails.application.routes.draw do end namespace :chat_conversation_accounts do - resource :blocked_chat_accounts, only: :show, controller: 'chat_conversation_accounts/blocked_chat_accounts' + # end resources :chat_conversation_accounts, only: :show do @@ -256,6 +256,8 @@ Rails.application.routes.draw do get :count end end + resources :blocked_chat_accounts, only: :index + resources :muted_conversations, only: :index end resources :chat_conversation, only: [:show, :create] do @@ -268,6 +270,7 @@ Rails.application.routes.draw do end resources :links, only: :show + resources :hashtags, only: :show resource :popular_links, only: :show resources :streaming, only: [:index] resources :custom_emojis, only: [:index] diff --git a/package.json b/package.json index e1af2715..b27af978 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,7 @@ "react-router-dom": "^4.1.1", "react-router-scroll-4": "^1.0.0-beta.2", "react-sortable-hoc": "^1.11.0", + "react-sparklines": "^1.7.0", "react-stickynode": "^3.0.4", "react-swipeable-views": "^0.13.9", "react-textarea-autosize": "^7.1.0", diff --git a/yarn.lock b/yarn.lock index 77d00a6d..957e27f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6618,6 +6618,13 @@ react-sortable-hoc@^1.11.0: invariant "^2.2.4" prop-types "^15.5.7" +react-sparklines@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/react-sparklines/-/react-sparklines-1.7.0.tgz#9b1d97e8c8610095eeb2ad658d2e1fcf91f91a60" + integrity sha512-bJFt9K4c5Z0k44G8KtxIhbG+iyxrKjBZhdW6afP+R7EnIq+iKjbWbEFISrf3WKNFsda+C46XAfnX0StS5fbDcg== + dependencies: + prop-types "^15.5.10" + react-stickynode@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-stickynode/-/react-stickynode-3.0.4.tgz#1e9c096cec3613cc8294807eba319ced074c8b21"