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

Can't publish a newResearch Note #4714

Closed
edieblu opened this issue Jan 27, 2019 · 18 comments
Closed

Can't publish a newResearch Note #4714

edieblu opened this issue Jan 27, 2019 · 18 comments
Assignees
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed inspection

Comments

@edieblu
Copy link
Collaborator

edieblu commented Jan 27, 2019

Steps to reproduce:

Navigate to https://publiclab.org/post and after filling in the required fields, hit publish.

Expected behavior:

The research note is published. 

Actual behavior:

Nothing happens. Attaching the console errors here.

screenshot 2019-01-27 at 19 18 20

@edieblu edieblu assigned edieblu and jywarren and unassigned edieblu Jan 27, 2019
@grvsachdeva grvsachdeva added bug the issue is regarding one of our programs which faces problems when a certain task is executed inspection labels Jan 27, 2019
@grvsachdeva
Copy link
Member

Hi @edieblu, thanks for reporting the issue with such descriptive steps.

@jywarren I think, PublicLab.editor integration is not properly working as the editor instance isn't created resulting in "cannot read property titleModule of undefined".

Thanks!

@jywarren
Copy link
Member

jywarren commented Jan 28, 2019 via email

@rexagod rexagod self-assigned this Jan 28, 2019
@jywarren
Copy link
Member

Can we get a line number for the editor error, I wonder if it's due to the changes to the "steps left" code?

@jywarren
Copy link
Member

jywarren commented Jan 28, 2019

Hmmm maybe not as that was only 24 h ago...

Fix Publish button disabled state
Closed by jywarren about 24 hours ago

publiclab/PublicLab.Editor#252

@jywarren
Copy link
Member

And perhaps we can try to replicate it on stable.publiclab.org...

@jywarren
Copy link
Member

Hi @edieblu, do you think you could share the post text in a fist at https://gist.github.com and paste the link here? Sorry for all the trouble, we're just trying to track this down. Thanks!

@jywarren
Copy link
Member

@sagarpreet-chadha is there a possibility that this could be related to needing additional dependencies for the new map module? See above errors... I'm trying to reproduce.

@jywarren
Copy link
Member

Aha! I believe the error is related to not loading the Google geocoding library. Not sure why it's not loading but it is a dependency of the new Editor map module.

I tracked it to here, but I think that's just the symptom of the true cause:

$.getJSON("/api/srch/notes?query=" + editor.titleModule.value(), function(response) {

@jywarren
Copy link
Member

Aha! I believe the error is related to not loading the Google geocoding library. Not sure why it's not loading but it is a dependency of the new Editor map module.

I tracked it to here, but I think that's just the symptom of the true cause:

$.getJSON("/api/srch/notes?query=" + editor.titleModule.value(), function(response) {

OK, it seems to relate to how we don't include the Google API here:

<!-- required for MapModule -->
  | <!-- <script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyDWgc7p4WWFsO3y0MTe50vF4l4NUPcPuwE"></script> -->

OK, i think it's in /app/views/editor/rich.html.erb but not active. It's in the footer but not being activated early enough as @sagarpreet-chadha has noted. Trying to move it to the top.

@rexagod
Copy link
Member

rexagod commented Jan 28, 2019

That would explain why none of the footer buttons seem to work.

@jywarren
Copy link
Member

This was saved in a db-backed feature -- we have features in both header and footer so i just moved it. Will do same on stable and check there too.

@rexagod
Copy link
Member

rexagod commented Jan 28, 2019

I did have a hunch about the mapModule causing this since that was the last major addition to the repo and the logs too indicated the same. "google" is not defined was a straight indication to the scripts not being loaded. 🤔

@jywarren
Copy link
Member

OK it's live on production and @edieblue you should be able to post now although i haven't confirmed this myself.

@rexagod
Copy link
Member

rexagod commented Jan 28, 2019

@jywarren It's working now. 👍

@jywarren
Copy link
Member

Great. Closing this! Also noting that:

  1. we should try to do our testing on https://stable.publiclab.org when possible
  2. this was a tough one to catch because we are trying to keep the Google Maps API key configurable and not git-tracked, so it didn't show up in development mode.
  3. i was thinking of how we could test for this bug in the future but as it's due to a dependency i think i'm less worried about this now.

Finally, if anyone has thoughts on running tests of some kind i haven't thought of that /could/ guard against this in the future, i'm all ears!!!

@edieblu
Copy link
Collaborator Author

edieblu commented Jan 29, 2019

Works great @jywarren, thanks for the fix! 👍

@sagarpreet-chadha
Copy link
Contributor

Apologies for late reply 😄 !

I had faced the same error in console when i was working on mapmodule integration , referencing that comment here for future tracking : #4608 (comment)

Instead of adding the if condition in _footer.html.erb , can i add that if condition here ?
When used in footer , the Google API gave - google not found error and when adding an explicit script tag to the page - it gave - 'google api used two times , may give unexpected error' .

So i finally removed the google API script everywhere AND kept it here . What do you think ?

@jywarren
Copy link
Member

jywarren commented Jan 29, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed inspection
Projects
None yet
Development

No branches or pull requests

5 participants