mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
FIX: brings back [+ New Topic] btn from share-popup post action (#7182)
This commit is contained in:
parent
126c25a84b
commit
de6a7e32bd
@ -154,6 +154,14 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
actions: {
|
||||
replyAsNewTopic() {
|
||||
const postStream = this.get("topic.postStream");
|
||||
const postId = this.postId || postStream.findPostIdForPostNumber(1);
|
||||
const post = postStream.findLoadedPost(postId);
|
||||
this.replyAsNewTopic(post);
|
||||
this.send("close");
|
||||
},
|
||||
|
||||
close() {
|
||||
this.setProperties({
|
||||
link: null,
|
||||
|
@ -12,11 +12,29 @@
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
{{#each sources as |s|}}
|
||||
{{share-source source=s title=model.title action=(action "share")}}
|
||||
{{/each}}
|
||||
<div class="sources">
|
||||
{{#each sources as |s|}}
|
||||
{{share-source source=s title=model.title action=(action "share")}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
<div class="alt-actions">
|
||||
{{#if topic.details.can_reply_as_new_topic}}
|
||||
<div class="reply-as-new-topic">
|
||||
{{#if topic.isPrivateMessage}}
|
||||
<a href class="new-topic" {{action "replyAsNewTopic"}} aria-label={{i18n "post.reply_as_new_private_message"}} title={{i18n "post.reply_as_new_private_message"}}>
|
||||
{{d-icon "plus"}}
|
||||
{{i18n "user.new_private_message"}}
|
||||
</a>
|
||||
{{else}}
|
||||
<a href class="new-topic" {{action "replyAsNewTopic"}} aria-label={{i18n "post.reply_as_new_topic"}} title={{i18n "post.reply_as_new_topic"}}>
|
||||
{{d-icon "plus"}}
|
||||
{{i18n "topic.create"}}
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="link">
|
||||
<a href {{action "close"}} class="close-share" aria-label={{i18n "share.close"}} title={{i18n "share.close"}}>
|
||||
{{d-icon "times"}}
|
||||
</a>
|
||||
|
@ -318,7 +318,7 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{share-popup topic=model}}
|
||||
{{share-popup topic=model replyAsNewTopic=(action "replyAsNewTopic")}}
|
||||
|
||||
{{#if embedQuoteButton}}
|
||||
{{quote-button quoteState=quoteState selectText=(action "selectText")}}
|
||||
|
@ -63,12 +63,6 @@
|
||||
color: dark-light-choose($twitter, white);
|
||||
}
|
||||
}
|
||||
.link {
|
||||
font-size: $font-up-3;
|
||||
a {
|
||||
color: dark-light-choose($primary-medium, $secondary-medium);
|
||||
}
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
font-size: $font-up-1;
|
||||
@ -77,11 +71,36 @@
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-end;
|
||||
margin-top: s(2);
|
||||
|
||||
.link {
|
||||
margin-left: auto;
|
||||
.sources {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
max-width: 45%;
|
||||
|
||||
.social-link {
|
||||
margin-right: s(2);
|
||||
}
|
||||
}
|
||||
|
||||
.alt-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: flex-end;
|
||||
height: 36px;
|
||||
|
||||
.close-share {
|
||||
font-size: $font-up-3;
|
||||
color: dark-light-choose($primary-medium, $secondary-medium);
|
||||
}
|
||||
|
||||
.new-topic {
|
||||
margin-right: s(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,69 @@ acceptance("Topic", {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("Reply as new topic", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("button.share:eq(0)");
|
||||
await click(".reply-as-new-topic a");
|
||||
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
`Continuing the discussion from [Internationalization / localization](${
|
||||
window.location.origin
|
||||
}/t/internationalization-localization/280):`,
|
||||
"it fills composer with the ring string"
|
||||
);
|
||||
assert.equal(
|
||||
selectKit(".category-chooser")
|
||||
.header()
|
||||
.value(),
|
||||
"2",
|
||||
"it fills category selector with the right category"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Reply as new message", async assert => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
await click("button.share:eq(0)");
|
||||
await click(".reply-as-new-topic a");
|
||||
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
`Continuing the discussion from [PM for testing](${
|
||||
window.location.origin
|
||||
}/t/pm-for-testing/12):`,
|
||||
"it fills composer with the ring string"
|
||||
);
|
||||
|
||||
const targets = find(".item span", ".composer-fields");
|
||||
|
||||
assert.equal(
|
||||
$(targets[0]).text(),
|
||||
"someguy",
|
||||
"it fills up the composer with the right user to start the PM to"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
$(targets[1]).text(),
|
||||
"test",
|
||||
"it fills up the composer with the right user to start the PM to"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
$(targets[2]).text(),
|
||||
"Group",
|
||||
"it fills up the composer with the right group to start the PM to"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Share Modal", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:first-child button.share");
|
||||
|
Loading…
Reference in New Issue
Block a user