Options here were: make the get-token thread try to return a unit, or
write a different thread to check whether GCP Storage seemed to be
configured and poll on that thread, or move the whole thing into a Gall
app.
The compromise between time-to-implement and overall cleanliness seemed
to be to write a different thread that just checks whether the settings
fields have been poked. Unfortunately this means GcpManager is now a
somewhat hefty JavaScript state machine.
Took out the logic to check whether S3 was configured in GcpManager,
since it was really only there to prevent spamming the console with
500s. If you have both S3 and GCP Storage configured for some reason,
you will now use GCP per the logic in useStorage.
s3.credentials is always set, but the fields are all '' if s3 is not
configured. So prior to this change, if the user had configured an
active bucket, they would always be shown an upload dialog even if they
had no storage configured.
GcpApi now acts like other APIs.
Since GcpManager can no longer get at the token exipry by inspecting the
raw update, it must depend on the global store instead. This also means
it can check whether the user has configured S3, and not try to refresh
the token in that case.
In the case where no storage is configured, this will spam the console
with request failures since the thread returns 500 if there is no token.
Perhaps this is a good argument for making the thread return a unit.
Also make it type-level optional rather than using explicit null.
Perhaps one day we will want to use undefined to denote "the thread
hasn't returned yet" and null for "GCP Storage is not configured."
Perhaps.
The S3 client has another layer of indirection we missed. To support it
expediently, we just make the promise() method on GcpUpload do all the
work in GcpClient.
On mobile devices, long channel names can push the menu offscreen.
However, we don't want the title to be shrunk by a long description.
We want the description to shrink first.
So we set flex-shrink priorities, and also don't let the title shrink
on desktop.