diff --git a/app/controllers/api/v1/groups_controller.rb b/app/controllers/api/v1/groups_controller.rb index 8231ef00..837540f6 100644 --- a/app/controllers/api/v1/groups_controller.rb +++ b/app/controllers/api/v1/groups_controller.rb @@ -14,7 +14,7 @@ class Api::V1::GroupsController < Api::BaseController when 'featured' @groups = Group.where(is_featured: true).limit(25).all when 'member' - @groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).all + @groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).order('group_accounts.unread_count DESC, group_accounts.id DESC').all when 'admin' @groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account, role: :admin }).all end diff --git a/app/javascript/gabsocial/features/groups/sidebar_panel/index.js b/app/javascript/gabsocial/features/groups/sidebar_panel/index.js index 21880178..88e74928 100644 --- a/app/javascript/gabsocial/features/groups/sidebar_panel/index.js +++ b/app/javascript/gabsocial/features/groups/sidebar_panel/index.js @@ -5,9 +5,11 @@ import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import Item from './item'; import Icon from 'gabsocial/components/icon'; +import { Link } from 'react-router-dom'; const messages = defineMessages({ title: { id: 'groups.sidebar-panel.title', defaultMessage: 'Groups you\'re in' }, + show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' }, }); const mapStateToProps = (state, { id }) => ({ @@ -23,9 +25,10 @@ class GroupSidebarPanel extends ImmutablePureComponent { render() { const { intl, groupIds } = this.props; + const count = groupIds.count(); // Only when there are groups to show - if (groupIds.count() === 0) return null; + if (count === 0) return null; return (