<commit_before>import PropTypes from 'prop-types'
import React, { Component } from 'react'
import {
  commentFeedLike,
  contentFeedLike,
  feedCommentDelete,
  feedCommentEdit,
  feedContentDelete,
  feedVideoStar,
  fetchMoreFeedsAsync,
  fetchFeedsAsync,
  fetchFeed,
  likeTargetComment,
  loadMoreFeedReplies,
  loadMoreFeedCommentsAsync,
  clearFeeds,
  questionFeedLike,
  showFeedCommentsAsync,
  uploadFeedComment,
  uploadFeedReply,
  uploadTargetContentComment
} from 'redux/actions/FeedActions'
import InputPanel from './InputPanel'
import ContentPanel from 'components/ContentPanel'
import LoadMoreButton from 'components/LoadMoreButton'
import Loading from 'components/Loading'
import { connect } from 'react-redux'
import { addEvent, removeEvent } from 'helpers/listenerHelpers'
import { feedContentEdit } from '../../../redux/actions/FeedActions'

class Stories extends Component {
  static propTypes = {
    chatMode: PropTypes.bool,
    clearFeeds: PropTypes.func.isRequired,
    contentFeedLike: PropTypes.func.isRequired,
    commentFeedLike: PropTypes.func.isRequired,
    feeds: PropTypes.array.isRequired,
    feedCommentDelete: PropTypes.func.isRequired,
    feedContentDelete: PropTypes.func.isRequired,
    feedContentEdit: PropTypes.func.isRequired,
    feedCommentEdit: PropTypes.func.isRequired,
    feedVideoStar: PropTypes.func.isRequired,
    fetchFeed: PropTypes.func.isRequired,
    fetchFeeds: PropTypes.func.isRequired,
    fetchMoreFeeds: PropTypes.func.isRequired,
    history: PropTypes.object.isRequired,
    likeTargetComment: PropTypes.func.isRequired,
    loaded: PropTypes.bool.isRequired,
    loadMoreButton: PropTypes.bool.isRequired,
    loadMoreFeedCommentsAsync: PropTypes.func.isRequired,
    loadMoreFeedReplies: PropTypes.func.isRequired,
    questionFeedLike: PropTypes.func.isRequired,
    selectedFilter: PropTypes.string.isRequired,
    showFeedCommentsAsync: PropTypes.func.isRequired,
    uploadFeedComment: PropTypes.func.isRequired,
    uploadFeedReply: PropTypes.func.isRequired,
    uploadTargetContentComment: PropTypes.func.isRequired,
    userId: PropTypes.number
  }

  clearingFeeds = false
  scrollHeight = 0

  constructor() {
    super()
    this.state = {
      loadingMore: false,
      scrollPosition: 0
    }
    this.applyFilter = this.applyFilter.bind(this)
    this.loadMoreFeeds = this.loadMoreFeeds.bind(this)
    this.renderFilterBar = this.renderFilterBar.bind(this)
    this.onScroll = this.onScroll.bind(this)
  }

  async componentDidMount() {
    let { history, clearFeeds, fetchFeeds, loaded } = this.props
    addEvent(window, 'scroll', this.onScroll)
    if (history.action === 'PUSH' || !loaded) {
      this.clearingFeeds = true
      await clearFeeds()
      this.clearingFeeds = false
      fetchFeeds()
    }
  }

  componentWillUnmount() {
    const { clearFeeds } = this.props
    clearFeeds()
    removeEvent(window, 'scroll', this.onScroll)
  }

  render() {
    const {
      contentFeedLike,
      commentFeedLike,
      feeds,
      feedCommentDelete,
      feedCommentEdit,
      feedContentDelete,
      feedContentEdit,
      feedVideoStar,
      fetchFeed,
      likeTargetComment,
      loadMoreButton,
      loadMoreFeedReplies,
      uploadFeedReply,
      userId,
      loaded,
      loadMoreFeedCommentsAsync,
      questionFeedLike,
      showFeedCommentsAsync,
      uploadFeedComment,<commit_msg>insert test console log to home story component<commit_after>import PropTypes from 'prop-types'
import React, { Component } from 'react'
import {
  commentFeedLike,
  contentFeedLike,
  feedCommentDelete,
  feedCommentEdit,
  feedContentDelete,
  feedVideoStar,
  fetchMoreFeedsAsync,
  fetchFeedsAsync,
  fetchFeed,
  likeTargetComment,
  loadMoreFeedReplies,
  loadMoreFeedCommentsAsync,
  clearFeeds,
  questionFeedLike,
  showFeedCommentsAsync,
  uploadFeedComment,
  uploadFeedReply,
  uploadTargetContentComment
} from 'redux/actions/FeedActions'
import InputPanel from './InputPanel'
import ContentPanel from 'components/ContentPanel'
import LoadMoreButton from 'components/LoadMoreButton'
import Loading from 'components/Loading'
import { connect } from 'react-redux'
import { addEvent, removeEvent } from 'helpers/listenerHelpers'
import { feedContentEdit } from '../../../redux/actions/FeedActions'

class Stories extends Component {
  static propTypes = {
    chatMode: PropTypes.bool,
    clearFeeds: PropTypes.func.isRequired,
    contentFeedLike: PropTypes.func.isRequired,
    commentFeedLike: PropTypes.func.isRequired,
    feeds: PropTypes.array.isRequired,
    feedCommentDelete: PropTypes.func.isRequired,
    feedContentDelete: PropTypes.func.isRequired,
    feedContentEdit: PropTypes.func.isRequired,
    feedCommentEdit: PropTypes.func.isRequired,
    feedVideoStar: PropTypes.func.isRequired,
    fetchFeed: PropTypes.func.isRequired,
    fetchFeeds: PropTypes.func.isRequired,
    fetchMoreFeeds: PropTypes.func.isRequired,
    history: PropTypes.object.isRequired,
    likeTargetComment: PropTypes.func.isRequired,
    loaded: PropTypes.bool.isRequired,
    loadMoreButton: PropTypes.bool.isRequired,
    loadMoreFeedCommentsAsync: PropTypes.func.isRequired,
    loadMoreFeedReplies: PropTypes.func.isRequired,
    questionFeedLike: PropTypes.func.isRequired,
    selectedFilter: PropTypes.string.isRequired,
    showFeedCommentsAsync: PropTypes.func.isRequired,
    uploadFeedComment: PropTypes.func.isRequired,
    uploadFeedReply: PropTypes.func.isRequired,
    uploadTargetContentComment: PropTypes.func.isRequired,
    userId: PropTypes.number
  }

  clearingFeeds = false
  scrollHeight = 0

  constructor() {
    super()
    this.state = {
      loadingMore: false,
      scrollPosition: 0
    }
    this.applyFilter = this.applyFilter.bind(this)
    this.loadMoreFeeds = this.loadMoreFeeds.bind(this)
    this.renderFilterBar = this.renderFilterBar.bind(this)
    this.onScroll = this.onScroll.bind(this)
  }

  async componentDidMount() {
    let { history, clearFeeds, fetchFeeds, loaded } = this.props
    addEvent(window, 'scroll', this.onScroll)
    if (history.action === 'PUSH' || !loaded) {
      console.log('clearing feeds')
      this.clearingFeeds = true
      await clearFeeds()
      this.clearingFeeds = false
      console.log('fetching feeds')
      fetchFeeds()
    }
  }

  componentWillUnmount() {
    const { clearFeeds } = this.props
    clearFeeds()
    removeEvent(window, 'scroll', this.onScroll)
  }

  render() {
    const {
      contentFeedLike,
      commentFeedLike,
      feeds,
      feedCommentDelete,
      feedCommentEdit,
      feedContentDelete,
      feedContentEdit,
      feedVideoStar,
      fetchFeed,
      likeTargetComment,
      loadMoreButton,
      loadMoreFeedReplies,
      uploadFeedReply,
      userId,
      loaded,
      loadMoreFeedCommentsAsync,
      questionFeedLike,
      showFeedCommentsAsync,
      uploadFeedComment,
{'fraction_non_alphanumeric': 0.08696908407974574, 'fraction_numerical': 0.0005778676683039584, 'mean_word_length': 3.8684950773558366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1773912', 'n_tokens_mistral': 2004, 'n_tokens_neox': 2047, 'n_words': 384}