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

Unable to enable "Private Maps" option under the "Share" submenu in the Account Settings menu. #889

Closed
Davak-Kateelo opened this issue Dec 17, 2019 · 31 comments
Assignees
Milestone

Comments

@Davak-Kateelo
Copy link

I can click to switch from disabled to enabled, and click save, and then I see the "account saved" tip pop up in the bottom right.

But then I go back to the enable private maps and the condition is still set to disabled; despite just changing and saving my new configuration seconds before. I am now unable to add my scout alt to any maps :*(

I apologize if this is already a known issue, I didn't see a solution for it anywhere.

@Davak-Kateelo Davak-Kateelo changed the title Unable to Enable "Private Maps" option under the "Share" submenu in the Account Settings menu. Unable to enable "Private Maps" option under the "Share" submenu in the Account Settings menu. Dec 17, 2019
@zap2zero
Copy link

I experience the same issue with all three share buttons on my private installation (v1.5.5).

@WladlenAlfa
Copy link

Watching the same problem

@Caffe1neAdd1ct
Copy link
Contributor

Same issue will try to investigate if time allows

@Caffe1neAdd1ct
Copy link
Contributor

Caffe1neAdd1ct commented Jan 15, 2020

Request form data on saving the account share tab:

formData[corporationSharing]: 1
formData[share]: 
formData[privateSharing]: 0
formData[allianceSharing]: 0

I tried enabling the share private maps which is still showing as zero, might be a javascript related issue or form html.

Also can't switch the toggles back to the disabled / yellow side, refreshing shows them back at this state as the 0 has been sent in the form

@ghost
Copy link

ghost commented Jan 22, 2020

Having the same issue, which is preventing me from sharing maps with corps/alliances :(
pathfinder_sharing

Do we have any solutions to this yet?

@Caffe1neAdd1ct
Copy link
Contributor

Just setting up a development environment for pathfinder, if i get some more time this week i'll try and dig into this issue.

@CalMatar
Copy link

This is an issue with the Production version of the Public Pathfinder as well and I have gotten no reply from @exodus4d on here or even from a direct email so I am not sure what is going on.

@kazume
Copy link

kazume commented Mar 3, 2020

Friendly bump: same issue for me :) Can't share any maps because I can't change the settings

@Caffe1neAdd1ct
Copy link
Contributor

Just finished setting up the development environment for pathfinder with sass,gulp,php,mariadb etc will start having a look to see if this is something i can fix or not 👍

@Caffe1neAdd1ct
Copy link
Contributor

So looking at the post request:

formData[privateSharing]: 1
formData[share]: 
formData[corporationSharing]: 0
formData[allianceSharing]: 0

I enabled privateShare toggle which correctly posts 1 to the http://localhost:8000/api/user/saveAccount endpoint

Checked the account tab again and it was disabled, refreshing the entire page, checked again and it's green.

Interestingly on my development environment the toggles carry on working after the first click which isn't the case on the live environment

@kazume
Copy link

kazume commented Mar 3, 2020

Maybe worth mentioning: I'm also having an issue that I can't log out or even delete the account. I get: error 403: Access denied: User not found. Might be related?

@Caffe1neAdd1ct
Copy link
Contributor

So further digging, it works fine with the development generated JS/CSS which isn't minified etc

Stops working as soon as i run the production gulp task

I feel like i'm getting closer...

@Caffe1neAdd1ct
Copy link
Contributor

This is an issue with the Production version of the Public Pathfinder as well and I have gotten no reply from @exodus4d on here or even from a direct email so I am not sure what is going on.

That's the thing wih hobby projects ^^ (I have a few of those as well myself)

Definitely, and with open source projects in general the developers can't be working on them all the time. I'm guessing exodus4d has other commitments right now.

@Caffe1neAdd1ct
Copy link
Contributor

So with production:

form submits aren't submitting value of the toggles
toggles get "stuck" after the first click

development is fine

i'm guessing this is something to do with the uglification of the JS files or the order they are being included/combined.

@Caffe1neAdd1ct
Copy link
Contributor

Caffe1neAdd1ct commented Mar 3, 2020

Gulp.js

gulp.task('task:buildJs', gulp.series(
//    'task:concatJS',

Disabling the concatJS and running production task is working and submitting the correct values, so its something going wrong with combining all the JS files.

Digging deeper:

//        .pipe(requirejsOptimize(function(file){
//
//            return {
//                name: file.stem,
//                baseUrl: 'js',
//                mainConfigFile: './js/app.js',
//                optimize: 'none',
//                inlineText: false,
//                removeCombined: true,
//                preserveLicenseComments: false,     // required for sourcemaps
//                findNestedDependencies: false,
//                include: ['text'],
//             // excludeShallow: ['app'],
//             // excludeShallow: ['./js/app.js'],
//             // exclude: ['app.js'],
//             // path: {
//             //     pp: './../js/app' // the main config file will not be build
//             // },
//                onModuleBundleComplete: function(data){
//                    // collect all combined js files
//                    combinedJsFiles = [...new Set(combinedJsFiles.concat(data.included))];
//                }
//            };
//        }))

@kazume
Copy link

kazume commented Mar 3, 2020

I'm rooting for you here, just so you know!

@Caffe1neAdd1ct
Copy link
Contributor

Changing

                findNestedDependencies: false,

to

                findNestedDependencies: true,

Seems to fix the bootstrapToggles and allows their values to submit on clicking save.

@Caffe1neAdd1ct
Copy link
Contributor

Caffe1neAdd1ct commented Mar 3, 2020

v1.5.5.zip

Can you try replacing /public/js/v1.5.5 with the attached?

@kazume
Copy link

kazume commented Mar 3, 2020

v1.5.5.zip

Can you try replacing /public/js/v1.5.5 with the attached?

where do I replace what? :) (sorry, noob question maybe)

@Caffe1neAdd1ct
Copy link
Contributor

so on the server inside the pathfinder installation will be public/js/v1.5.5 just move that folder to v1.5.5_original and unzip that new one there to test the fix

@kazume
Copy link

kazume commented Mar 3, 2020

so on the server inside the pathfinder installation will be public/js/v1.5.5 just move that folder to v1.5.5_original and unzip that new one there to test the fix

Ah ok, that's not something I can do then. I'm just using the website interface ...

@Caffe1neAdd1ct
Copy link
Contributor

Caffe1neAdd1ct commented Mar 3, 2020

Talk to the sysadmin if yours is hosted, if your using the public one then you'll need to wait for this to be merged and updated. I'll get this raised as a pull request for @exodus4d and see if this is the right solution or not. Instead of enabling findNestedDependencies it might be a dependency needs to be listed in one of the files/modules. So need some advice first, but it works 👍

@kazume
Copy link

kazume commented Mar 3, 2020

Talk to the sysadmin if yours is hosted, if your using the public one then you'll need to wait for this to be merged and updated. I'll get this raised as a pull request for @exodus4d and see if this is the right solution or not. Instead of enabling findNestedDependencies it might be a dependency needs to be listed in one of the files/modules. So need some advice first, but it works 👍

Waiting it is then ... cool stuff, thx!

@exodus4d
Copy link
Owner

exodus4d commented Mar 9, 2020

@Caffe1neAdd1ct Thanks for the awesome PR! - Saves me a lot time to figure out what the problem is:

The issue only appears with "bundled/build" JS files. Bootstrap Toggle (bootstrap-toggle.min.js) gets loaded two times because it was bundled in two loaded JS files.

  • The main bundle mappage.js loads "Bootstrap Toggle" (which is correct)
  • Later on mappage.js requires datatables.loader.js (which loads DataTables + plugins),.. datatables.loader.js requires counter.js, counter.js requires util.js, util.js requires Bootstrap Toggle and initializes a 2nd time...

Unfortunately Bootstrap Toggle does not check if it was already initializes and sets some click event listeners on document a 2nd time...
https://github.com/minhur/bootstrap-toggle/blob/b76c094aca46c7d959aae991033fa578bdb0ca5d/js/bootstrap2-toggle.js#L170-L178

@Caffe1neAdd1ct PR fixes the issue indeed, but with the downside, that all bundles JS files include everything, even if the JS modules should be loaded "on demand" if they required: findNestedDependencies: true in gulpfile.js.

@Caffe1neAdd1ct
Copy link
Contributor

Caffe1neAdd1ct commented Mar 9, 2020

Ahh now that makes some sense! Was very difficult to track down a reason as to why other than the fact the bundled assets didn't work and raw worked fine.

Glad you've managed to track the dependency duplication down! I had a hunch it was something along those lines 👍

Instead of enabling findNestedDependencies it might be a dependency needs to be listed in one of the files/modules. So need some advice first, but it works +1

Well it was the opposite but close :)

@exodus4d
Copy link
Owner

exodus4d commented Mar 9, 2020

Yeah ugly bug, and invisible during development because of the unbundled JS files... I inspected the toggle DOM element and saw that it was initialized 2 times, (2nd initialize created the same DOM nodes one DOM level deeper)

@Caffe1neAdd1ct
Copy link
Contributor

I'm predominately a backend developer so delving into the frontend assets and toolset isn't my speciality but I can make some progress...

Thanks for explaining how you found the issue, helpful and good to know!

@CalMatar
Copy link

CalMatar commented Mar 9, 2020

Is this also why the Management flag is not working if you are not a Director or CEO? Mine has worked sporadically since this bug started and I am not sure if they are related or not. FYI it is not currently working and I can not make changes to my own map even though I have two of the three permissions required. I do not have Director but have the other two and I have verified them in the game. I can send you a screen shot if you want proving this but not here.

@exodus4d
Copy link
Owner

@CalMatar Thanks, I´ll check the management flag. What I can say is that the "map tracking" toggle was also affected by this bug.

exodus4d added a commit that referenced this issue Mar 15, 2020
- Upgraded "[_Select2_](https://select2.org/)" js lib `v4.0.6-rc.1` → `v4.0.13`
- Fixed some issues where changed map settings (e.g. "share") do not get updated/stored, closed #889, closed #925
- Moved ajax endpoints for map create/update/delete into `/Api/Rest/` dir
- Minor UI improvements for "manual dialog" (fixed pixelated text)
@Lynx005F
Copy link

Lynx005F commented Mar 18, 2020

v1.5.5.zip

Can you try replacing /public/js/v1.5.5 with the attached?

I replaced the v1.5.5.zip in public/js/v1.5.5 and the problem persists afterwards (Production enviroment).

Is there a workaround until a new release is created e.g. modifying it directly in the database?

Edit: After some digging, in the pathfinder database the table alliance , corporation and character all have a shared field that you can update directly in the db:

USE *Name_Of_Your_Pathfinder_DB*;
UPDATE corporation SET shared = 1 WHERE id = *Your_Corp_Id*;

@Caffe1neAdd1ct
Copy link
Contributor

@Lynx005F I just uploaded this to our hosted version and the toggles started working, the only caveat is the toggles don't update showing the saved values until you refresh the whole page and go back into the accounts section. If you save, close accounts, open accounts it will show the old value still (appearing not to have worked).

The database table can be updated, just look for the shared column on character, corporation, alliance tables.

@exodus4d exodus4d mentioned this issue Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants