-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Improve UX when entering email addresses for share link #30645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #30645 +/- ##
============================================
- Coverage 62.27% 62.27% -0.01%
Complexity 18233 18233
============================================
Files 1141 1141
Lines 68127 68148 +21
Branches 1230 1231 +1
============================================
+ Hits 42428 42441 +13
- Misses 25336 25346 +10
+ Partials 363 361 -2
Continue to review full report at Codecov.
|
88ca467 to
e868728
Compare
core/js/sharedialogmailview.js
Outdated
| afterRender: function () { | ||
| this.$el.find('.emailPrivateLinkForm--emailField').select2({ | ||
| // data:[{id:0,text:'enhancement'},{id:1,text:'bug'},{id:2,text:'duplicate'},{id:3,text:'invalid'},{id:4,text:'wontfix'}], | ||
| tags:["hi"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select2 lib throws Uncaught TypeError: tags is not a function in select2.js line 1210:
https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.3/select2.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find the problem @ all. :-|
Help me @PVince81 Wan Kenobi you're my only hope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It collides with the "tags" funcion of the select2 component. You might want to try either setting it via html element with "data-tags" attribute, or try to set it after creating the elements via "data" function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jvillafanez no, this syntax is correct. Please read my comments below. It's a select2 bug that was fixed in the newest version
|
this is indeed very weird. select2 is using the function |
|
If I add a row |
|
This does work correctly: (function () {
function inner() {
console.log('inner called and wants its JS logic back');
}
function another() {
console.log('another');
inner();
}
window.setTimeout(another, 5000);
})();not sure what is so different in the select2 code that the |
|
I added some console log statements and found out that "tags" are still defined in |
|
Maybe the bug was always there but we never bumped into it through our other use cases... Next up: try and run select2.js completely alone to see if there are side effects from other libraries... |
|
Put this in the owncloud root and open it through the OC web server: <html>
<head>
<script src="core/vendor/jquery/dist/jquery.min.js"></script>
<script src="core/vendor/select2/select2.js"></script>
</head>
<body>
<div>Testing how far away from logic we are with select2:</div>
<input class="public-link-modal--input emailPrivateLinkForm--emailField" id="emailPrivateLinkField-123" value="" type="hidden" />
<script type="text/javascript">
function start() {
console.log('select2 init');
$('.emailPrivateLinkForm--emailField').select2({
// data:[{id:0,text:'enhancement'},{id:1,text:'bug'},{id:2,text:'duplicate'},{id:3,text:'invalid'},{id:4,text:'wontfix'}],
tags:["hi"],
tokenSeparators:[","]
});
}
$(document).ready(start);
</script>
</body>
</html>The same problem happens... maybe we hit a select2 bug. Still, I don't understand why that "tags" variable is suddenly not set any more. Instead of trying to understand why this is happening, maybe let's try to properly use select2 by setting more options like in the example. |
|
Ok, looking at the debugger I understand the error. We're back to the world of logic. Inside the abstract Now... Tag support does work in other cases, so let's find out whether our usage of select2 is passing the correct arguments. |
|
I can't seem to make it work with tags even though I'm pretty close to the example in http://select2.github.io/select2/ The only difference I see is that OC has jQuery 2.1.4 while the example page has jQuery 1.7.1... |
|
So... I deployed the github example page http://select2.github.io/select2/ locally and reduced it to the minimum. It works on the github page of select2 but not in my local HTML page. Then I copied over select2.js and select2.css files from the github repo to the local folder and suddenly it works ! |
|
Ohhhhhhh... it seems the version deployed on the example page contains a fix that uses "tagData" instead of "tags". Sneaky! Let's try upgrading to 3.5.4... |
|
raised select2/select2#5239 |
|
pushed select2 update to 3.5.4 which fixes the issue @felixheidecke please carry on. |
|
@PVince81 … many thanks to you. I knew select2 4.0.5 exists did want to risk the major jump. I really didn't see version lurking in the shadows 3.5.4 there. Thank you for your effort 👍 |
|
It seems the autocomplete ajax request has gone missing on stable10: #30669. Instead of bringing it back as it was before, please wire select2 to a function that makes the server call. It should be possible to let select2 do an ajax call to retrieve a list of "tags" matching a given pattern. |
|
@felixheidecke please set the labels as we usually do |
I added back the "share link to contact email" functionality. Please have a look if this is what we intended. @PVince81 do you agree with how it works? |
| this.$el.find('.emailPrivateLinkForm--emailField').select2({ | ||
| containerCssClass: 'emailPrivateLinkForm--dropDown', | ||
| tags: [], | ||
| tokenSeparators:[","], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that doesn't seem to work currently, not sure why: try typing email addresses and hitting the comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try typing email addresses and hitting enter. :-) There is no more comma to be used.
core/js/sharedialogmailview.js
Outdated
| }, | ||
| results: function (data, page, query) { | ||
|
|
||
| if (data.status != 'success') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we have a minimum char limit in the old implementation or did we start searching at one char ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll start @ 3 since this is the minimum username length.
|
@felixheidecke correction: please remove the autocomplete completely. No need to waste more time on this. I'll remove the backend part here: #30670 |
0bdf3b0 to
45e2ac9
Compare
|
I just rebased the master onto this branch: @phil-davis If drone ci keeps failing then I don't know whats going on. :-( |
|
It is waiting to run now, so we will see. Update: webUI tests pass, so no issue with recent acceptance test refactoring. |
|
please confirm if this has been retested and all cases work then we can merge @phil-davis I wonder if we can get this into an acceptance test ? do you have email parsing there already ? |
|
@PVince81 there is a step: that allows putting in the email address. Is is not used much currently, but easily could be. If we want to test the behavior within the field, e.g. for adding a few addresses then deleting one in the middle..., then we will need to look into bonus selenium trickery to be able to "click" the cursor into a particular place in the field before pressing backspace etc. @individual-it - needs a bit of research next week, but in general it would be useful to be able to control cursor-placement in a text field. |
|
@phil-davis I think for now it might be enough to test with two email address and validating. In general I expect select2 to already work correctly. |
|
Created issue #30892 and assigned myself, so I do not lose track of adding some UI acceptance test functionality for this. |
@felixheidecke ^ |
I can confirm that I works on whatever testing env. I have @ my disposal. Latest FF, Latest Chrome and IE11 on my VM. |
Update select2 to 3.5.4 Also update yarn.lock Add tags functionality for email input Fix code formatting Start searching @ three chars Validate mails as they are typed allow adding and removing addresses, toggle mail body Move [x] to the right Remove artificial delay Adapt js tests Add new unit tests Remove select2 autocomplete from share dialog Show send message for a minimum of 2 secs Remove delay from sendMail promise return
5c4c264 to
5430beb
Compare
|
stable10: #30945 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

Description
Related Issue
#29695
Fixes: #30645
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: