Skip to content
Merged
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
1 change: 1 addition & 0 deletions news/+icon.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use icon class name @erral
2 changes: 1 addition & 1 deletion src/plone/app/discussion/profiles/default/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
i18n:translate=""
/>
<property name="url_expr">string:${globals_view/navigationRootUrl}/@@moderate-comments</property>
<property name="icon_expr">string:${globals_view/navigationRootUrl}/discussionitem_icon.png</property>
<property name="icon_expr">string:chat</property>
<property name="available_expr">portal/@@moderate-comments-enabled|nothing</property>
<property name="permissions">
<element value="Review comments" />
Expand Down
2 changes: 1 addition & 1 deletion src/plone/app/discussion/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>3000</version>
<version>3001</version>
<dependencies>
<dependency>profile-plone.resource:default</dependency>
<dependency>profile-plone.app.registry:default</dependency>
Expand Down
30 changes: 30 additions & 0 deletions src/plone/app/discussion/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,33 @@ def set_timezone_on_dates(context):
def set_discussion_behavior(context):
"""Add the discussion behavior to all default types, if they exist."""
add_discussion_behavior_to_default_types(context)


def manage_comments_icon(context):
"""if plone.app.discussion is installed, set the manage-comments action icon
expression from its default to the bootstrap based new-style icons
"""

portal_actions = getToolByName(context, "portal_actions")
user_actions = getattr(portal_actions, "user", None)
if user_actions is None:
logger.info("There are no user actions. Nothing is done.")
return

review_comments_action = getattr(user_actions, "review-comments", None)
if review_comments_action is None:
logger.info("There is no manage comments action. Nothing is done.")
return

# Check whether the action keeps its original state
if (
review_comments_action.icon_expr
!= "string:${globals_view/navigationRootUrl}/discussionitem_icon.png"
):
logger.info(
"Manage comments action icon was modified by the user. Nothing is done."
)
return

review_comments_action.icon_expr = "string:chat"
logger.info("Manage comments action icon modified")
14 changes: 14 additions & 0 deletions src/plone/app/discussion/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,18 @@
/>
</genericsetup:upgradeSteps>


<genericsetup:upgradeSteps
profile="plone.app.discussion:default"
source="3000"
destination="3001"
>

<genericsetup:upgradeStep
title="Use Bootstrap style icon for discussion moderation action."
handler=".upgrades.manage_comments_icon"
/>

</genericsetup:upgradeSteps>

</configure>