? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
2 Nov 2019

Pull Request for Issue #26895 .

Summary of Changes

fix

Testing Instructions

  1. apply pr
  2. Login to Joomla admin with one user
    
  3. Go to the private message section.
    
  4. Add another user Id in recipients
    
  5. Add some context and send the message.
    
  6. Now login with another user.
    
  7. See the admin panel
    

Expected result

badge

Actual result

no badge

avatar alikon alikon - open - 2 Nov 2019
avatar alikon alikon - change - 2 Nov 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Nov 2019
Category Modules Administration
avatar infograf768 infograf768 - test_item - 2 Nov 2019 - Tested successfully
avatar infograf768
infograf768 - comment - 2 Nov 2019

I have tested this item successfully on eb4387b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar thite-amol thite-amol - test_item - 2 Nov 2019 - Tested unsuccessfully
avatar thite-amol
thite-amol - comment - 2 Nov 2019

I have tested this item ? unsuccessfully on eb4387b

Now the messages appear in the list view. However, the notification count does not change even after I read the messages


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar alikon
alikon - comment - 2 Nov 2019

that's another issue see #26921 and should be managed in a separate PR

avatar thite-amol
thite-amol - comment - 2 Nov 2019

Please check the image below. The referred issue is different from this.
Private Messages     Administration

avatar infograf768 infograf768 - test_item - 2 Nov 2019 - Tested unsuccessfully
avatar infograf768
infograf768 - comment - 2 Nov 2019

I have tested this item ? unsuccessfully on eb4387b

I agree with @thite-amol and modify my test

looks like getitems will get all items pertaining to the user whatever the state of the message. It works in the Messages manager because we have filters, but not for the module


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar infograf768
infograf768 - comment - 2 Nov 2019

I get it to work by using the query we had in J3

diff --git a/administrator/modules/mod_messages/mod_messages.php b/administrator/modules/mod_messages/mod_messages.php
index 1a346ed..b53a2a7 100644
--- a/administrator/modules/mod_messages/mod_messages.php
+++ b/administrator/modules/mod_messages/mod_messages.php
@@ -10,5 +10,19 @@
 defined('_JEXEC') or die;
 
+use Joomla\CMS\Factory;
 use Joomla\CMS\Helper\ModuleHelper;
 
+// Get the number of unread messages in your inbox.
+$db   = Factory::getDbo();
+$user = Factory::getUser();
+
+$query = $db->getQuery(true)
+	->select('COUNT(*)')
+	->from('#__messages')
+	->where('state = 0 AND user_id_to = ' . (int) $user->get('id'));
+
+$db->setQuery($query);
+
+$countUnread = (int) $db->loadResult();
+
 require ModuleHelper::getLayoutPath('mod_messages', $params->get('layout', 'default'));
diff --git a/administrator/modules/mod_messages/tmpl/default.php b/administrator/modules/mod_messages/tmpl/default.php
index ec0fa3a..00bda51 100644
--- a/administrator/modules/mod_messages/tmpl/default.php
+++ b/administrator/modules/mod_messages/tmpl/default.php
@@ -27,5 +27,4 @@
 			<?php echo Text::_('MOD_MESSAGES_PRIVATE_MESSAGES'); ?>
 		</div>
-		<?php $countUnread = $app->getSession()->get('messages.unread'); ?>
 		<?php if ($countUnread > 0) : ?>
 			<span class="badge badge-pill badge-danger"><?php echo $countUnread; ?></span>
avatar alikon alikon - change - 4 Nov 2019
Labels Added: ?
avatar alikon
alikon - comment - 4 Nov 2019

@infograf768, @thite-amol please retest

avatar isidrobaq isidrobaq - test_item - 15 Nov 2019 - Tested successfully
avatar isidrobaq
isidrobaq - comment - 15 Nov 2019

I have tested this item successfully on 296bb15


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar BertaOctech BertaOctech - test_item - 15 Nov 2019 - Tested successfully
avatar BertaOctech
BertaOctech - comment - 15 Nov 2019

I have tested this item successfully on 296bb15

Followed testing instructions.

Notifications appeared when patch was applied. Not before.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar Quy Quy - change - 15 Nov 2019
Status Pending Ready to Commit
avatar alikon alikon - change - 15 Nov 2019
Labels Added: ?
avatar infograf768 infograf768 - test_item - 16 Nov 2019 - Tested successfully
avatar infograf768
infograf768 - comment - 16 Nov 2019

I have tested this item successfully on 840bb9d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26912.

avatar infograf768 infograf768 - change - 16 Nov 2019
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-11-16 07:41:53
Closed_By infograf768
avatar infograf768 infograf768 - close - 16 Nov 2019
avatar infograf768 infograf768 - merge - 16 Nov 2019
avatar infograf768
infograf768 - comment - 16 Nov 2019

tks

Add a Comment

Login with GitHub to post a comment