Multi MediaItems request failed.
--------------------------------
Key: SHINDIG-1161
URL: https://issues.apache.org/jira/browse/SHINDIG-1161
Project: Shindig
Issue Type: Bug
Components: Javascript
Affects Versions: 1.1-BETA1, 1.0
Environment: All browsers and both PHP and Java implementations.
Reporter: Yoichiro Tanaka
Fix For: 1.1-BETA2
Activity object can have some MediaItem objects as
opensocial.Activity.Field.MEDIA_ITEMS. You can create the MediaItem object
using opensocial.newMediaItem() function.
This function has three arguments:
mime_type, url, opt_params
The opt_params is Map.<opensocial.MediaItem.Field, Object>. Then, we write the
following code for posting activity which has two MediaItem objects:
var mp = {};
mp[opensocial.MediaItem.Field.TYPE] = opensocial.MediaItem.Type.IMAGE;
var mi1 = opensocial.newMediaItem("image/gif", "http://example.com/image1.gif",
mp);
var mi2 = opensocial.newMediaItem("image/gif", "http://example.com/image2.gif",
mp);
var data = {};
data[opensocial.Activity.Field.TITLE] = title;
data[opensocial.Activity.Field.BODY] = body;
data[opensocial.Activity.Field.MEDIA_ITEMS] = [mi1, mi2];
var activity = opensocial.newActivity(data);
opensocial.requestCreateActivity(activity, ...);
The result of this code is fail. Posted two images are both "image2.gif". I
think that a constructor of MediaItem class has mistake. Because the opt_params
argument is used as MediaItem.fields_ object. It is correct to be copied
properties of opt_params to fields_ object, I guess.
I attach a patch to fix this problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.