Permalink
Browse files

feature(discussions): discussions feature has been moved to its own p…

…lugin

BREAKING CHANGE:
Discussion feature has been pulled from the groups plugin into its
own independent plugin.

The following views are not available anymore:
 - object/groupforumtopic
 - river/object/groupforumtopic/create

Also the [object, groupforumtopic] subtype has been replaced
with the [object, discussion] subtype.

Nothing changes from the group owners' point of view. The discussions
feature is still available as a group tool and all old discussions
are intact.

Fixes: #5994
  • Loading branch information...
juho-jaakkola committed Jun 24, 2015
1 parent 13afe2e commit a4e484e62db117531763c0487c4b04c098bfb909
Showing with 856 additions and 821 deletions.
  1. +1 −0 .gitignore
  2. +14 −0 docs/guides/upgrading.rst
  3. +6 −5 engine/classes/ElggPluginManifest.php
  4. +38 −0 engine/lib/upgrades/2015062900-1.11.2-discussion_plugin-e28c7afa4f5f24ec.php
  5. +0 −4 mod/aalborg_theme/views/default/groups/css.php
  6. +1 −2 mod/{groups → discussions}/actions/discussion/delete.php
  7. 0 mod/{groups → discussions}/actions/discussion/reply/delete.php
  8. +10 −10 mod/{groups → discussions}/actions/discussion/reply/save.php
  9. +6 −4 mod/{groups → discussions}/actions/discussion/save.php
  10. 0 mod/{groups → discussions}/activate.php
  11. +2 −2 mod/{groups → discussions}/classes/ElggDiscussionReply.php
  12. +8 −0 mod/discussions/composer.json
  13. 0 mod/{groups → discussions}/deactivate.php
  14. +100 −0 mod/discussions/languages/en.php
  15. 0 mod/{groups → discussions}/lib/discussion.php
  16. +19 −0 mod/discussions/manifest.xml
  17. +579 −0 mod/discussions/start.php
  18. +0 −2 mod/{groups → discussions}/views/default/ajax/discussion/reply/edit.php
  19. +8 −0 mod/discussions/views/default/discussion/closed.php
  20. 0 mod/{groups → discussions}/views/default/discussion/discussion.js
  21. +2 −2 mod/{groups → discussions}/views/default/discussion/group_module.php
  22. 0 mod/{groups → discussions}/views/default/discussion/replies.php
  23. 0 mod/{groups → discussions}/views/default/forms/discussion/reply/save.php
  24. +11 −5 mod/{groups → discussions}/views/default/forms/discussion/save.php
  25. +4 −6 ...roups/views/default/object/groupforumtopic.php → discussions/views/default/object/discussion.php}
  26. +0 −2 mod/{groups → discussions}/views/default/object/discussion_reply.php
  27. +6 −10 mod/{groups → discussions}/views/default/resources/discussion/add.php
  28. +3 −1 mod/{groups → discussions}/views/default/resources/discussion/all.php
  29. +4 −8 mod/{groups → discussions}/views/default/resources/discussion/edit.php
  30. +3 −3 mod/{groups → discussions}/views/default/resources/discussion/owner.php
  31. +1 −1 mod/{groups → discussions}/views/default/resources/discussion/reply/edit.php
  32. +10 −10 mod/{groups → discussions}/views/default/resources/discussion/view.php
  33. 0 ...groups/views/default/river → discussions/views/default/resources}/elements/discussion_replies.php
  34. +1 −1 ...ault/river/object/groupforumtopic → discussions/views/default/river/object/discussion}/create.php
  35. +2 −2 mod/{groups → discussions}/views/default/river/object/discussion_reply/create.php
  36. +2 −2 mod/{groups → discussions}/views/default/search/object/discussion_reply/entity.php
  37. 0 mod/{groups → discussions}/views/rss/discussion/replies.php
  38. +0 −102 mod/groups/languages/en.php
  39. +1 −598 mod/groups/start.php
  40. +0 −20 mod/groups/topicposts.php
  41. +0 −8 mod/groups/views/default/discussion/closed.php
  42. +2 −6 mod/groups/views/default/groups/css.php
  43. +6 −3 mod/groups/views/default/groups/group_sort_menu.php
  44. +5 −1 mod/groups/views/default/resources/groups/all.php
  45. +1 −1 version.php
