Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
normandy
pleroma
Commits
d8984b7b
Verified
Commit
d8984b7b
authored
6 years ago
by
href
Browse files
Options
Downloads
Patches
Plain Diff
Push: add missing notification_type field
parent
7facbb2b
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
lib/pleroma/web/push/push.ex
+14
-3
14 additions, 3 deletions
lib/pleroma/web/push/push.ex
with
14 additions
and
3 deletions
lib/pleroma/web/push/push.ex
+
14
−
3
View file @
d8984b7b
...
...
@@ -58,14 +58,15 @@ defmodule Pleroma.Web.Push do
body
=
Jason
.
encode!
(%{
title:
format_title
(
notification
),
access_token:
record
.
token
.
token
,
body:
format_body
(
notification
,
actor
),
notification_id:
notification
.
id
,
notification_type:
format_type
(
notification
),
icon:
User
.
avatar_url
(
actor
),
preferred_locale:
"en"
,
access_token:
record
.
token
.
token
preferred_locale:
"en"
})
case
WebPushEncryption
.
send_web_push
(
body
,
subscription
,
@gcm_api_key
)
do
case
WebPushEncryption
.
send_web_push
(
body
,
subscription
)
do
{
:ok
,
%{
status_code:
code
}}
when
400
<=
code
and
code
<
500
->
Logger
.
debug
(
"Removing subscription record"
)
Repo
.
delete!
(
record
)
...
...
@@ -92,6 +93,16 @@ defmodule Pleroma.Web.Push do
{
:noreply
,
state
}
end
# https://github.com/tootsuite/mastodon/blob/master/app/models/notification.rb#L19
defp
format_type
(%{
activity:
%{
data:
%{
"type"
=>
type
}}})
do
case
type
do
"Create"
->
"mention"
"Follow"
->
"follow"
"Announce"
->
"reblog"
"Favorite"
->
"favourite"
end
end
defp
format_title
(%{
activity:
%{
data:
%{
"type"
=>
type
}}})
do
case
type
do
"Create"
->
"New Mention"
...
...
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