fix mentions at the end of a post
This commit is contained in:
parent
477c9d2ef3
commit
63040bb8cc
5 changed files with 40 additions and 2 deletions
|
|
@ -138,6 +138,7 @@ everything is set up.
|
||||||
* Fix broken reactions link on mobile page [#4125](https://github.com/diaspora/diaspora/pull/4125)
|
* Fix broken reactions link on mobile page [#4125](https://github.com/diaspora/diaspora/pull/4125)
|
||||||
* Missing translation "Back to top". [#4138](https://github.com/diaspora/diaspora/pull/4138)
|
* Missing translation "Back to top". [#4138](https://github.com/diaspora/diaspora/pull/4138)
|
||||||
* Fix preview with locator feature. [#4147](https://github.com/diaspora/diaspora/pull/4147)
|
* Fix preview with locator feature. [#4147](https://github.com/diaspora/diaspora/pull/4147)
|
||||||
|
* Fix mentions at end of post. [#3746](https://github.com/diaspora/diaspora/issues/3746)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
createStatusMessage : function(evt) {
|
createStatusMessage : function(evt) {
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
||||||
|
//add missing mentions at end of post:
|
||||||
|
this.handleTextchange();
|
||||||
|
|
||||||
var serializedForm = $(evt.target).closest("form").serializeObject();
|
var serializedForm = $(evt.target).closest("form").serializeObject();
|
||||||
|
|
||||||
// lulz this code should be killed.
|
// lulz this code should be killed.
|
||||||
|
|
@ -128,6 +131,9 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
createPostPreview : function(evt) {
|
createPostPreview : function(evt) {
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
||||||
|
//add missing mentions at end of post:
|
||||||
|
this.handleTextchange();
|
||||||
|
|
||||||
var serializedForm = $(evt.target).closest("form").serializeObject();
|
var serializedForm = $(evt.target).closest("form").serializeObject();
|
||||||
|
|
||||||
var photos = new Array();
|
var photos = new Array();
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,22 @@ Feature: Mentions
|
||||||
And I am on the home page
|
And I am on the home page
|
||||||
And I follow "Bob Jones"
|
And I follow "Bob Jones"
|
||||||
Then I should see "Bob Jones"
|
Then I should see "Bob Jones"
|
||||||
|
|
||||||
|
Scenario: A user mentions another user at the end of a post
|
||||||
|
Given following users exist:
|
||||||
|
| username | email |
|
||||||
|
| Bob Jones | bob@bob.bob |
|
||||||
|
| Alice Smith | alice@alice.alice |
|
||||||
|
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||||
|
When I sign in as "alice@alice.alice"
|
||||||
|
And I am on the home page
|
||||||
|
And I expand the publisher
|
||||||
|
When I fill in the following:
|
||||||
|
| status_message_fake_text | @Bo |
|
||||||
|
And I click on the first user in the mentions dropdown list
|
||||||
|
And I press "Share"
|
||||||
|
And I wait for the ajax to finish
|
||||||
|
And I follow "Bob Jones"
|
||||||
|
Then I should see "Bob Jones"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,8 @@ end
|
||||||
And /^I mention Alice in the publisher$/ do
|
And /^I mention Alice in the publisher$/ do
|
||||||
alice = User.find_by_email 'alice@alice.alice'
|
alice = User.find_by_email 'alice@alice.alice'
|
||||||
fill_in 'status_message_fake_text', :with => "@{Alice Smith ; #{alice.person.diaspora_handle}}"
|
fill_in 'status_message_fake_text', :with => "@{Alice Smith ; #{alice.person.diaspora_handle}}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
And /^I click on the first user in the mentions dropdown list$/ do
|
||||||
|
find('.mentions-autocomplete-list li:first').click
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,15 @@ describe("app.views.Publisher", function() {
|
||||||
expect(this.view.$("input[name='photos[]']").length).toBe(0);
|
expect(this.view.$("input[name='photos[]']").length).toBe(0);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("createStatusMessage", function(){
|
||||||
|
it("calls handleTextchange to complete missing mentions", function(){
|
||||||
|
spyOn(this.view, "handleTextchange");
|
||||||
|
this.view.createStatusMessage($.Event());
|
||||||
|
expect(this.view.handleTextchange).toHaveBeenCalled();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
describe("publishing a post with keyboard", function(){
|
describe("publishing a post with keyboard", function(){
|
||||||
it("should submit the form when shift+enter is pressed", function(){
|
it("should submit the form when shift+enter is pressed", function(){
|
||||||
this.view.render();
|
this.view.render();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue