Skip to content
Extraits de code Groupes Projets
Valider 63040bb8 rédigé par Steffen van Bergerem's avatar Steffen van Bergerem
Parcourir les fichiers

fix mentions at the end of a post

parent 477c9d2e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -138,6 +138,7 @@ everything is set up.
* 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)
* 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
......
......@@ -71,6 +71,9 @@ app.views.Publisher = Backbone.View.extend(_.extend(
createStatusMessage : function(evt) {
if(evt){ evt.preventDefault(); }
//add missing mentions at end of post:
this.handleTextchange();
var serializedForm = $(evt.target).closest("form").serializeObject();
// lulz this code should be killed.
......@@ -128,6 +131,9 @@ app.views.Publisher = Backbone.View.extend(_.extend(
createPostPreview : function(evt) {
if(evt){ evt.preventDefault(); }
//add missing mentions at end of post:
this.handleTextchange();
var serializedForm = $(evt.target).closest("form").serializeObject();
var photos = new Array();
......
......@@ -15,3 +15,22 @@ Feature: Mentions
And I am on the home page
And I follow "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
alice = User.find_by_email 'alice@alice.alice'
fill_in 'status_message_fake_text', :with => "@{Alice Smith ; #{alice.person.diaspora_handle}}"
end
\ No newline at end of file
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);
})
});
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(){
it("should submit the form when shift+enter is pressed", function(){
this.view.render();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter