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
c616db87
Commit
c616db87
authored
6 years ago
by
Jay Friendly
Browse files
Options
Downloads
Patches
Plain Diff
Fixing issues arising from merging 1.x of the module into 2.x
parent
6767a343
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/private_message_thread.js
+9
-9
9 additions, 9 deletions
js/private_message_thread.js
private_message.module
+0
-98
0 additions, 98 deletions
private_message.module
with
9 additions
and
107 deletions
js/private_message_thread.js
+
9
−
9
View file @
c616db87
...
...
@@ -150,20 +150,20 @@ Drupal.PrivateMessages.threadChange = {};
}
});
if
(
refreshRate
)
{
$
.
ajax
({
url
:
drupalSettings
.
privateMessageThread
.
newMessageCheckUrl
,
data
:
{
threadid
:
threadId
,
messageid
:
newestId
},
success
:
function
(
data
)
{
triggerCommands
(
data
);
$
.
ajax
({
url
:
drupalSettings
.
privateMessageThread
.
newMessageCheckUrl
,
data
:
{
threadid
:
threadId
,
messageid
:
newestId
},
success
:
function
(
data
)
{
triggerCommands
(
data
);
loadingNew
=
false
;
loadingNew
=
false
;
if
(
refreshRate
)
{
// Check for new messages again.
timeout
=
window
.
setTimeout
(
getNewMessages
,
refreshRate
);
}
}
);
}
}
}
);
}
}
...
...
This diff is collapsed.
Click to expand it.
private_message.module
+
0
−
98
View file @
c616db87
...
...
@@ -432,110 +432,12 @@ function private_message_user_form_submit(array &$form, FormStateInterface $form
// Get the user whose account object is being modified.
$user
=
$formState
->
getFormObject
()
->
getEntity
();
$user_data
=
\Drupal
::
service
(
'user.data'
);
// Save the submitted data to the user's UserData.
$user_data
->
set
(
'private_message'
,
$user
->
id
(),
'receive_notification'
,
$formState
->
getValue
([
'private_messages'
,
'receive_notification'
]));
$user_data
->
set
(
'private_message'
,
$user
->
id
(),
'notify_when_using'
,
$formState
->
getValue
([
'private_messages'
,
'notify_when_using'
]));
$user_data
->
set
(
'private_message'
,
$user
->
id
(),
'number_of_seconds_considered_away'
,
$formState
->
getValue
([
'private_messages'
,
'number_of_seconds_considered_away'
]));
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Adds private message emails to the configuration form so that administrators
* can modify the email as necessary.
*
* @see hook_form_alter()
* @see \Drupal\user\ProfileForm
*/
function
private_message_form_user_admin_settings_alter
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$config
=
\Drupal
::
config
(
'private_message.settings'
);
$mail_config
=
\Drupal
::
config
(
'private_message.mail'
);
// Only add the email to the form if private message email notifications
// have been enabled.
if
(
$config
->
get
(
'enable_email_notifications'
))
{
// List the available tokens.
$private_message_token_help
=
t
(
'Available variables are: [site:name], [site:url], [user:display-name], [user:account-name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url], [private_message:id], [private_message:author-name], [private_message:message], [private_message:url], [private_message:created], [private_message_thread:id], [private_message_thread:], [private_message_thread:url], [private_message_thread:updated].'
);
$form
[
'email_private_message'
]
=
[
'#type'
=>
'details'
,
'#title'
=>
t
(
'Private message notification'
),
'#description'
=>
t
(
'Edit the notification mail sent to users when they receive a private message'
)
.
$private_message_token_help
,
'#group'
=>
'email'
,
'#tree'
=>
TRUE
,
];
$form
[
'email_private_message'
][
'settings'
]
=
[
'#type'
=>
'container'
,
];
$form
[
'email_private_message'
][
'settings'
][
'user_mail_private_message_notification_subject'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Subject'
),
'#default_value'
=>
$mail_config
->
get
(
'message_notification.subject'
),
'#maxlength'
=>
180
,
];
$form
[
'email_private_message'
][
'settings'
][
'user_mail_private_message_notification_body'
]
=
[
'#type'
=>
'textarea'
,
'#title'
=>
t
(
'Body'
),
'#rows'
=>
17
,
'#default_value'
=>
$mail_config
->
get
(
'message_notification.body'
),
];
$form
[
'#submit'
][]
=
'private_message_user_admin_settings_submit'
;
}
}
/**
* Submit handler, saves alterations to private message emails.
*
* @see private_message_form_user_admin_settings_alter()
* @see \Drupal\user\ProfileForm
*/
function
private_message_user_admin_settings_submit
(
array
&
$form
,
FormStateInterface
$form_state
)
{
\Drupal
::
service
(
'config.factory'
)
->
getEditable
(
'private_message.mail'
)
->
set
(
'message_notification.subject'
,
$form_state
->
getValue
(
[
'email_private_message'
,
'settings'
,
'user_mail_private_message_notification_subject'
,
]
))
->
set
(
'message_notification.body'
,
$form_state
->
getValue
(
[
'email_private_message'
,
'settings'
,
'user_mail_private_message_notification_body'
,
]
))
->
save
();
}
/**
* Implements hook_mail().
*/
function
private_message_mail
(
$key
,
&
$message
,
$params
)
{
if
(
$key
==
'message_notification'
)
{
$token
=
\Drupal
::
token
();
$mail_config
=
\Drupal
::
config
(
'private_message.mail'
);
$message_subject
=
$mail_config
->
get
(
'message_notification.subject'
);
$message_body
=
$mail_config
->
get
(
'message_notification.body'
);
$data
[
'user'
]
=
$params
[
'member'
];
$data
[
'private_message'
]
=
$params
[
'private_message'
];
$data
[
'private_message_thread'
]
=
$params
[
'private_message_thread'
];
$message
[
'subject'
]
=
$token
->
replace
(
$message_subject
,
$data
);
$body
=
$token
->
replace
(
$message_body
,
$data
);
$message
[
'from'
]
=
\Drupal
::
config
(
'system.site'
)
->
get
(
'mail'
);
$message
[
'subject'
]
=
SafeMarkup
::
checkPlain
(
$message
[
'subject'
]);
$message
[
'body'
][]
=
MailFormatHelper
::
htmlToText
(
Xss
::
filter
(
$body
));
}
>>>>>>>
8.
x
-
1.
x
}
/**
* Implements hook_theme().
*/
...
...
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