When an inbox message is sent to a group, and any member reads it, it is
marked as read by all members.
This commit is contained in:
parent
1ec0ec5961
commit
368ef7d411
4 changed files with 62 additions and 2 deletions
|
|
@ -23,6 +23,7 @@
|
|||
elements (eg. check lists) only one of the selected elements was taken into
|
||||
account in the search query. ( Martin Kamerbeek / Oqapi )
|
||||
- fixed #10439: Call to insufficient is wrong (lrobinson / Orchard Solutions )
|
||||
- fixed #10373: Admin groups inbox messages linger after task complete
|
||||
- fixed a bug in Thingy where the defaultValue of multi value form elements
|
||||
would not be applied ( Martin Kamerbeek / Oqapi )
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@ versions. Be sure to heed the warnings contained herein as they will
|
|||
save you many hours of grief.
|
||||
|
||||
|
||||
7.7.8
|
||||
--------------------------------------------------------------------
|
||||
* A basic behavior of the Inbox has been changed. If a message is
|
||||
sent to a Group of WebGUI users, and any member of the group reads
|
||||
the message, then that message is marked as read by all members. This
|
||||
most often happens for commit reminders for version tags that require
|
||||
approval. The old behavior often resulted in several users trying
|
||||
to approve version tags that had already been approved.
|
||||
|
||||
|
||||
7.7.7
|
||||
--------------------------------------------------------------------
|
||||
* WebGUI now requires Digest::SHA.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ my $quiet; # this line required
|
|||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
messageStateCleanup($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -44,6 +45,37 @@ finish($session); # this line required
|
|||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
sub messageStateCleanup {
|
||||
my $session = shift;
|
||||
my $db = $session->db;
|
||||
|
||||
# Acquire messageIds to fine orphans (no inbox message associated) and those with group delivered system messages marked as completed
|
||||
#
|
||||
my $messageListRef = $db->buildArrayRef("SELECT distinct messageId FROM inbox_messageState WHERE isRead=0 AND deleted = 0");
|
||||
my $sth = $db->read("SELECT status,groupId FROM inbox WHERE messageId=?");
|
||||
for my $messageId (@$messageListRef) {
|
||||
$sth->execute([$messageId]);
|
||||
my $rows = $sth->rows;
|
||||
|
||||
# No reference to any current message in the inbox
|
||||
#
|
||||
if ( !$rows ) {
|
||||
$db->write( "DELETE FROM inbox_messageState WHERE messageId=?", [$messageId] );
|
||||
}
|
||||
else {
|
||||
# test messages for values of completed status and group delivery
|
||||
#
|
||||
while ( my ( $status, $groupId ) = $sth->array ) {
|
||||
next if $status ne "completed" || !$groupId;
|
||||
$db->write( "UPDATE inbox_messageState SET isRead=1 WHERE messageId=?", [$messageId] );
|
||||
}
|
||||
}
|
||||
} ## end for my $messageId (@$messageListRef)
|
||||
$sth->finish;
|
||||
} ## end sub messageStateCleanup
|
||||
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -428,8 +428,8 @@ sub setCompleted {
|
|||
$self->{_inbox}{completedBy} = $userId;
|
||||
$self->{_inbox}{completedOn} = time();
|
||||
$self->session->db->setRow("inbox","messageId",$self->{_inbox});
|
||||
#Completed messages should also be marked read
|
||||
$self->setRead($userId);
|
||||
#Completed messages should also be marked read for all users connected to this message
|
||||
$self->setReadAll;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -478,6 +478,23 @@ sub setRead {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setReadAll ( )
|
||||
|
||||
Marks a message read for all users who are connected to this message
|
||||
|
||||
=cut
|
||||
|
||||
sub setReadAll {
|
||||
my $self = shift;
|
||||
|
||||
$self->session->db->write(
|
||||
q{update inbox_messageState set isRead=1 where messageId=?},
|
||||
[$self->getId]
|
||||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setReplied ( [ userId ] )
|
||||
|
||||
Marks a message replied.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue