[Rt-commit] rt branch, 4.2/bookmarks-in-lib, updated. rt-4.0.0rc6-160-gb5f0c48
Shawn Moore
sartak at bestpractical.com
Tue Mar 8 12:57:45 EST 2011
The branch, 4.2/bookmarks-in-lib has been updated
via b5f0c48a321bfb48d50f1768bf1494638f15f088 (commit)
via bb4923b4321666a6cc396db103f11a767143cce7 (commit)
from 45136c18819e95d8793c720bb887fa869527559c (commit)
Summary of changes:
lib/RT/Ticket.pm | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit bb4923b4321666a6cc396db103f11a767143cce7
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Mar 8 12:57:05 2011 -0500
Make IsBookmarked on a merged ticket work again
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index cc60390..1b1ce5d 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -3688,14 +3688,18 @@ Checks whether the ticket is bookmarked by the CurrentUser.
sub IsBookmarked {
my $self = shift;
+ my $id = $self->id;
- my $bookmarks = $self->CurrentUser->UserObj->FirstAttribute('Bookmarks');
- return 0 if !$bookmarks;
+ my @ids = $id;
+ if ($id != $self->EffectiveId) {
+ push @ids, $self->Merged;
+ }
- $bookmarks = $bookmarks->Content;
- return 0 if !$bookmarks;
+ my $bookmarks = $self->CurrentUser->UserObj->FirstAttribute('Bookmarks');
+ $bookmarks = $bookmarks ? $bookmarks->Content : {};
- return $bookmarks->{ $self->id } ? 1 : 0;
+ my @bookmarked = grep { $bookmarks->{ $_ } } @ids;
+ return @bookmarked ? 1 : 0;
}
=head2 ToggleBookmark
commit b5f0c48a321bfb48d50f1768bf1494638f15f088
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Mar 8 12:57:19 2011 -0500
Pull out $bookmarks, reuse $id
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 1b1ce5d..715b1c8 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -3713,11 +3713,13 @@ sub ToggleBookmark {
my $id = $self->id;
my @ids = $id;
-
- if ($self->id != $self->EffectiveId) {
- push @ids, $ticket->Merged;
+ if ($id != $self->EffectiveId) {
+ push @ids, $self->Merged;
}
+ my $bookmarks = $self->CurrentUser->UserObj->FirstAttribute('Bookmarks');
+ $bookmarks = $bookmarks ? $bookmarks->Content : {};
+
my $is_bookmarked;
if ( grep { $bookmarks->{ $_ } } @ids ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list