mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:30:23 -06:00
Allow users to reply as new to closed topics using quote functionality
Previously, only users who could reply to a topic could use the quote button. Now, if a user has the ability to reply as a new topic, that operation will be used if the user selects text in a topic they can't reply to.
This commit is contained in:
parent
e3eaa7fa75
commit
298098745e
@ -13,16 +13,14 @@ export default DiscourseController.extend({
|
||||
if (this.blank('buffer')) this.set('post', null);
|
||||
}.observes('buffer'),
|
||||
|
||||
/**
|
||||
Save the currently selected text and displays the
|
||||
"quote reply" button
|
||||
**/
|
||||
// Save the currently selected text and displays the
|
||||
// "quote reply" button
|
||||
selectText(postId) {
|
||||
// anonymous users cannot "quote-reply"
|
||||
if (!Discourse.User.current()) return;
|
||||
if (!this.currentUser) return;
|
||||
|
||||
// don't display the "quote-reply" button if we can't create a post
|
||||
if (!this.get('controllers.topic.model.details.can_create_post')) return;
|
||||
// don't display the "quote-reply" button if we can't at least reply as a new topic
|
||||
if (!this.get('controllers.topic.model.details.can_reply_as_new_topic')) return;
|
||||
|
||||
const selection = window.getSelection();
|
||||
// no selections
|
||||
@ -85,7 +83,15 @@ export default DiscourseController.extend({
|
||||
},
|
||||
|
||||
quoteText() {
|
||||
|
||||
const post = this.get('post');
|
||||
|
||||
// If we can't create a post, delegate to reply as new topic
|
||||
if (!this.get('controllers.topic.model.details.can_create_post')) {
|
||||
this.get('controllers.topic').send('replyAsNewTopic', post);
|
||||
return;
|
||||
}
|
||||
|
||||
const composerController = this.get('controllers.composer');
|
||||
const composerOpts = {
|
||||
action: Discourse.Composer.REPLY,
|
||||
|
Loading…
Reference in New Issue
Block a user