View
@@ -19,6 +19,7 @@ vendor
!/mod/dashboard/
!/mod/developers/
!/mod/diagnostics/
+!/mod/discussions/
!/mod/embed/
!/mod/externalpages/
!/mod/file/
View
@@ -131,12 +131,14 @@ We dropped support for and/or removed the following views:
* navigation/topbar_tools
* navigation/viewtype
* notifications/subscriptions/groupsform
+ * object/groupforumtopic
* output/calendar (Use output/date instead)
* output/confirmlink (Use output/url instead)
* page_elements/contentwrapper
* page/elements/shortcut_icon (Use the 'head', 'page' plugin hook instead)
* page/elements/wrapper
* profile/icon (Use ``elgg_get_entity_icon``)
+ * river/object/groupforumtopic/create
* settings/{plugin}/edit (Use plugins/{plugin}/settings instead)
* user/search/finishblurb
* user/search/startblurb
@@ -231,6 +233,18 @@ Creating a relationship triggers only one event
Entity relationship creation no longer fires the legacy "create" event using the relationship name as the type. E.g. Listening for the ``"create", "member"`` event will no longer capture group membership additions. Use the ``"create", "relationship"`` event.
+Discussion feature has been pulled from groups into its own plugin
+-------------------------------------------------------------------
+
+The ``object, groupforumtopic`` subtype has been replaced with the
+``object, discussion`` subtype. If your plugin is using or altering
+the old discussion feature, you should upgrade it to use the new
+subtype.
+
+Nothing changes from the group owners' point of view. The discussion
+feature is still available as a group tool and all old discussions
+are intact.
+
Dropped login-over-https feature
--------------------------------
@@ -57,7 +57,7 @@ class ElggPluginManifest {
'version' => '',
'comparison' => 'ge'
);
-
+
/**
* The expected structure of a requires php_version dependency element
*/
@@ -113,7 +113,7 @@ class ElggPluginManifest {
'description' => '',
'path' => ''
);
-
+
/**
* The expected structure of a contributor element
*/
@@ -391,6 +391,7 @@ public function getCategories() {
'dashboard',
'developers',
'diagnostics',
+ 'discussions',
'embed',
'externalpages',
'file',
@@ -452,7 +453,7 @@ public function getScreenshots() {
return $normalized;
}
-
+
/**
* Return the contributors listed.
*
@@ -514,7 +515,7 @@ public function getProvides() {
*/
public function getRequires() {
$reqs = $this->parser->getAttribute('requires');
-
+
if (!$reqs) {
$reqs = array();
}
@@ -571,7 +572,7 @@ private function normalizeDep($dep) {
case 'php_version':
$struct = $this->depsStructPhpVersion;
break;
-
+
case 'php_extension':
$struct = $this->depsStructPhpExtension;
break;
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Elgg 1.11.2 upgrade 2015062900
+ * discussion_plugin
+ *
+ * Discussion feature was pulled from groups plugin into its
+ * own plugin, so we need to update references of subtype
+ * 'groupforumtopic' into 'discussion'.
+ */
+
+$dbprefix = elgg_get_config('dbprefix');
+
+// Update subtype "groupforumtopic" into "discussion"
+update_data("UPDATE {$dbprefix}entity_subtypes
+ SET subtype = 'discussion'
+ WHERE type = 'object' AND subtype = 'groupforumtopic'");
+
+// Update river items to use the new view and subtype
+update_data("UPDATE {$dbprefix}river
+ SET view = 'river/object/discussion/create', subtype = 'discussion'
+ WHERE type = 'object' AND subtype = 'groupforumtopic'");
+
+// Update system log to use the new subtype
+update_data("UPDATE {$dbprefix}system_log
+ SET object_subtype = 'discussion'
+ WHERE object_type = 'object' AND object_subtype = 'groupforumtopic'");
+
+// If groups plugin is enabled, enable also the discussion plugin
+// so the feature won't disappear from groups that are using it.
+if (elgg_is_active_plugin('groups')) {
+ // Force Elgg to discover the new plugin in plugins directory
+ // and create a new \ElggPlugin entity for it so it can be
+ // found with elgg_get_plugin_from_id().
+ _elgg_generate_plugin_entities();
+
+ $plugin = elgg_get_plugin_from_id('discussion');
+ $plugin->activate();
+}
@@ -45,10 +45,6 @@
font-size: 85%;
}
-.groups-latest-reply {
- float: right;
-}
-
.elgg-menu-groups-my-status li a {
color: #444;
display: block;
@@ -1,13 +1,12 @@
<?php
/**
* Delete topic action
- *
*/
$topic_guid = (int) get_input('guid');
$topic = get_entity($topic_guid);
-if (!elgg_instanceof($topic, 'object', 'groupforumtopic')) {
+if (!elgg_instanceof($topic, 'object', 'discussion')) {
register_error(elgg_echo('discussion:error:notdeleted'));
forward(REFERER);
}
@@ -10,19 +10,19 @@
// reply cannot be empty
if (empty($text)) {
- register_error(elgg_echo('grouppost:nopost'));
+ register_error(elgg_echo('discussion:reply:missing'));
forward(REFERER);
}
if ($topic_guid) {
$topic = get_entity($topic_guid);
- if (!elgg_instanceof($topic, 'object', 'groupforumtopic')) {
- register_error(elgg_echo('grouppost:nopost'));
+ if (!elgg_instanceof($topic, 'object', 'discussion')) {
+ register_error(elgg_echo('discussion:reply:topic_not_found'));
forward(REFERER);
}
- $group = $topic->getContainerEntity();
- if (!$group->canWriteToContainer()) {
+ $container = $topic->getContainerEntity();
+ if (elgg_instanceof($container, 'group') && !$container->canWriteToContainer()) {
register_error(elgg_echo('groups:notmember'));
forward(REFERER);
}
@@ -38,16 +38,16 @@
}
if (!$reply->canEdit()) {
- register_error(elgg_echo('groups:notowner'));
+ register_error(elgg_echo('discussion:reply:error:cannot_edit'));
forward(REFERER);
}
$reply->description = $text;
if ($reply->save()) {
- system_message(elgg_echo('groups:forumpost:edited'));
+ system_message(elgg_echo('discussion:reply:edited'));
} else {
- register_error(elgg_echo('groups:forumpost:error'));
+ register_error(elgg_echo('discussion:reply:error'));
}
} else {
// add the reply to the forum topic
@@ -60,7 +60,7 @@
$reply_guid = $reply->save();
if ($reply_guid == false) {
- register_error(elgg_echo('groupspost:failure'));
+ register_error(elgg_echo('discussion:post:failure'));
forward(REFERER);
}
@@ -72,7 +72,7 @@
'target_guid' => $topic->guid,
));
- system_message(elgg_echo('groupspost:success'));
+ system_message(elgg_echo('discussion:post:success'));
}
forward(REFERER);
@@ -21,7 +21,7 @@
}
$container = get_entity($container_guid);
-if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) {
+if (!$container || !$container->canWriteToContainer(0, 'object', 'discussion')) {
register_error(elgg_echo('discussion:error:permissions'));
forward(REFERER);
}
@@ -34,11 +34,11 @@
if ($new_topic) {
$topic = new ElggObject();
- $topic->subtype = 'groupforumtopic';
+ $topic->subtype = 'discussion';
} else {
// load original file object
$topic = get_entity($guid);
- if (!elgg_instanceof($topic, 'object', 'groupforumtopic') || !$topic->canEdit()) {
+ if (!elgg_instanceof($topic, 'object', 'discussion') || !$topic->canEdit()) {
register_error(elgg_echo('discussion:topic:notfound'));
forward(REFERER);
}
@@ -66,11 +66,13 @@
// handle results differently for new topics and topic edits
if ($new_topic) {
system_message(elgg_echo('discussion:topic:created'));
+
elgg_create_river_item(array(
- 'view' => 'river/object/groupforumtopic/create',
+ 'view' => 'river/object/discussion/create',
'action_type' => 'create',
'subject_guid' => elgg_get_logged_in_user_guid(),
'object_guid' => $topic->guid,
+ 'target_guid' => $container_guid,
));
} else {
system_message(elgg_echo('discussion:topic:updated'));
File renamed without changes.
@@ -1,7 +1,7 @@
<?php
/**
- * Class for group discussion reply
- *
+ * Class for discussion reply
+ *
* We extend ElggComment to get the future thread support.
*/
class ElggDiscussionReply extends ElggComment {
@@ -0,0 +1,8 @@
+{
+ "name": "elgg/discussions",
+ "type": "elgg-plugin",
+ "license": "GPL-2.0",
+ "require": {
+ "composer/installers": ">=1.0.8"
+ }
+}
File renamed without changes.
@@ -0,0 +1,100 @@
+<?php
+
+return array(
+ 'discussion' => 'Discussion',
+ 'discussion:add' => 'Add discussion topic',
+ 'discussion:latest' => 'Latest discussion',
+ 'discussion:group' => 'Group discussion',
+ 'discussion:none' => 'No discussion',
+ 'discussion:reply:title' => 'Reply by %s',
+ 'discussion:new' => "Add discussion post",
+ 'discussion:updated' => "Last reply by %s %s",
+
+ 'discussion:topic:created' => 'The discussion topic was created.',
+ 'discussion:topic:updated' => 'The discussion topic was updated.',
+ 'discussion:topic:deleted' => 'Discussion topic has been deleted.',
+
+ 'discussion:topic:notfound' => 'Discussion topic not found',
+ 'discussion:error:notsaved' => 'Unable to save this topic',
+ 'discussion:error:missing' => 'Both title and message are required fields',
+ 'discussion:error:permissions' => 'You do not have permissions to perform this action',
+ 'discussion:error:notdeleted' => 'Could not delete the discussion topic',
+
+ 'discussion:reply:edit' => 'Edit reply',
+ 'discussion:reply:deleted' => 'Discussion reply has been deleted.',
+ 'discussion:reply:error:notfound' => 'The discussion reply was not found',
+ 'discussion:reply:error:notfound_fallback' => "Sorry, we could not find the specified reply, but we've forwarded you to the original discussion topic.",
+ 'discussion:reply:error:notdeleted' => 'Could not delete the discussion reply',
+
+ 'discussion:search:title' => 'Reply on topic: %s',
+
+ /**
+ * Action messages
+ */
+ 'discussion:reply:missing' => 'You cannot post an empty reply',
+ 'discussion:reply:topic_not_found' => 'The discussion topic was not found',
+ 'discussion:reply:error:cannot_edit' => 'You do not have the permission to edit this reply',
+
+ /**
+ * River
+ */
+ 'river:create:object:discussion' => '%s added a new discussion topic %s',
+ 'river:reply:object:discussion' => '%s replied on the discussion topic %s',
+ 'river:reply:view' => 'view reply',
+
+ /**
+ * Notifications
+ */
+ 'discussion:topic:notify:summary' => 'New discussion topic called %s',
+ 'discussion:topic:notify:subject' => 'New discussion topic: %s',
+ 'discussion:topic:notify:body' =>
+'%s added a new discussion topic to %s:
+
+Title: %s
+
+%s
+
+View and reply to the discussion topic:
+%s
+',
+
+ 'discussion:reply:notify:summary' => 'New reply in topic: %s',
+ 'discussion:reply:notify:subject' => 'New reply in topic: %s',
+ 'discussion:reply:notify:body' =>
+'%s replied to the discussion topic %s:
+
+%s
+
+View and reply to the discussion:
+%s
+',
+
+ 'item:object:discussion' => "Discussion topics",
+ 'item:object:discussion_reply' => "Discussion replies",
+
+ 'groups:enableforum' => 'Enable group discussion',
+
+ 'reply:this' => 'Reply to this',
+
+ /**
+ * ecml
+ */
+ 'discussion:ecml:discussion' => 'Group Discussions',
+
+ /**
+ * Discussion status
+ */
+ 'discussion:topic:status' => 'Topic status',
+ 'discussion:topic:closed:title' => 'This discussion is closed.',
+ 'discussion:topic:closed:desc' => 'This discussion is closed and is not accepting new comments.',
+
+ 'discussion:replies' => 'Replies',
+ 'discussion:addtopic' => 'Add a topic',
+ 'discussion:post:success' => 'Your reply was succesfully posted',
+ 'discussion:post:failure' => 'There was problem while posting your reply',
+ 'discussion:topic:edit' => 'Edit topic',
+ 'discussion:topic:description' => 'Topic message',
+
+ 'discussion:reply:edited' => "You have successfully edited the forum post.",
+ 'discussion:reply:error' => "There was a problem editing the forum post.",
+);
File renamed without changes.
Oops, something went wrong.

0 comments on commit a4e484e

Please sign in to comment.