Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Twitter user feed from content type options #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"license": "MIT",
"author": "Joubel",
"majorVersion": 1,
"minorVersion": 15,
"patchVersion": 2,
"minorVersion": 16,
"patchVersion": 0,
"runnable": 1,
"fullscreen": 0,
"embedTypes": [
Expand Down
36 changes: 35 additions & 1 deletion upgrades.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,42 @@ H5PUpgrades['H5P.Column'] = (function () {

// Done
finished(null, parameters);
}
},

/**
* Asynchronous content upgrade hook.
* Upgrades content parameters to support Column 1.14.
*
* - Converts H5P.TwitterUserFeed to H5P.AdvancedText
*
* @param {Object} parameters
* @param {function} finished
*/
16: function (parameters, finished, extras) {

if (parameters && parameters.content) {

debugger

// Go through content
for (var i = 0; i < parameters.content.length; i++) {
if (parameters.content[i] && parameters.content[i].content) {

const content = parameters.content[i].content;
if (content.library && content.library.split(' ')[0] === 'H5P.TwitterUserFeed') {

content.library = 'H5P.AdvancedText 1.1';

content.params = content.params || {};
content.params.text = '<p>Twitter changed their API and user feeds can no longer be displayed here.</p>';
}
}
}
}

// Done
finished(null, parameters, extras);
}
}
};
})();