fixs
This commit is contained in:
parent
381262b121
commit
44deaa9ed9
27
Chat.go
27
Chat.go
@ -686,6 +686,7 @@ func GenerateConversationPopoverHTML(isActive bool) string {
|
||||
SELECT Conversation {
|
||||
name,
|
||||
position,
|
||||
selected,
|
||||
id
|
||||
}
|
||||
FILTER .user = global currentUser
|
||||
@ -818,7 +819,31 @@ func SelectConversationHandler(c *fiber.Ctx) error {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
edgeClient = edgeClient.WithGlobals(map[string]interface{}{"ext::auth::client_token": c.Cookies("jade-edgedb-auth-token"), "currentConversationID": conversationUUID})
|
||||
err = edgeClient.Execute(edgeCtx, `
|
||||
UPDATE Conversation
|
||||
FILTER .user = global currentUser
|
||||
SET {
|
||||
selected := false
|
||||
};
|
||||
`, conversationUUID)
|
||||
if err != nil {
|
||||
fmt.Println("Error unselecting conversations")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = edgeClient.Execute(edgeCtx, `
|
||||
UPDATE Conversation
|
||||
FILTER .user = global currentUser AND .id = <uuid>$0
|
||||
SET {
|
||||
selected := true
|
||||
};
|
||||
`, conversationUUID)
|
||||
if err != nil {
|
||||
fmt.Println("Error selecting conversations")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
edgeClient = edgeClient.WithoutGlobals().WithGlobals(map[string]interface{}{"ext::auth::client_token": c.Cookies("jade-edgedb-auth-token")})
|
||||
|
||||
return c.SendString(generateChatHTML())
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ type Setting struct { // Per user
|
||||
type Conversation struct {
|
||||
ID edgedb.UUID `edgedb:"id"`
|
||||
Name string `edgedb:"name"`
|
||||
Selected bool `edgedb:"selected"`
|
||||
Position int32 `edgedb:"position"`
|
||||
Date time.Time `edgedb:"date"`
|
||||
User User `edgedb:"user"`
|
||||
|
5
login.go
5
login.go
@ -78,8 +78,7 @@ func getGoogleUserProfile(providerToken string) (string, string, string) {
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
fmt.Println("Error fetching user profile")
|
||||
panic(err)
|
||||
panic("Error fetching user profile")
|
||||
}
|
||||
|
||||
body, err = io.ReadAll(resp.Body)
|
||||
@ -101,7 +100,7 @@ func getGitHubUserProfile(providerToken string) (string, string, string) {
|
||||
// Create the request to fetch the user profile
|
||||
req, err := http.NewRequest("GET", "https://api.github.com/user", nil)
|
||||
if err != nil {
|
||||
fmt.Println("failed to create request: %v", err)
|
||||
fmt.Println("failed to create request: user profile")
|
||||
panic(err)
|
||||
}
|
||||
req.Header.Set("Authorization", "Bearer "+providerToken)
|
||||
|
@ -1,7 +1,3 @@
|
||||
body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="chat-container mt-5">
|
||||
<div class="chat-container mt-5" style="padding-bottom: 155px;">
|
||||
<hx hx-get="/loadChat" hx-trigger="load once" hx-swap="outerHTML"></hx>
|
||||
|
||||
{% if IsSubscribed or not IsLimiteReached %}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="dropdown-item">
|
||||
<div id="conversation-list">
|
||||
{% for Conversation in Conversations %}
|
||||
<div class="icon-text has-text unselected icon-conv {% if Conversation.Name == 'Default' %} selected {% endif %}"
|
||||
<div class="icon-text has-text unselected icon-conv {% if Conversation.Selected %} selected {% endif %}"
|
||||
data-id="{{ Conversation.ID.String() }}" style="cursor: pointer;"
|
||||
onclick="toggleConversationSelection(this)"
|
||||
hx-get="/selectConversation?conversation-id={{ Conversation.ID.String() }}" hx-swap="outerHTML"
|
||||
|
Loading…
x
Reference in New Issue
Block a user