Created
April 8, 2021 01:53
-
-
Save xNok/5329c04042c607d3e6f01570422c7610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func AppHomeCreateStickieNote(note StickieNote) slack.HomeTabViewRequest { | |
// Base elements | |
str, err := appHomeAssets.ReadFile("appHomeViewsAssets/AppHomeView.json") | |
if err != nil { | |
log.Printf("Unable to read view `AppHomeView`: %v", err) | |
} | |
view := slack.HomeTabViewRequest{} | |
json.Unmarshal(str, &view) | |
// New Notes | |
t, err := template.ParseFS(appHomeAssets, "appHomeViewsAssets/NoteBlock.json") | |
if err != nil { | |
panic(err) | |
} | |
var tpl bytes.Buffer | |
err = t.Execute(&tpl, note) | |
if err != nil { | |
panic(err) | |
} | |
str, _ = ioutil.ReadAll(&tpl) | |
note_view := slack.HomeTabViewRequest{} | |
json.Unmarshal(str, ¬e_view) | |
view.Blocks.BlockSet = append(view.Blocks.BlockSet, note_view.Blocks.BlockSet...) | |
return view | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment