|
@@ -15,7 +15,8 @@ import {
|
15
|
15
|
getThreadContent,
|
16
|
16
|
getThreadComment,
|
17
|
17
|
postThreadNewComment,
|
18
|
|
- putThreadStatus
|
|
18
|
+ putThreadStatus,
|
|
19
|
+ putThreadContent
|
19
|
20
|
} from '../action.async.js'
|
20
|
21
|
|
21
|
22
|
class Thread extends React.Component {
|
|
@@ -91,6 +92,18 @@ class Thread extends React.Component {
|
91
|
92
|
GLOBAL_dispatchEvent({type: 'appClosed', data: {}}) // handled by tracim_front::src/container/WorkspaceContent.jsx
|
92
|
93
|
}
|
93
|
94
|
|
|
95
|
+ handleSaveEditTitle = async newTitle => {
|
|
96
|
+ const { config, content } = this.state
|
|
97
|
+
|
|
98
|
+ const fetchResultSaveThread = putThreadContent(config.apiUrl, content.workspace_id, content.content_id, newTitle)
|
|
99
|
+
|
|
100
|
+ handleFetchResult(await fetchResultSaveThread)
|
|
101
|
+ .then(resSave => {
|
|
102
|
+ if (resSave.apiResponse.status === 200) this.loadContent()
|
|
103
|
+ else console.warn('Error saving threads. Result:', resSave, 'content:', content, 'config:', config)
|
|
104
|
+ })
|
|
105
|
+ }
|
|
106
|
+
|
94
|
107
|
handleChangeNewComment = e => {
|
95
|
108
|
const newComment = e.target.value
|
96
|
109
|
this.setState({newComment})
|
|
@@ -146,6 +159,7 @@ class Thread extends React.Component {
|
146
|
159
|
faIcon={config.faIcon}
|
147
|
160
|
title={content.label}
|
148
|
161
|
onClickCloseBtn={this.handleClickBtnCloseApp}
|
|
162
|
+ onValidateChangeTitle={this.handleSaveEditTitle}
|
149
|
163
|
/>
|
150
|
164
|
|
151
|
165
|
<PopinFixedOption customClass={`wsContentThread`} i18n={i18n}>
|