Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions internal/pkg/apps/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func Install(ctx context.Context, clients *shared.ClientFactory, auth types.Slac
}
}
if iconPath != "" {
err = updateIcon(ctx, clients, iconPath, app.AppID, token)
err = updateIcon(ctx, clients, iconPath, app.AppID, token, manifest.IsFunctionRuntimeSlackHosted())
if err != nil {
clients.IO.PrintDebug(ctx, "icon error: %s", err)
_, _ = clients.IO.WriteOut().Write([]byte(style.SectionSecondaryf("Error updating app icon: %s", err)))
Expand Down Expand Up @@ -650,16 +650,18 @@ func appendLocalToDisplayName(manifest *types.AppManifest) {
}

// updateIcon will upload the new icon to the Slack API
func updateIcon(ctx context.Context, clients *shared.ClientFactory, iconPath, appID string, token string) error {
func updateIcon(ctx context.Context, clients *shared.ClientFactory, iconPath, appID string, token string, isHosted bool) error {
var span opentracing.Span
span, ctx = opentracing.StartSpanFromContext(ctx, "updateIcon")
defer span.Finish()

var err error
if clients.Config.WithExperimentOn(experiment.SetIcon) {
_, err = clients.API().IconSet(ctx, clients.Fs, token, appID, iconPath)
} else {
} else if isHosted {
_, err = clients.API().Icon(ctx, clients.Fs, token, appID, iconPath)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_, err = clients.API().Icon(ctx, clients.Fs, token, appID, iconPath)
// DEPRECATED: Prefer IconSet once the SetIcon experiment concludes
_, err = clients.API().Icon(ctx, clients.Fs, token, appID, iconPath)

🪬 suggestion(non-blocking): The order of conditionals is solid but we can leave breadcrumbs more to save confusion in upcoming changes. Personal preference though!

} else {
return nil
}
if err != nil {
// TODO: separate the icon upload into a different function because if an error is returned
Expand Down
Loading