Open graph stories of action I do show up on my ticker but not on my friends' ticker - facebook-javascript-sdk

I created a canvas app and defined action, object and aggregation. When I publish an action using javascript sdk by doing -
FB.api('/me/namespace:action?object=object_url', 'post',
function (response) {
if (!response || response.error) {
//failure
} else {
//success
}
});
I get success and it shows up on my ticker and timeline but my friend is not able to see anything related to this activity neither on his ticker nor in the news feed. The visibility of activity in this app is set to friends but still nothing shows up in firends' accounts.

It was because I had delete 4 aggregations created automatically and created a single aggregation that I thought would only be required. I deleted this action and aggregation, created a new one from scratch and updated aggregations with action/object and it worked.

Related

Cannot create listitem via rest api in sharepoint2013 with contribute rights

I have an issue with our Travel Tool based on SharePoint 2013.
This tool consists of different Content Types - all in their specific lists (travel requests, train rides, flights, etc.). There are two main groups which are using this tool: Employees (contribute) and admin staff (full control).
On the homepage.aspx we have a ScriptEditorWebpart with a custom HomePageNewItem button and a ListView of the travel requests. When the user clicks on the custom button, a new ListItem is created via REST API and the EditForm.aspx of the currently created ListItem is displayed.
What is the problem?
This works just fine for the admin staff (full control). When employees try to create a ListItem, the following error message occurs: HRESULT: 0x80131904 (returning from the REST API). The same happens, when employees visit some of the lists. The ListView isn’t displayed, but there is the same error message.
Some additional information
The SQL database has enough storage on all partitions
When an employee uses the standard “New Item” Button, everything
works just fine (except of the ListView)
When an employee is moved to the admin staff group, everything
works just fine
All lists have correct permissions set
This worked one week before and there were no changes in the
code, only some customizations of sites e.g. homepage.aspx)
Additional hints
Could it has something to do with the Website Definition?
The function which creates the list item
function createListItem(listName, newItem, success) {
var itemType = getItemTypeForListName(listName);
newItem.__metadata = { "type": itemType }
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(newItem),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
success(data);
},
error: function (data) {
var errorMessage = JSON.parse(data.responseText).error.message.value;
var statusId;
statusId = SP.UI.Status.addStatus("Hoppla:", errorMessage);
SP.UI.Status.setStatusPriColor(statusId, "Blue");
setTimeout(function () { SP.UI.Status.removeStatus(statusId); },10000);
}
});
}
function getItemTypeForListName(name) {
return "SP.Data." + name.charAt(0).toUpperCase() + name.split(" ").join("").slice(1) + "ListItem";
}
Thanks in advance
Benjamin
Check the item count in the list. If there is more than 5000 items (aka. Threshold Limit) in the list, it is possible to receive similar errors using REST or it could be quite a range of possible problems You can try one of the following steps to know the exact cause:
Check ULS logs for more detailed error message.
Try to turn of throttling for the list. Use PowerShell to set property EnableThrottling for the SPList to $false.
Sometimes other throttling issues can appear. Try to increase throttling limits for the web application. like increase maximum number of lookup columns for the list. Go to Central Admin -> Web Applications -> Resource Throttling and increase throttling limits.
Remove some fields for testing. Try to play around removing some fields, especially lookups, user or date fields.
Change your REST query and take only one or few item from the list.
Try something like this:
"/_api/web/lists/getbytitle('" + listName + "')/items?$top=5"
or
"/_api/web/lists/getbytitle('" + listName + "')/items(1)",

How to use store.filter / store.find with Ember-Data to implement infinite scrolling?

