Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
private_message
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
private_message
Merge requests
!57
Issue
#3337216
: DI problems
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3337216
: DI problems
issue/private_message-3337216:3337216-di-problems
into
3.0.x
Overview
0
Commits
11
Pipelines
6
Changes
15
Merged
Taras Kravchuk
requested to merge
issue/private_message-3337216:3337216-di-problems
into
3.0.x
2 years ago
Overview
0
Commits
11
Pipelines
6
Changes
15
Expand
0
0
Merge request reports
Viewing commit
48aa4c49
Prev
Next
Show latest version
15 files
+
260
−
201
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
15
Search (e.g. *.vue) (Ctrl+P)
48aa4c49
Merge remote-tracking branch 'upstream/3.0.x' into 3337216-di-problems
· 48aa4c49
Claudiu Cristea
authored
4 months ago
js/private_message_ban_user_autocomplete.js deleted
100644 → 0
+
0
−
40
Options
((
$
,
Drupal
)
=>
{
/**
* Override drupal selectHandler function
* @param {jQuery.Event} event The event
* @param {Object} ui UI
* @return {boolean} Members ban
*/
function
membersBanSelectHandler
(
event
,
ui
)
{
let
valueField
=
$
(
event
.
target
);
if
(
$
(
event
.
target
).
hasClass
(
'
private-message-ban-autocomplete
'
))
{
const
valueFieldName
=
'
banned_user
'
;
if
(
$
(
`input[name=
${
valueFieldName
}
]`
).
length
>
0
)
{
valueField
=
$
(
`input[name=
${
valueFieldName
}
]`
);
// Update the labels too.
const
labels
=
Drupal
.
autocomplete
.
splitValues
(
event
.
target
.
value
);
labels
.
pop
();
labels
.
push
(
ui
.
item
.
label
);
event
.
target
.
value
=
labels
.
join
(
'
,
'
);
}
}
const
terms
=
Drupal
.
autocomplete
.
splitValues
(
valueField
.
val
());
// Remove the current input.
terms
.
pop
();
// Add the selected item.
terms
.
push
(
ui
.
item
.
value
);
valueField
.
val
(
terms
.
join
(
'
,
'
));
// Return false to tell jQuery UI that we've filled in the value already.
return
false
;
}
Drupal
.
behaviors
.
privateMessageBan
=
{
attach
()
{
// Attach custom select handler to fields with class.
$
(
'
input.private-message-ban-autocomplete
'
).
autocomplete
({
select
:
membersBanSelectHandler
,
});
},
};
})(
jQuery
,
Drupal
);
Loading