[Fusionforge-commits] FusionForge branch master updated. 8673cc8b6354dc900ffc83801694a0a4f7b54f96

Alain Peyrat aljeux at fusionforge.org
Wed Mar 5 13:54:02 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  8673cc8b6354dc900ffc83801694a0a4f7b54f96 (commit)
      from  374df24dc79b66c1c6626b5960a5dc6173819681 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8673cc8b6354dc900ffc83801694a0a4f7b54f96
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Wed Mar 5 13:53:53 2014 +0100

    Fix duplicated forums when monitoring several forums in the same project

diff --git a/src/common/widget/Widget_MyMonitoredForums.class.php b/src/common/widget/Widget_MyMonitoredForums.class.php
index a4a9d71..fb3a303 100644
--- a/src/common/widget/Widget_MyMonitoredForums.class.php
+++ b/src/common/widget/Widget_MyMonitoredForums.class.php
@@ -2,6 +2,7 @@
 /**
  * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
  * Copyright 2012-2013, Franck Villaume - TrivialDev
+ * Copyright (C) 2014 Alain Peyrat - Alcatel-Lucent
  *
  * This file is a part of FusionForge.
  *
@@ -39,7 +40,8 @@ class Widget_MyMonitoredForums extends Widget {
 
 	function getContent() {
 		$html_my_monitored_forums = '';
-		$sql="SELECT DISTINCT groups.group_id, groups.group_name, forum_group_list.group_forum_id ".
+		$sql="SELECT DISTINCT groups.group_id, groups.group_name,
+			forum_group_list.group_forum_id, forum_group_list.forum_name ".
 		"FROM groups,forum_group_list,forum_monitored_forums ".
 		"WHERE groups.group_id=forum_group_list.group_id ".
 		"AND groups.status = 'A' ".
@@ -59,17 +61,18 @@ class Widget_MyMonitoredForums extends Widget {
 		while ($r = db_fetch_array($result)) {
 			if (forge_check_perm('project', $r['group_id'], 'read')
 					&& forge_check_perm('forum', $r['group_forum_id'], 'read')) {
-				$glist[] = $r;
+				$glist[] = serialize(array($r['group_id'], $r['group_name']));
 			}
 		}
+		$glist = array_unique($glist);
 		$rows=count($glist);
 		if (!$result || $rows < 1) {
 			$html_my_monitored_forums .= '<div class="warning">' . _("You are not monitoring any forums.") . '</div><p>' . _("If you monitor forums, you will be sent new posts in the form of an email, with a link to the new message.") . '</p><p>' . _("You can monitor forums by clicking on the appropriate menu item in the discussion forum itself.") . '</p>';
 		} else {
 			$request =& HTTPRequest::instance();
 			$html_my_monitored_forums .= '<table style="width:100%">';
-			for ($j=0; $j<$rows; $j++) {
-				$group_id = $glist[$j]['group_id'];
+			foreach ($glist as $group) {
+				list($group_id, $group_name) = unserialize($group);
 
 				$sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
 					"FROM groups,forum_group_list,forum_monitored_forums ".
@@ -107,8 +110,7 @@ class Widget_MyMonitoredForums extends Widget {
 				list($hide_now,$count_diff,$hide_url) = my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
 
 				$html_hdr = '<tr class="boxitem"><td colspan="2">'.
-				$hide_url.'<a href="/forum/?group_id='.$group_id.'">'.
-				$glist[$j]['group_name'].'</a>    ';
+				$hide_url.'<a href="/forum/?group_id='.$group_id.'">'.$group_name.'</a>    ';
 
 				$html = '';
 				$count_new = max(0, $count_diff);

-----------------------------------------------------------------------

Summary of changes:
 src/common/widget/Widget_MyMonitoredForums.class.php |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list