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

Fix post preview with location

parent 9d6ce5b1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -327,6 +327,17 @@ app.views.Publisher = Backbone.View.extend({
var mentionedPeople = this.getMentionedPeople(serializedForm);
var date = (new Date()).toISOString();
var poll = this.getPollData(serializedForm);
var locationCoords = serializedForm["location[coords]"];
if(!locationCoords || locationCoords === "") {
locationCoords = ["", ""];
} else {
locationCoords = locationCoords.split(",");
}
var location = {
"address": $("#location_address").val(),
"lat": locationCoords[0],
"lng": locationCoords[1]
};
var previewMessage = {
"id" : 0,
......@@ -340,7 +351,7 @@ app.views.Publisher = Backbone.View.extend({
"photos" : photos,
"frame_name" : "status",
"title" : serializedForm["status_message[text]"],
"address" : $("#location_address").val(),
"location" : location,
"interactions" : {"likes":[],"reshares":[],"comments_count":0,"likes_count":0,"reshares_count":0},
"poll": poll
};
......
......@@ -85,3 +85,17 @@ Feature: preview posts in the stream
Then I should see a ".poll_form" within ".stream_element"
And I should see a "form" within ".stream_element"
And I close the publisher
Scenario: preview a post with location
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | I am eating yogurt |
And I allow geolocation
And I click on selector "#locator"
When I fill in the following:
| status_message_fake_text | I am eating yogurt |
| location_address | Some cool place |
And I press "Preview"
Then I should see a ".near-from" within ".stream_element"
And I should see "Some cool place" within ".stream_element .near-from"
And I close the publisher
When /^I allow geolocation$/ do
page.execute_script <<-JS
navigator.geolocation.getCurrentPosition = function(success) {
success({coords: {latitude: 42.42424242, longitude: 3.14159}});
};
JS
end
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