1- import PropTypes from 'prop-types' ;
21import React from 'react' ;
2+ import { RouteComponentProps } from 'react-router/lib/Router' ;
33
44import {
55 addErrorMessage ,
@@ -15,27 +15,34 @@ import ConfigStore from 'app/stores/configStore';
1515import ErrorBoundary from 'app/components/errorBoundary' ;
1616import Note from 'app/components/activity/note' ;
1717import NoteInputWithStorage from 'app/components/activity/note/inputWithStorage' ;
18- import SentryTypes from 'app/sentryTypes' ;
1918import withApi from 'app/utils/withApi' ;
2019import withOrganization from 'app/utils/withOrganization' ;
20+ import { Activity , Group , Organization , User } from 'app/types' ;
21+ import { Client } from 'app/api' ;
22+ import { CreateError } from 'app/components/activity/note/types' ;
23+ import { DEFAULT_ERROR_JSON } from 'app/constants' ;
2124
2225import GroupActivityItem from './groupActivityItem' ;
2326
24- function makeDefaultErrorJson ( ) {
25- return { detail : t ( 'Unknown error. Please try again.' ) } ;
26- }
27+ type Props = {
28+ api : Client ;
29+ organization : Organization ;
30+ group : Group ;
31+ } & RouteComponentProps < { orgId : string } , { } > ;
2732
28- class GroupActivity extends React . Component {
29- // TODO(dcramer): only re-render on group/activity change
30- static propTypes = {
31- api : PropTypes . object ,
32- organization : SentryTypes . Organization . isRequired ,
33- group : SentryTypes . Group ,
34- } ;
33+ type State = {
34+ createBusy : boolean ;
35+ error : boolean ;
36+ errorJSON : CreateError | null ;
37+ inputId : string ;
38+ } ;
3539
36- state = {
40+ class GroupActivity extends React . Component < Props , State > {
41+ // TODO(dcramer): only re-render on group/activity change
42+ state : State = {
3743 createBusy : false ,
3844 error : false ,
45+ errorJSON : null ,
3946 inputId : uniqueId ( ) ,
4047 } ;
4148
@@ -80,7 +87,7 @@ class GroupActivity extends React.Component {
8087 this . setState ( {
8188 createBusy : false ,
8289 error : true ,
83- errorJSON : error . responseJSON || makeDefaultErrorJson ( ) ,
90+ errorJSON : error . responseJSON || DEFAULT_ERROR_JSON ,
8491 } ) ;
8592 addErrorMessage ( t ( 'Unable to post comment' ) ) ;
8693 }
@@ -89,22 +96,15 @@ class GroupActivity extends React.Component {
8996 handleNoteUpdate = async ( note , { modelId, text : oldText } ) => {
9097 const { api, group} = this . props ;
9198
92- this . setState ( {
93- updateBusy : true ,
94- } ) ;
9599 addLoadingMessage ( t ( 'Updating comment...' ) ) ;
96100
97101 try {
98102 await updateNote ( api , group , note , modelId , oldText ) ;
99- this . setState ( {
100- updateBusy : false ,
101- } ) ;
102103 clearIndicators ( ) ;
103104 } catch ( error ) {
104105 this . setState ( {
105- updateBusy : false ,
106106 error : true ,
107- errorJSON : error . responseJSON || makeDefaultErrorJson ( ) ,
107+ errorJSON : error . responseJSON || DEFAULT_ERROR_JSON ,
108108 } ) ;
109109 addErrorMessage ( t ( 'Unable to update comment' ) ) ;
110110 }
@@ -115,6 +115,7 @@ class GroupActivity extends React.Component {
115115 const me = ConfigStore . get ( 'user' ) ;
116116 const projectSlugs = group && group . project ? [ group . project . slug ] : [ ] ;
117117 const noteProps = {
118+ minHeight : 140 ,
118119 group,
119120 projectSlugs,
120121 placeholder : t (
@@ -141,21 +142,21 @@ class GroupActivity extends React.Component {
141142 ) }
142143 </ ActivityItem >
143144
144- { group . activity . map ( item => {
145+ { group . activity . map ( ( item : Activity ) => {
145146 const authorName = item . user ? item . user . name : 'Sentry' ;
146147
147148 if ( item . type === 'note' ) {
148149 return (
149150 < ErrorBoundary mini key = { `note-${ item . id } ` } >
150151 < Note
152+ showTime = { false }
151153 text = { item . data . text }
152154 modelId = { item . id }
153- user = { item . user }
155+ user = { item . user as User }
154156 dateCreated = { item . dateCreated }
155157 authorName = { authorName }
156158 onDelete = { this . handleNoteDelete }
157159 onUpdate = { this . handleNoteUpdate }
158- busy = { this . state . updateBusy }
159160 { ...noteProps }
160161 />
161162 </ ErrorBoundary >
@@ -164,7 +165,6 @@ class GroupActivity extends React.Component {
164165 return (
165166 < ErrorBoundary mini key = { `item-${ item . id } ` } >
166167 < ActivityItem
167- item = { item }
168168 author = { { type : item . user ? 'user' : 'system' , user : item . user } }
169169 date = { item . dateCreated }
170170 header = {
0 commit comments