~migadu/alps#96: 
function "join" not defined

Starting alps for my server using go run ./cmd/alps z3ntu.xyz results in the error message

FATAL failed to load templates: failed to load theme "alps": template: update-address-object.html:29: function "join" not defined

I see that the join template function gets defined in plugins/carddav/plugin.go and I'm not sure but I think the carddav plugin doesn't get loaded for me so this function which is used in the base theme isn't defined.

Status
RESOLVED FIXED
Submitter
~z3ntu
Assigned to
No-one
Submitted
1 year, 6 months ago
Updated
1 year, 6 months ago
Labels
bug

~z3ntu 1 year, 6 months ago

Actually reading the log is also useful: the carddav and caldav plugins don't load for me (missing configuration) which is why the function never gets defined.

2020-05-21T21:37:46Z - Configured upstream IMAP server: imaps://mail.z3ntu.xyz:993
2020-05-21T21:37:46Z - Configured upstream SMTP server: smtp://mail.z3ntu.xyz:25
2020-05-21T21:37:46Z - Loaded plugin "base"
2020-05-21T21:37:46Z - caldav: failed to discover CalDAV server: discovery not yet implemented
2020-05-21T21:37:46Z - carddav: failed to discover CardDAV server: carddav: domain doesn't have an SRV record
2020-05-21T21:37:46Z - Loaded plugin "viewhtml"
2020-05-21T21:37:46Z - Loaded plugin "viewtext"
2020-05-21T21:37:46Z - Loading theme "alps"
2020-05-21T21:37:46Z FATAL failed to load templates: failed to load theme "alps": template: update-address-object.html:29: function "join" not defined
exit status 1

~emersion 1 year, 6 months ago

Ah indeed that makes sense. I forgot that Go checks functions at template compile-time.

Not sure how to fix this.

~gjnoonan 1 year, 5 months ago

I got hit by this one too, to get past it I changed the join function call to a slice. The next error it then throws up is for the functions formatinputdate and formatinputtime as a temporary measure I just copied the functions into the base plugin template.go in order to get it running. I've been mulling over the best way to address it before sending in a patch.

I can send a simple patch for join -> slice as a start if you'd be happy with that though.

~emersion REPORTED UNRESOLVED 1 year, 5 months ago

Pushed a workaround. Opened https://todo.sr.ht/~emersion/alps/99 to figure out a proper solution.

Register here or Log in to comment, or comment via email.