Browse Source

give up pinned statuses, and add tree to navigation/tabs_bar, with funny way

closed-social-v3
欧醚 5 years ago
parent
commit
718814bfbf
8 changed files with 16 additions and 12 deletions
  1. +1
    -9
      app/controllers/api/v1/timelines/public_controller.rb
  2. +5
    -1
      app/javascript/mastodon/features/compose/index.js
  3. +2
    -2
      app/javascript/mastodon/features/ui/components/navigation_panel.js
  4. +3
    -0
      app/javascript/mastodon/features/ui/components/tabs_bar.js
  5. +2
    -0
      app/javascript/mastodon/initial_state.js
  6. +1
    -0
      app/javascript/mastodon/locales/en.json
  7. +1
    -0
      app/javascript/mastodon/locales/zh-CN.json
  8. +1
    -0
      app/serializers/initial_state_serializer.rb

+ 1
- 9
app/controllers/api/v1/timelines/public_controller.rb View File

@ -18,15 +18,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
end
def load_statuses
(cached_0_pinned_statuses + cached_public_statuses).uniq(&:id)
end
def cached_0_pinned_statuses
if not params_slice(:max_id, :since_id, :min_id).empty?
return []
end
z_pinned = Account.find(1).pinned_statuses
cache_collection z_pinned, Status
cached_public_statuses
end
def cached_public_statuses

+ 5
- 1
app/javascript/mastodon/features/compose/index.js View File

@ -14,13 +14,14 @@ import SearchResultsContainer from './containers/search_results_container';
import { changeComposing } from '../../actions/compose';
import { openModal } from 'mastodon/actions/modal';
import elephantUIPlane from '../../../images/elephant_ui_plane.svg';
import { mascot } from '../../initial_state';
import { mascot, treeRoot } from '../../initial_state';
import Icon from 'mastodon/components/icon';
import { logOut } from 'mastodon/utils/log_out';
const messages = defineMessages({
start: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
tree: {id: 'tabs_bar.tree', defaultMessage: 'Tree'},
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
@ -101,6 +102,9 @@ class Compose extends React.PureComponent {
{!columns.some(column => column.get('id') === 'HOME') && (
<Link to='/timelines/home' className='drawer__tab' title={intl.formatMessage(messages.home_timeline)} aria-label={intl.formatMessage(messages.home_timeline)}><Icon id='home' fixedWidth /></Link>
)}
{!columns.some(column => column.get('id') === 'TREE') && (
<Link to={treeRoot} className='drawer__tab' title={intl.formatMessage(messages.tree)} aria-label={intl.formatMessage(messages.tree)}><Icon id='tree' fixedWidth /></Link>
)}
{!columns.some(column => column.get('id') === 'NOTIFICATIONS') && (
<Link to='/notifications' className='drawer__tab' title={intl.formatMessage(messages.notifications)} aria-label={intl.formatMessage(messages.notifications)}><Icon id='bell' fixedWidth /></Link>
)}

+ 2
- 2
app/javascript/mastodon/features/ui/components/navigation_panel.js View File

@ -2,7 +2,7 @@ import React from 'react';
import { NavLink, withRouter } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import Icon from 'mastodon/components/icon';
import { profile_directory, showTrends } from 'mastodon/initial_state';
import { profile_directory, showTrends, treeRoot } from 'mastodon/initial_state';
import NotificationsCounterIcon from './notifications_counter_icon';
import FollowRequestsNavLink from './follow_requests_nav_link';
import ListPanel from './list_panel';
@ -11,7 +11,7 @@ import TrendsContainer from 'mastodon/features/getting_started/containers/trends
const NavigationPanel = () => (
<div className='navigation-panel'>
<NavLink className='column-link column-link--transparent' to='/timelines/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon className='column-link__icon' id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>
<NavLink className='column-link column-link--transparent' to='/statuses/102995298871197915' data-preview-title-id='column.tree' data-preview-icon='tree' ><Icon className='column-link__icon' id='tree' fixedWidth /><FormattedMessage id='tabs_bar.tree' defaultMessage='Tree' /></NavLink>
<NavLink className='column-link column-link--transparent' to={treeRoot} data-preview-title-id='column.tree' data-preview-icon='tree' ><Icon className='column-link__icon' id='tree' fixedWidth /><FormattedMessage id='tabs_bar.tree' defaultMessage='Tree' /></NavLink>
<NavLink className='column-link column-link--transparent' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><NotificationsCounterIcon className='column-link__icon' /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink>
<FollowRequestsNavLink />
<NavLink className='column-link column-link--transparent' to='/timelines/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><Icon className='column-link__icon' id='users' fixedWidth /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink>

+ 3
- 0
app/javascript/mastodon/features/ui/components/tabs_bar.js View File

@ -7,8 +7,11 @@ import { isUserTouching } from '../../../is_mobile';
import Icon from 'mastodon/components/icon';
import NotificationsCounterIcon from './notifications_counter_icon';
import { treeRoot } from '../../../initial_state';
export const links = [
<NavLink className='tabs-bar__link' to='/timelines/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>,
<NavLink className='tabs-bar__link' to={treeRoot} data-preview-title-id='column.tree' data-preview-icon='tree' ><Icon id='tree' fixedWidth /><FormattedMessage id='tabs_bar.tree' defaultMessage='Tree' /></NavLink>,
<NavLink className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><NotificationsCounterIcon /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink>,
<NavLink className='tabs-bar__link' to='/timelines/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><Icon id='users' fixedWidth /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink>,
<NavLink className='tabs-bar__link' exact to='/timelines/public' data-preview-title-id='column.public' data-preview-icon='globe' ><Icon id='globe' fixedWidth /><FormattedMessage id='tabs_bar.federated_timeline' defaultMessage='Federated' /></NavLink>,

+ 2
- 0
app/javascript/mastodon/initial_state.js View File

@ -25,4 +25,6 @@ export const usePendingItems = getMeta('use_pending_items');
export const showTrends = getMeta('trends');
export const title = getMeta('title');
export const treeRoot = getMeta('tree_root');
export default initialState;

+ 1
- 0
app/javascript/mastodon/locales/en.json View File

@ -58,6 +58,7 @@
"column.favourites": "Favourites",
"column.follow_requests": "Follow requests",
"column.home": "Home",
"column.tree": "Tree",
"column.lists": "Lists",
"column.mutes": "Muted users",
"column.notifications": "Notifications",

+ 1
- 0
app/javascript/mastodon/locales/zh-CN.json View File

@ -58,6 +58,7 @@
"column.favourites": "赞藏",
"column.follow_requests": "关注请求",
"column.home": "主页",
"column.tree": "闭社树",
"column.lists": "列表",
"column.mutes": "已隐藏的用户",
"column.notifications": "通知",

+ 1
- 0
app/serializers/initial_state_serializer.rb View File

@ -22,6 +22,7 @@ class InitialStateSerializer < ActiveModel::Serializer
mascot: instance_presenter.mascot&.file&.url,
profile_directory: Setting.profile_directory,
trends: Setting.trends,
tree_root: Setting.site_description,
}
if object.current_account

Loading…
Cancel
Save