<commit_before>import React from 'react'
import {connect} from 'react-redux'
import {createPost, expandSendTo} from '../redux/action-creators'
import {joinPostData, joinCreatePostData, postActions, userActions} from './select-utils'
import {getQuery, getCurrentRouteName} from '../utils'

import CreatePost from './create-post'
import Feed from './feed'
import PaginatedView from './paginated-view'
import UserProfile from './user-profile'
import Breadcrumbs from './breadcrumbs'

const UserFeedHandler = (props) => {
  return (
    <div className='box'>
      <div className='box-header-timeline'>
        {props.boxHeader}
      </div>
      <div className='box-body'>
        {props.breadcrumbs.shouldShowBreadcrumbs ? <Breadcrumbs {...props.breadcrumbs}/> : false}
        <UserProfile
          {...props.viewUser}
          {...props.userActions}
          user={props.user}
          sendTo={props.sendTo}
          expandSendTo={props.expandSendTo}
          createPostViewState={props.createPostViewState}
          createPost={props.createPost}
          createPostForm={props.createPostForm}
          addAttachmentResponse={props.addAttachmentResponse}/>
      </div>
      {props.viewUser.blocked ?
        false :
        <PaginatedView>
          <Feed {...props} isInUserFeed={true}/>
        </PaginatedView>}
      <div className='box-footer'>
      </div>
    </div>)
}

function selectState(state) {
  const user = state.user
  const authenticated = state.authenticated
  const visibleEntries = state.feedViewState.visibleEntries.map(joinPostData(state))
  const createPostViewState = state.createPostViewState
  const createPostForm = joinCreatePostData(state)
  const timelines = state.timelines
  const boxHeader = state.boxHeader
  const foundUser = Object.getOwnPropertyNames(state.users)
  .map(key => state.users[key] || state.subscribers[key])
  .filter(user => user.username === state.router.params.userName)[0]

  const amIGroupAdmin = (
    authenticated &&
    foundUser &&
    foundUser.type === 'group' &&
    ((foundUser.administrators || []).indexOf(state.user.id) > -1)
  )

  const statusExtension = {
    authenticated,
    me: !foundUser || foundUser.username === user.username,
    amIGroupAdmin: amIGroupAdmin,
    subscribed: authenticated && foundUser && (user.subscriptions.indexOf(foundUser.id) !== -1),
    blocked: authenticated && foundUser && (user.banIds.indexOf(foundUser.id) > -1),
  }

  const viewUser = {...(foundUser || state.user), ...statusExtension}

  const currentRouteName = getCurrentRouteName(state.router)

  const shouldShowBreadcrumbs = ['userComments', 'userLikes'].indexOf(currentRouteName) !== -1

  const breadcrumbs = {
    shouldShowBreadcrumbs,
    user: viewUser,
    breadcrumb: currentRouteName.replace('user','')
  }

  const sendTo = state.sendTo

  return { user, visibleEntries, timelines, createPostViewState, createPostForm, boxHeader, viewUser, breadcrumbs, sendTo }
}
<commit_msg>Do not show current user on someone else's user feed...<commit_after>import React from 'react'
import {connect} from 'react-redux'
import {createPost, expandSendTo} from '../redux/action-creators'
import {joinPostData, joinCreatePostData, postActions, userActions} from './select-utils'
import {getQuery, getCurrentRouteName} from '../utils'

import CreatePost from './create-post'
import Feed from './feed'
import PaginatedView from './paginated-view'
import UserProfile from './user-profile'
import Breadcrumbs from './breadcrumbs'

const UserFeedHandler = (props) => {
  return (
    <div className='box'>
      <div className='box-header-timeline'>
        {props.boxHeader}
      </div>
      <div className='box-body'>
        {props.breadcrumbs.shouldShowBreadcrumbs ? <Breadcrumbs {...props.breadcrumbs}/> : false}
        <UserProfile
          {...props.viewUser}
          {...props.userActions}
          user={props.user}
          sendTo={props.sendTo}
          expandSendTo={props.expandSendTo}
          createPostViewState={props.createPostViewState}
          createPost={props.createPost}
          createPostForm={props.createPostForm}
          addAttachmentResponse={props.addAttachmentResponse}/>
      </div>
      {props.viewUser.blocked ?
        false :
        <PaginatedView>
          <Feed {...props} isInUserFeed={true}/>
        </PaginatedView>}
      <div className='box-footer'>
      </div>
    </div>)
}

function selectState(state) {
  const user = state.user
  const authenticated = state.authenticated
  const visibleEntries = state.feedViewState.visibleEntries.map(joinPostData(state))
  const createPostViewState = state.createPostViewState
  const createPostForm = joinCreatePostData(state)
  const timelines = state.timelines
  const boxHeader = state.boxHeader
  const foundUser = Object.getOwnPropertyNames(state.users)
  .map(key => state.users[key] || state.subscribers[key])
  .filter(user => user.username === state.router.params.userName)[0]

  const amIGroupAdmin = (
    authenticated &&
    foundUser &&
    foundUser.type === 'group' &&
    ((foundUser.administrators || []).indexOf(state.user.id) > -1)
  )

  const statusExtension = {
    authenticated,
    me: !foundUser || foundUser.username === user.username,
    amIGroupAdmin: amIGroupAdmin,
    subscribed: authenticated && foundUser && (user.subscriptions.indexOf(foundUser.id) !== -1),
    blocked: authenticated && foundUser && (user.banIds.indexOf(foundUser.id) > -1),
  }

  const viewUser = {...(foundUser), ...statusExtension}

  const currentRouteName = getCurrentRouteName(state.router)

  const shouldShowBreadcrumbs = ['userComments', 'userLikes'].indexOf(currentRouteName) !== -1

  const breadcrumbs = {
    shouldShowBreadcrumbs,
    user: viewUser,
    breadcrumb: currentRouteName.replace('user','')
  }

  const sendTo = state.sendTo

  return { user, visibleEntries, timelines, createPostViewState, createPostForm, boxHeader, viewUser, breadcrumbs, sendTo }
}

{'fraction_non_alphanumeric': 0.1296979865771812, 'fraction_numerical': 0.0016778523489932886, 'mean_word_length': 3.613777089783282, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6411030', 'n_tokens_mistral': 1785, 'n_tokens_neox': 1779, 'n_words': 360}