Include the number of other reactions in the tooltip
authorAlexander Ebert <ebert@woltlab.com>
Sat, 17 Aug 2019 18:52:16 +0000 (20:52 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 17 Aug 2019 18:52:16 +0000 (20:52 +0200)
com.woltlab.wcf/templates/__topReaction.tpl
wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 5b59d4d134eb4c4d76dc2760f54bb03c9ef52be7..9c7e8bcce72d5d6496f6a4d0a6ed424aeaa9264f 100644 (file)
@@ -1,18 +1,16 @@
 {assign var='topReaction' value=$__wcf->getReactionHandler()->getTopReaction($cachedReactions)}
 {if $topReaction}
-       {if $render === 'icon'}
-               <span class="jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">{@$topReaction[reaction]->renderIcon()}</span>
-       {elseif $render === 'tiny'}
-               <span class="topReactionTiny jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+       {if $render === 'tiny'}
+               <span class="topReactionTiny jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count] other=$topReaction[other]}wcf.like.reaction.topReaction{/lang}">
                        {@$topReaction[reaction]->renderIcon()} {#$topReaction[count]}
                </span>
        {elseif $render === 'short'}
-               <span class="topReactionShort jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+               <span class="topReactionShort jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count] other=$topReaction[other]}wcf.like.reaction.topReaction{/lang}">
                        {@$topReaction[reaction]->renderIcon()} × {#$topReaction[count]}
                </span>
        {elseif $render === 'full'}
                <span class="topReactionFull">
-                       {@$topReaction[reaction]->renderIcon()} {lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}
+                       {@$topReaction[reaction]->renderIcon()} {lang reaction=$topReaction[reaction] count=$topReaction[count] other=$topReaction[other]}wcf.like.reaction.topReaction{/lang}
                </span>
        {/if}
 {/if}
index 8ca0638674566e9d604b142da7f6cd8b91a419b0..9092605e4a8029be9386ce77a0dc4044c7a8750a 100644 (file)
@@ -745,10 +745,14 @@ class ReactionHandler extends SingletonFactory {
                        $cachedReactions = @unserialize($cachedReactions);
                        
                        if (is_array($cachedReactions) && !empty($cachedReactions)) {
-                               asort($cachedReactions, SORT_NUMERIC);
+                               $allReactions = array_sum($cachedReactions);
                                
+                               arsort($cachedReactions, SORT_NUMERIC);
+                               
+                               $count = current($cachedReactions);
                                return [
-                                       'count' => current($cachedReactions),
+                                       'count' => $count,
+                                       'other' => $allReactions - $count,
                                        'reaction' => ReactionTypeCache::getInstance()->getReactionTypeByID(key($cachedReactions)),
                                ];
                        }
index 76979fceb22f41c4ff144d7ae21e578f46e684c8..45db8f9dfec167e8658d393ce18df0fbc15df87a 100644 (file)
@@ -3983,7 +3983,7 @@ Dateianhänge:
                <item name="wcf.like.reaction.label"><![CDATA[{#$reactions} Reaktion{if $reactions != 1}en{/if}]]></item>
                <item name="wcf.like.reaction.more"><![CDATA[Weitere Reaktionen]]></item>
                <item name="wcf.like.reaction.noMoreEntries"><![CDATA[Keine weiteren Reaktionen]]></item>
-               <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}]]></item>
+               <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}{if $other} und {if $other == 1}eine weitere Reaktion{else}{#$other} weitere Reaktionen{/if}{/if}]]></item>
                <item name="wcf.like.reactionsReceived"><![CDATA[Erhaltene Reaktionen]]></item>
                <item name="wcf.like.reactionsGiven"><![CDATA[Vergebene Reaktionen]]></item>
        </category>
index dba55ec74e18ab4b7f6677347d79f2e4b8a965e0..92c3fc6fc02ac7cf22f4411f66bec0c04b468302 100644 (file)
@@ -3929,7 +3929,7 @@ Attachments:
                <item name="wcf.like.reaction.label"><![CDATA[{#$reactions} reaction{if $reactions != 1}s{/if}]]></item>
                <item name="wcf.like.reaction.more"><![CDATA[More Reactions]]></item>
                <item name="wcf.like.reaction.noMoreEntries"><![CDATA[There are no new reactions at the moment.]]></item>
-               <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}]]></item>
+               <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}{if $other} and {if $other == 1}one other reaction{else}{#$other} other reactions{/if}{/if}]]></item>
                <item name="wcf.like.reactionsReceived"><![CDATA[Reactions Received]]></item>
                <item name="wcf.like.reactionsGiven"><![CDATA[Reactions Given]]></item>
        </category>