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
!140
Resolve
#3487705
"Refactor banuserform"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve
#3487705
"Refactor banuserform"
issue/private_message-3487705:3487705-refactor-banuserform
into
3.0.x
Overview
6
Commits
5
Pipelines
6
Changes
7
3 unresolved threads
Show all comments
Merged
Adrian Lorenc
requested to merge
issue/private_message-3487705:3487705-refactor-banuserform
into
3.0.x
4 months ago
Overview
6
Commits
5
Pipelines
6
Changes
7
3 unresolved threads
Show all comments
Expand
Closes
#3487705
1
0
Merge request reports
Compare
3.0.x
version 4
97adc98c
4 months ago
version 3
ccf58b93
4 months ago
version 2
3f4a3b2e
4 months ago
version 1
83cbddf3
4 months ago
3.0.x (base)
and
latest version
latest version
208fc418
5 commits,
4 months ago
version 4
97adc98c
5 commits,
4 months ago
version 3
ccf58b93
4 commits,
4 months ago
version 2
3f4a3b2e
3 commits,
4 months ago
version 1
83cbddf3
2 commits,
4 months ago
7 files
+
104
−
131
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
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