Added a JS notification if the aspect the user posted to is not visible

This commit is contained in:
Manuel Schölling 2011-07-27 20:48:58 +02:00
parent fead6032f7
commit d9484e3dd5

View file

@ -315,6 +315,12 @@ var Publisher = {
'<input id="services_" name="services[]" type="hidden" value="'+provider+'">');
}
},
selectedAspectIds: function() {
var aspects = $('#publisher [name="aspect_ids[]"]');
var aspectIds = [];
aspects.each(function() { aspectIds.push( parseInt($(this).attr('value'))); });
return aspectIds;
},
toggleAspectIds: function(aspectId) {
var hidden_field = $('#publisher [name="aspect_ids[]"][value="'+aspectId+'"]');
if(hidden_field.length > 0){
@ -338,7 +344,6 @@ var Publisher = {
$('#status_message_fake_text').charCount({allowed: min, warning: min/10 });
}
},
bindAspectToggles: function() {
$('#publisher .dropdown .dropdown_list li').bind("click", function(evt){
var li = $(this),
@ -371,7 +376,21 @@ var Publisher = {
}
},
onSuccess: function(data, json, xhr){
ContentUpdater.addPostToStream(json.html);
var isPostVisible = false;
var postedTo = Publisher.selectedAspectIds();
$.each(AspectFilters.selectedGUIDS, function(index, value){
if(postedTo.indexOf(parseInt(value))>-1)
isPostVisible = true;
});
if(isPostVisible)
ContentUpdater.addPostToStream(json.html);
else
Diaspora.widgets.flashes.render({
success: true,
message: Diaspora.widgets.i18n.t('successfully_posted_message_to_an_aspects_that_is_not_visible')
});
//collapse publisher
Publisher.close();
Publisher.clear();