Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7408491
EchoEditUserPagePresentationModel.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
EchoEditUserPagePresentationModel.php
View Options
<?php
namespace
MediaWiki\Extension\Notifications\Formatters
;
use
MediaWiki\MediaWikiServices
;
class
EchoEditUserPagePresentationModel
extends
EchoEventPresentationModel
{
/** @inheritDoc */
public
function
canRender
()
{
return
(
bool
)
$this
->
event
->
getTitle
();
}
/** @inheritDoc */
public
function
getIconType
()
{
return
'edit-user-page'
;
}
/** @inheritDoc */
public
function
getPrimaryLink
()
{
return
[
'url'
=>
$this
->
getDiffLinkUrl
(),
'label'
=>
$this
->
msg
(
'notification-link-text-view-edit'
)->
text
(),
];
}
/** @inheritDoc */
public
function
getSecondaryLinks
()
{
if
(
$this
->
isBundled
()
)
{
return
[];
}
else
{
return
[
$this
->
getAgentLink
()
];
}
}
/** @inheritDoc */
public
function
getHeaderMessage
()
{
if
(
$this
->
isBundled
()
)
{
$msg
=
$this
->
msg
(
'notification-bundle-header-edit-user-page'
);
$count
=
$this
->
getNotificationCountForOutput
();
$msg
->
numParams
(
$count
);
$msg
->
params
(
$this
->
getViewingUserForGender
()
);
return
$msg
;
}
else
{
// Messages: notification-header-edit-user-page
$msg
=
parent
::
getHeaderMessage
();
$msg
->
params
(
$this
->
getViewingUserForGender
()
);
return
$msg
;
}
}
/** @inheritDoc */
public
function
getCompactHeaderMessage
()
{
$msg
=
$this
->
getMessageWithAgent
(
'notification-compact-header-edit-user-page'
);
$msg
->
params
(
$this
->
getViewingUserForGender
()
);
return
$msg
;
}
/** @inheritDoc */
public
function
getBodyMessage
()
{
if
(
$this
->
isBundled
()
)
{
return
false
;
}
return
$this
->
getRevisionCommentMessage
();
}
private
function
getDiffLinkUrl
():
string
{
$revId
=
$this
->
event
->
getExtraParam
(
'revid'
);
$oldId
=
$this
->
isBundled
()
?
$this
->
getRevBeforeFirstNotification
()
:
'prev'
;
$query
=
[
'oldid'
=>
$oldId
,
'diff'
=>
$revId
,
];
return
$this
->
event
->
getTitle
()->
getFullURL
(
$query
);
}
private
function
getRevBeforeFirstNotification
():
int
{
$events
=
$this
->
getBundledEvents
();
$firstNotificationRevId
=
end
(
$events
)->
getExtraParam
(
'revid'
);
$revisionLookup
=
MediaWikiServices
::
getInstance
()->
getRevisionLookup
();
$revisionRecord
=
$revisionLookup
->
getRevisionById
(
$firstNotificationRevId
);
$previousRevision
=
$revisionRecord
?
$revisionLookup
->
getPreviousRevision
(
$revisionRecord
)
:
null
;
$oldRevisionID
=
$previousRevision
?
$previousRevision
->
getId
()
:
0
;
return
$oldRevisionID
;
}
/** @inheritDoc */
protected
function
getSubjectMessageKey
()
{
return
'notification-edit-user-page-email-subject'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 21:37 (1 d, 15 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8a/9c/48b00cf49b728ead8bc9216bc997
Default Alt Text
EchoEditUserPagePresentationModel.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment