_binary From 139073e7f4458145864d03b59d107a481db417cc Mon Sep 17 00:00:00 2001
From: Prajna Puranik <prajnagp@gmail.com>
Date: Mon, 24 Jul 2023 21:16:50 -0700
Subject: [PATCH 1/2] Moderation page bug fix

---
 src/controllers/components/SocialComponent.php | 12 ++++--------
 src/models/GroupModel.php                      |  9 +++++----
 src/views/elements/GroupfeedElement.php        |  2 +-
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index fe81212e3..d3c29f82b 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -1564,12 +1564,10 @@ class SocialComponent extends Component implements CrawlConstants
                     }
                     if ($success) {
                         return $parent->redirectWithMessage(
-                            tl('social_component_flagged_item_approved'),
-                            ['page_name']);
+                            tl('social_component_flagged_item_approved'));
                     } else {
                         return $parent->redirectWithMessage(
-                            tl('social_component_no_flagged_item_approved'),
-                            ['page_name']);
+                            tl('social_component_no_flagged_item_approved'));
                     }
                     break;
                 case "deleteflagged":
@@ -1585,12 +1583,10 @@ class SocialComponent extends Component implements CrawlConstants
                     }
                     if ($success) {
                         return $parent->redirectWithMessage(
-                            tl('social_component_flagged_item_deleted'),
-                            ['page_name']);
+                            tl('social_component_flagged_item_deleted'));
                     } else {
                         return $parent->redirectWithMessage(
-                            tl('social_component_no_flagged_item_deleted'),
-                            ['page_name']);
+                            tl('social_component_no_flagged_item_deleted'));
                     }
                     break;
                 case "downvote":
diff --git a/src/models/GroupModel.php b/src/models/GroupModel.php
index 11d1ce999..e1d4dffe4 100644
--- a/src/models/GroupModel.php
+++ b/src/models/GroupModel.php
@@ -1144,7 +1144,7 @@ class GroupModel extends Model implements MediaConstants
         if ($this->isGroupEncrypted($group_id)) {
             $threshold = $this->getThresholdValue($group_id);
             $key = $this->getGroupKey($group_id);
-            if($flag_count == 0) {
+            if (is_null($flag_count)) {
                 $flag_count = $this->encryptFlag(strval($flag_count), $key);
             }
             if ($flag_count === $threshold) {
@@ -1154,11 +1154,12 @@ class GroupModel extends Model implements MediaConstants
                     $result['USER_ID'], $result['TITLE'],$result['DESCRIPTION'],
                     $flag_count_decrypt, $post_id, $group_id,
                     C\STANDARD_GROUP_ITEM, 0, "");
-            } else {
-                $flag_count = $this->encryptFlag(strval($flag_count), $key);
+            }else if ($flag_count === $this->encryptFlag($threshold, $key)) {
+                return false;
             }
+            $flag_count = $this->encryptFlag(strval($flag_count), $key);
         } else {
-            $flag_count++;
+            $flag_count = $flag_count + 1;
             $threshold = 3;
             if($flag_count > $threshold) {
                 return false;
diff --git a/src/views/elements/GroupfeedElement.php b/src/views/elements/GroupfeedElement.php
index 4497e3e61..ce7b215b1 100644
--- a/src/views/elements/GroupfeedElement.php
+++ b/src/views/elements/GroupfeedElement.php
@@ -435,7 +435,7 @@ class GroupfeedElement extends Element implements CrawlConstants
                 if ($open_in_tabs) {
                      ?> target="_blank" rel="noopener"<?php
                 }
-                ?> class="green" <?= $page[self::TITLE] ?></a></h2><?php
+                ?> class="green"><?= $page[self::TITLE] ?></a></h2><?php
             } else if (!$is_thread || $first_page) { ?>
                 <h2><a href="<?= $this->formatHref(B\feedsUrl('thread',
                     $page['PARENT_ID'], true, $data['CONTROLLER']) .
-- 
2.39.2 (Apple Git-143)


From 0f5f31f6c6a6729c6f7fe78efdd48cc4c485aafd Mon Sep 17 00:00:00 2001
From: Prajna Puranik <prajnagp@gmail.com>
Date: Mon, 24 Jul 2023 21:23:58 -0700
Subject: [PATCH 2/2] Fix page redirect

---
 src/controllers/components/SocialComponent.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index d3c29f82b..fe81212e3 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -1564,10 +1564,12 @@ class SocialComponent extends Component implements CrawlConstants
                     }
                     if ($success) {
                         return $parent->redirectWithMessage(
-                            tl('social_component_flagged_item_approved'));
+                            tl('social_component_flagged_item_approved'),
+                            ['page_name']);
                     } else {
                         return $parent->redirectWithMessage(
-                            tl('social_component_no_flagged_item_approved'));
+                            tl('social_component_no_flagged_item_approved'),
+                            ['page_name']);
                     }
                     break;
                 case "deleteflagged":
@@ -1583,10 +1585,12 @@ class SocialComponent extends Component implements CrawlConstants
                     }
                     if ($success) {
                         return $parent->redirectWithMessage(
-                            tl('social_component_flagged_item_deleted'));
+                            tl('social_component_flagged_item_deleted'),
+                            ['page_name']);
                     } else {
                         return $parent->redirectWithMessage(
-                            tl('social_component_no_flagged_item_deleted'));
+                            tl('social_component_no_flagged_item_deleted'),
+                            ['page_name']);
                     }
                     break;
                 case "downvote":
-- 
2.39.2 (Apple Git-143)

