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, 6.1 has been updated
       via  fabc7c5a700e2bb2a175fd00b9e268f41cbb98c3 (commit)
      from  82f1042825c794cc7b72830f497b086c92930896 (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 -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=fabc7c5a700e2bb2a175fd00b9e268f41cbb98c3

commit fabc7c5a700e2bb2a175fd00b9e268f41cbb98c3
Author: Roland Mas <[email protected]>
Date:   Tue Feb 16 13:14:26 2021 +0100

    News: don't link to nonexistent forums
    
    If the news-related forum has been deleted but the news still exists,
    then display the news but don't link to the forum to avoid a broken
    link.

diff --git a/src/www/news/news_utils.php b/src/www/news/news_utils.php
index 09f11b9..1e99910 100644
--- a/src/www/news/news_utils.php
+++ b/src/www/news/news_utils.php
@@ -103,12 +103,13 @@ function news_show_latest($group_id = 0, $limit = 10, 
$show_summaries = true, $a
                                SELECT groups.group_name, 
groups.unix_group_name, groups.group_id,
                                users.user_name, users.realname, users.user_id,
                                news_bytes.forum_id, news_bytes.summary, 
news_bytes.post_date,
-                               news_bytes.details
-                               FROM users,news_bytes,groups
+                               news_bytes.details,forum_group_list.forum_name
+                FROM users
+                  JOIN news_bytes ON (users.user_id=news_bytes.submitted_by)
+                  JOIN groups ON (news_bytes.group_id=groups.group_id)
+                  LEFT OUTER JOIN forum_group_list ON news_bytes.forum_id = 
forum_group_list.group_forum_id
                                WHERE (news_bytes.group_id=$1 AND 
news_bytes.is_approved <> 4 OR 1!=$2)
                                AND (news_bytes.is_approved=1 OR 1 != $3)
-                               AND users.user_id=news_bytes.submitted_by
-                               AND news_bytes.group_id=groups.group_id
                                AND groups.status=$4
                                ORDER BY post_date DESC',
                                array ($group_id,
@@ -147,15 +148,20 @@ function news_show_latest($group_id = 0, $limit = 10, 
$show_summaries = true, $a
                                $summ_txt='';
                        }
 
+            $forum_exists = False;
+            if (db_result($result,$i,'forum_name')) {
+                    $forum_exists = True;
+            }
+
                        if (!$limit) {
-                               if ($show_forum) {
+                               if ($show_forum && $forum_exists) {
                                        $return .= '<h3>'.util_make_link 
($t_thread_url, $t_thread_title).'</h3>';
                                } else {
                                        $return .= '<h3>'. $t_thread_title . 
'</h3>';
                                }
                                $return .= ' &nbsp; <em>'. date(_('Y-m-d 
H:i'),db_result($result,$i,'post_date')).'</em><br />';
                        } else {
-                               if ($show_forum) {
+                               if ($show_forum && $forum_exists) {
                                        $return .= '<h3>'.util_make_link 
($t_thread_url, $t_thread_title).'</h3>';
                                } else {
                                        $return .= '<h3>'. $t_thread_title . 
'</h3>';

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

Summary of changes:
 src/www/news/news_utils.php | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to