Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
private_message-3099166
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
private_message-3099166
Commits
df589e8a
Commit
df589e8a
authored
6 years ago
by
Jay Friendly
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2969720
: Update page title with unread thread count
parent
39854b0a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/private_message_notification_block.js
+26
-0
26 additions, 0 deletions
js/private_message_notification_block.js
with
26 additions
and
0 deletions
js/private_message_notification_block.js
+
26
−
0
View file @
df589e8a
...
...
@@ -38,6 +38,32 @@ Drupal.PrivateMessageNotificationBlock = {};
}
notificationWrapper
.
find
(
"
.private-message-page-link
"
).
text
(
unreadThreadCount
);
// Get the current page title.
var
pageTitle
=
$
(
"
title
"
).
text
();
// Check if there are any unread threads.
if
(
unreadThreadCount
)
{
// Check if the unread thread count is already in the page title.
if
(
pageTitle
.
match
(
/^
\(\d
+
\)\s
/
))
{
// Update the unread thread count in the page title.
pageTitle
=
pageTitle
.
replace
(
/^
\(\d
+
\)\s
/
,
"
(
"
+
unreadThreadCount
+
"
)
"
);
}
else
{
// Add the unread thread count to the URL.
pageTitle
=
"
(
"
+
unreadThreadCount
+
"
)
"
+
pageTitle
;
}
}
// No unread messages.
else
{
// Check if thread count currently exists in the page title.
if
(
pageTitle
.
match
(
/^
\(\d
+
\)\s
/
))
{
// Remove the unread thread count from the page title.
pageTitle
=
pageTitle
.
replace
(
/^
\(\d
+
\)\s
/
,
""
);
}
}
// Set the updated title.
$
(
"
title
"
).
text
(
pageTitle
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment