Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61901040
PhabricatorFeedStoryNotification.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, May 9, 16:52
Size
1 KB
Mime Type
text/x-php
Expires
Sat, May 11, 16:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17574738
Attached To
rPH Phabricator
PhabricatorFeedStoryNotification.php
View Options
<?php
final
class
PhabricatorFeedStoryNotification
extends
PhabricatorFeedDAO
{
protected
$userPHID
;
protected
$primaryObjectPHID
;
protected
$chronologicalKey
;
protected
$hasViewed
;
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_IDS
=>
self
::
IDS_MANUAL
,
self
::
CONFIG_TIMESTAMPS
=>
false
,
)
+
parent
::
getConfiguration
();
}
static
public
function
updateObjectNotificationViews
(
PhabricatorUser
$user
,
$object_phid
)
{
$unguarded
=
AphrontWriteGuard
::
beginScopedUnguardedWrites
();
$notification_table
=
new
PhabricatorFeedStoryNotification
();
$conn
=
$notification_table
->
establishConnection
(
'w'
);
queryfx
(
$conn
,
'UPDATE %T
SET hasViewed = 1
WHERE userPHID = %s
AND primaryObjectPHID = %s
AND hasViewed = 0'
,
$notification_table
->
getTableName
(),
$user
->
getPHID
(),
$object_phid
);
unset
(
$unguarded
);
}
public
function
countUnread
(
PhabricatorUser
$user
)
{
$conn
=
$this
->
establishConnection
(
'r'
);
$data
=
queryfx_one
(
$conn
,
'SELECT COUNT(*) as count
FROM %T
WHERE userPHID = %s AND hasViewed = 0'
,
$this
->
getTableName
(),
$user
->
getPHID
());
return
$data
[
'count'
];
}
}
Event Timeline
Log In to Comment