Skip to content
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

Duplicate members listed in mentions list #3297

Closed
Spuds opened this issue Apr 1, 2019 · 4 comments
Closed

Duplicate members listed in mentions list #3297

Spuds opened this issue Apr 1, 2019 · 4 comments
Labels
Milestone

Comments

@Spuds
Copy link
Contributor

Spuds commented Apr 1, 2019

Happens in wysiwyg (certainly in QR wysiwyg) and maybe text editor. See the below link for more:

https://www.elkarte.net/community/index.php?topic=5457

@Spuds Spuds added the bug label Apr 1, 2019
@Spuds Spuds added this to the 1.1.6 milestone Apr 1, 2019
@Spuds
Copy link
Contributor Author

Spuds commented Apr 7, 2019

This one seems strange ... I can't duplicate it on my local install, so I wonder if this is some race condition we have going on or strange cache issue?

@emanuele45
Copy link
Contributor

Firefox 65 cannot reproduce.
What is strange is that I see the list only for even number of characters, so:

  • em <= see
  • ema <= disappears
  • eman <= see
  • emanu <= disappears

and so on.
In some cases it inverts. But anyway it looks like it appears every other char.

@Spuds
Copy link
Contributor Author

Spuds commented Apr 7, 2019

Yes I've seen that behavior as well, but only on my local, it does not happen on the site

On the ElkArte site, I can reproduce the duplicate listing every time, but not on my local.

This is using chrome ... so seems we have a bug somewhere,

@Spuds
Copy link
Contributor Author

Spuds commented Apr 8, 2019

Looking at the .done function in the suggest function of mentioning.plugin.js

			.done(function(data) {
				$(data).find('item').each(function (idx, item) {
					if (typeof oMentions.opts._names[oMentions.opts._names.length] === 'undefined')
						oMentions.opts._names[oMentions.opts._names.length] = {};

					oMentions.opts._names[oMentions.opts._names.length - 1] = {
						"id": $(item).attr('id'),
						"name": $(item).text()
					};
				});

				callback();
			})

I don't understand why we are using oMentions.opts._names.length vs just the idx of the each loop?

I'm also not sure why we are checking if its not defined yet and then adding a blank {} object? I think the code is getting confused on the length ....

I changed it the following on the site just as a test ....

			.done(function(data) {
				$(data).find('item').each(function (idx, item) {
					oMentions.opts._names[idx] = {
						"id": $(item).attr('id'),
						"name": $(item).text()
					};
				});

				callback();
			})

Spuds added a commit to Spuds/Elkarte that referenced this issue Apr 9, 2019
@Spuds Spuds closed this as completed Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants