Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9e4164d4
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e4164d4
编写于
8月 03, 2017
作者:
F
Filipa Lacerda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Keep the replies when the user leaves the page
上级
b5b562a3
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
45 addition
and
21 deletion
+45
-21
app/assets/javascripts/autosave.js
app/assets/javascripts/autosave.js
+5
-0
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+8
-5
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+15
-1
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+0
-1
app/assets/javascripts/notes/components/issue_note_body.vue
app/assets/javascripts/notes/components/issue_note_body.vue
+11
-0
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+5
-13
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
未找到文件。
app/assets/javascripts/autosave.js
浏览文件 @
9e4164d4
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
window
.
Autosave
=
(
function
()
{
window
.
Autosave
=
(
function
()
{
/**
*
* @param {*} field the textarea
* @param {Array} key Array with: ['Note', type, id, ]
*/
function
Autosave
(
field
,
key
)
{
function
Autosave
(
field
,
key
)
{
this
.
field
=
field
;
this
.
field
=
field
;
this
.
isLocalStorageAvailable
=
AccessorUtilities
.
isLocalStorageAccessSafe
();
this
.
isLocalStorageAvailable
=
AccessorUtilities
.
isLocalStorageAccessSafe
();
...
...
app/assets/javascripts/notes/components/issue_comment_form.vue
浏览文件 @
9e4164d4
<
script
>
<
script
>
/* global Flash */
/* global Flash
, Autosave
*/
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
*
as
constants
from
'
../constants
'
;
import
*
as
constants
from
'
../constants
'
;
import
'
../../autosave
'
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -153,15 +154,17 @@
...
@@ -153,15 +154,17 @@
}
}
}
}
},
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
},
},
},
mounted
()
{
mounted
()
{
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
// jQuery is needed here because it is a custom event being dispatched with jQuery.
$
(
document
).
on
(
'
issuable:change
'
,
(
e
,
isClosed
)
=>
{
this
.
issueState
=
isClosed
?
constants
.
CLOSED
:
constants
.
REOPENED
;
this
.
issueState
=
isClosed
?
constants
.
CLOSED
:
constants
.
REOPENED
;
});
});
},
destroyed
()
{
this
.
initAutoSave
();
eventHub
.
$off
(
'
issueStateChanged
'
);
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
浏览文件 @
9e4164d4
<
script
>
<
script
>
/* global Flash */
/* global Flash
, Autosave
*/
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
SYSTEM_NOTE
}
from
'
../constants
'
;
import
{
SYSTEM_NOTE
}
from
'
../constants
'
;
import
issueNote
from
'
./issue_note.vue
'
;
import
issueNote
from
'
./issue_note.vue
'
;
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
placeholderNote
from
'
./issue_placeholder_note.vue
'
;
import
placeholderNote
from
'
./issue_placeholder_note.vue
'
;
import
placeholderSystemNote
from
'
./issue_placeholder_system_note.vue
'
;
import
placeholderSystemNote
from
'
./issue_placeholder_system_note.vue
'
;
import
'
../../autosave
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -107,6 +108,19 @@
...
@@ -107,6 +108,19 @@
})
})
.
catch
(()
=>
Flash
(
'
Something went wrong while adding your reply. Please try again.
'
));
.
catch
(()
=>
Flash
(
'
Something went wrong while adding your reply. Please try again.
'
));
},
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]);
},
},
mounted
()
{
if
(
this
.
isReplying
)
{
this
.
initAutoSave
();
}
},
updated
()
{
if
(
this
.
isReplying
)
{
this
.
initAutoSave
();
}
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/notes/components/issue_note.vue
浏览文件 @
9e4164d4
...
@@ -39,7 +39,6 @@
...
@@ -39,7 +39,6 @@
return
{
return
{
'
is-editing
'
:
this
.
isEditing
,
'
is-editing
'
:
this
.
isEditing
,
'
disabled-content
'
:
this
.
isDeleting
,
'
disabled-content
'
:
this
.
isDeleting
,
//'js-my-note': this.author.id === this.currentUserId,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
};
};
},
},
...
...
app/assets/javascripts/notes/components/issue_note_body.vue
浏览文件 @
9e4164d4
<
script
>
<
script
>
/* global Autosave */
import
issueNoteEditedText
from
'
./issue_note_edited_text.vue
'
;
import
issueNoteEditedText
from
'
./issue_note_edited_text.vue
'
;
import
issueNoteAwardsList
from
'
./issue_note_awards_list.vue
'
;
import
issueNoteAwardsList
from
'
./issue_note_awards_list.vue
'
;
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
TaskList
from
'
../../task_list
'
;
import
TaskList
from
'
../../task_list
'
;
import
'
../../autosave
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -49,13 +51,22 @@
...
@@ -49,13 +51,22 @@
formCancelHandler
(
shouldConfirm
,
isDirty
)
{
formCancelHandler
(
shouldConfirm
,
isDirty
)
{
this
.
$emit
(
'
cancelFormEdition
'
,
shouldConfirm
,
isDirty
);
this
.
$emit
(
'
cancelFormEdition
'
,
shouldConfirm
,
isDirty
);
},
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]);
},
},
},
mounted
()
{
mounted
()
{
this
.
renderGFM
();
this
.
renderGFM
();
this
.
initTaskList
();
this
.
initTaskList
();
if
(
this
.
isEditing
)
{
this
.
initAutoSave
();
}
},
},
updated
()
{
updated
()
{
this
.
initTaskList
();
this
.
initTaskList
();
if
(
this
.
isEditing
)
{
this
.
initAutoSave
();
}
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/notes/components/issue_notes_app.vue
浏览文件 @
9e4164d4
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
{
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
store
from
'
../stores/
'
;
import
store
from
'
../stores/
'
;
import
*
as
constants
from
'
../constants
'
;
import
*
as
constants
from
'
../constants
'
;
import
eventHub
from
'
../event_hub
'
;
import
issueNote
from
'
./issue_note.vue
'
;
import
issueNote
from
'
./issue_note.vue
'
;
import
issueDiscussion
from
'
./issue_discussion.vue
'
;
import
issueDiscussion
from
'
./issue_discussion.vue
'
;
import
issueSystemNote
from
'
./issue_system_note.vue
'
;
import
issueSystemNote
from
'
./issue_system_note.vue
'
;
...
@@ -96,17 +95,6 @@
...
@@ -96,17 +95,6 @@
this
.
poll
();
this
.
poll
();
},
},
bindEventHubListeners
()
{
this
.
$el
.
parentElement
.
addEventListener
(
'
toggleAward
'
,
(
event
)
=>
{
const
{
awardName
,
noteId
}
=
event
.
detail
;
this
.
actionToggleAward
({
awardName
,
noteId
});
});
// JQuery is needed here because it is a custom event being dispatched with jQuery.
$
(
document
).
on
(
'
issuable:change
'
,
(
e
,
isClosed
)
=>
{
eventHub
.
$emit
(
'
issueStateChanged
'
,
isClosed
);
});
},
checkLocationHash
()
{
checkLocationHash
()
{
const
hash
=
gl
.
utils
.
getLocationHash
();
const
hash
=
gl
.
utils
.
getLocationHash
();
const
$el
=
$
(
`#
${
hash
}
`
);
const
$el
=
$
(
`#
${
hash
}
`
);
...
@@ -125,7 +113,11 @@
...
@@ -125,7 +113,11 @@
mounted
()
{
mounted
()
{
this
.
fetchNotes
();
this
.
fetchNotes
();
this
.
initPolling
();
this
.
initPolling
();
this
.
bindEventHubListeners
();
this
.
$el
.
parentElement
.
addEventListener
(
'
toggleAward
'
,
(
event
)
=>
{
const
{
awardName
,
noteId
}
=
event
.
detail
;
this
.
actionToggleAward
({
awardName
,
noteId
});
});
},
},
};
};
</
script
>
</
script
>
...
...
app/controllers/concerns/notes_actions.rb
浏览文件 @
9e4164d4
...
@@ -179,7 +179,7 @@ module NotesActions
...
@@ -179,7 +179,7 @@ module NotesActions
def
set_polling_interval_header
def
set_polling_interval_header
return
unless
noteable
.
is_a?
(
Issue
)
return
unless
noteable
.
is_a?
(
Issue
)
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3
_000
)
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
6
_000
)
end
end
def
noteable
def
noteable
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录