This was originally posted on discuss.emberjs.com. See:
http://discuss.emberjs.com/t/what-is-the-proper-use-of-store-filter-store-find-for-infinite-scrolling/3798/2
but that site seems to get worse and worse as far as quality of content these days so I'm hoping StackOverflow can rescue me.
Intent: Build a page in ember with ember-data implementing infinite scrolling.
Background Knowledge: Based on the emberjs.com api docs on ember-data, specifically the store.filter and store.find methods ( see: http://emberjs.com/api/data/classes/DS.Store.html#method_filter ) I should be able to set the model hook of a route to the promise of a store filter operation. The response of the promise should be a filtered record array which is a an array of items from the store filtered by a filter function which is suppose to be constantly updated whenever new items are pushed into the store. By combining this with the store.find method which will push items into the store, the filteredRecordArray should automatically update with the new items thus updating the model and resulting in new items showing on the page.
For instance, assume we have a Questions Route, Controller and a model of type Question.
App.QuestionsRoute = Ember.Route.extend({
model: function (urlParams) {
return this.get('store').filter('question', function (q) {
return true;
});
}
});
Then we have a controller with some method that will call store.find, this could be triggered by some event/action whether it be detecting scroll events or the user explicitly clicking to load more, regardless this method would be called to load more questions.
Example:
App.QuestionsController = Ember.ArrayController.extend({
...
loadMore: function (offset) {
return this.get('store').find('question', { skip: currentOffset});
}
...
});
And the template to render the items:
...
{{#each question in controller}}
{{question.title}}
{{/each}}
...
Notice, that with this method we do NOT have to add a function to the store.find promise which explicitly calls this.get('model').pushObjects(questions); In fact, trying to do that once you have already returned a filter record array to the model does not work. Either we manage the content of the model manually, or we let ember-data do the work and I would very much like to let Ember-data do the work.
This is is a very clean API; however, it does not seem to work they way I've written it. Based on the documentation I cannot see anything wrong.
Using the Ember-Inspector tool from chrome I can see that the new questions from the second find call are loaded into the store under the 'question' type but the page does not refresh until I change routes and come back. It seems like the is simply a problem with observers, which made me think that this would be a bug in Ember-Data, but I didn't want to jump to conclusions like that until I asked to see if I'm using Ember-Data as intended.
If someone doesn't know exactly what is wrong but knows how to use store.push/pushMany to recreate this scenario in a jsbin that would also help too. I'm just not familiar with how to use the lower level methods on the store.
Help is much appreciated.
I just made this pattern work for myself, but in the "traditional" way, i.e. without using store.filter().
I managed the "loadMore" part in the router itself :
actions: {
loadMore: function () {
var model = this.controller.get('model'), route = this;
if (!this.get('loading')) {
this.set('loading', true);
this.store.find('question', {offset: model.get('length')}).then(function (records) {
model.addObjects(records);
route.set('loading', false);
});
}
}
}
Since you already tried the traditional way (from what I see in your post on discuss), it seems that the key part is to use addObjects() instead of pushObjects() as you did.
For the records, here is the relevant part of my view to trigger the loadMore action:
didInsertElement: function() {
var controller = this.get('controller');
$(window).on('scroll', function() {
if ($(window).scrollTop() > $(document).height() - ($(window).height()*2)) {
controller.send('loadMore');
}
});
},
willDestroyElement: function() {
$(window).off('scroll');
}
I am now looking to move the loading property to the controller so that I get a nice loader for the user.

EmberJS Route to 'single' getting JSONP

I'm having trouble with EmberJS to create a single view to posts based on the ID, but not the ID of the array, I actually have a ID that comes with the json I got from Tumblr API.
So the ID is something like '54930292'.
Next I try to use this ID to do another jsonp to get the post for this id, it works if you open the api and put the id, and actually if you open the single url with the ID on it, works too, the problem is:
When, on the front page for example, I click on a link to go to the single, it returns me nothing and raise a error.
But if you refresh the page you get the content.
Don't know how to fix and appreciate some help :(
I put online the code: http://tkrp.net/tumblr_test/
The error you were getting was because the SingleRoute was being generated as an ArrayController but the json response was not an Array.
App.SingleController = Ember.ObjectController.extend({
});
Further note that the model hook is not fired when using linkTo and other helpers. This because Ember assumes that if you linked to a model, the model is assumed to be as specified, and it directly calls setupController with that model. In your case, you need to still load the individual post. I added the setupController to the route to do this.
App.SingleRoute = Ember.Route.extend({
model: function(params) {
return App.TKRPTumblr.find(params.id);
},
setupController: function(controller, id) {
App.TKRPTumblr.find(id)
.then(function(data) {
controller.set('content', data.response);
});
}
});
I changed the single post template a bit to reflect how the json response. One final change I made was to directly return the $.ajax. Ember understands jQuery promises directly, so you don't need to do any parsing.
Here is the updated jsbin.
I modified: http://jsbin.com/okezum/6/edit
Did this to "fix" the refresh single page error:
setupController: function(controller, id) {
if(typeof id === 'object'){
controller.set('content', id.response);
}else{
App.TKRPTumblr.find(id)
.then(function(data) {
controller.set('content', data.response);
});
}
}
modified the setupController, since I was getting a object when refreshing the page and a number when clicking the linkTo
Dont know if it's the best way to do that :s

Sencha Touch 2: store sync is not working as expected

I am building an app related to order pickup. I have a list where order items are listed. The app has to send PUT request to Rest API in order to update the record when user tap on the list (specially on a button with in list item). My problem is if i tap a button within a list item, it sends multiple PUT requests but i think it should be only one request at a time.
My item tap function:
var store=Ext.data.StoreManager.lookup('storeOrderItem');
var index = store.findExact('orderitem_id', record.get('orderitem_id')),
orderItem = store.getAt(index);
//updating item store
orderItem.set('order_picker_id',NCAPP.app.loggedInUser.user_id);
if(NCAPP.app.currentWarehouse.is_main_store==0)
{
orderItem.set('pickup_status','picked#anotherlocation');
}
else
{
orderItem.set('pickup_status','picked');
}
store.setProxy({url:NCAPP.app.baseApiUrl+'/order/item/'+record.get('orderitem_id')});
orderItem.setDirty(true);
//updating with proxy (changes database)
store.sync();
When i monitor in google chrome debug screen, I see request has been sent for three times. (the store is loaded with three items). How can I avoid the three request and only one request per item tap? thanks
You have to confirm first that the itemtap() is called only once and then from there call a function in controller
Add the itemtap listener in the list as below.
listeners: {
itemtap: function(dataview, index, item, e) {
this.up('xtype').fireEvent('controllerfn');
}
}

client web - how to get current record id at any time

I'm trying to work on the "different permissions based on workflow state" issue but I'm struggling with the fact that it seems impossible to get the id of the current object 'at any time' that is necessary in order to get the permission of that object. What I mean is that I manage to get it from the client state following jquery bbq docs like:
$.bbq.getState().id
BUT it looks like this is doable only AFTER a complete page load. I investigated this by placing some alert in the main view events, like:
openerp.web.PageView = openerp.web.PageView.extend({
on_loaded: function(data) {
this._super(data);
alert('page load ' + $.bbq.getState().id);
},
do_show: function() {
this._super();
alert('page show ' + $.bbq.getState().id);
},
reload: function() {
this._super();
alert('page reload ' + $.bbq.getState().id);
},
on_record_loaded: function(record) {
this._super(record);
alert('record loaded ' + $.bbq.getState().id);
}
});
and I found that when you open the page view (by clicking on an item in a search view, for instance) you get always "undefined".
Then, you get it into "reload" and "on_record_loaded" when passing from an object to another using paged navigation. And then, you miss it again when you click on the "edit" button.
In the form view I successfully got it only on the 1st load because it seems that some caching is in-place. So that, if I place a pdb into web client's fields_view_get and I do this into the form "init_view":
var ids = [];
if ($.bbq.getState().id){
ids = [parseInt($.bbq.getState().id)];
}
console.log(ids);
return this.rpc("/web/view/load", {
"model": this.model,
"view_id": this.view_id,
"view_type": "form",
toolbar: this.options.sidebar,
context: context,
ids: ids,
}, this.on_loaded);
I get it only the 1st time that the page gets loaded. The same happen if I take ids from
this.dataset.ids
I looked anywhere at the core web module and I can't find a proper API for this and it looks weird (above all on dataset) that we don't have a proper way for getting/working on the current record/s. Even the context and the session do not have any information about that.
Probably I should store this into the view itself on 1st load...
Thanks in advance for any pointers.
try:
this.view.datarecord.id
OpenERP 7 in form view:
debugged using google chrome
Try the combination of the
this.dataset.ids and this.dataset.index
like
curr_id = this.dataset.ids[this.dataset.index]
this might solve your problem.