Compare commits
No commits in common. "04d1970dc0adfdd9a4724838bbe3d965b2ae6e79" and "da7599edf2c235d40149bca21d374d5b9bb8978a" have entirely different histories.
04d1970dc0
...
da7599edf2
@ -3,9 +3,6 @@ package services
|
|||||||
import (
|
import (
|
||||||
"code.smartsheep.studio/hydrogen/interactive/pkg/database"
|
"code.smartsheep.studio/hydrogen/interactive/pkg/database"
|
||||||
"code.smartsheep.studio/hydrogen/interactive/pkg/models"
|
"code.smartsheep.studio/hydrogen/interactive/pkg/models"
|
||||||
"fmt"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func FollowAccount(followerId, followingId uint) error {
|
func FollowAccount(followerId, followingId uint) error {
|
||||||
@ -31,23 +28,3 @@ func GetAccountFollowed(user models.Account, target models.Account) (models.Acco
|
|||||||
Error
|
Error
|
||||||
return relationship, err == nil
|
return relationship, err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NotifyAccount(user models.Account, subject, content string, links ...fiber.Map) error {
|
|
||||||
agent := fiber.Post(viper.GetString("passport.endpoint") + "/api/dev/notify")
|
|
||||||
agent.JSON(fiber.Map{
|
|
||||||
"client_id": viper.GetString("passport.client_id"),
|
|
||||||
"client_secret": viper.GetString("passport.client_secret"),
|
|
||||||
"subject": subject,
|
|
||||||
"content": content,
|
|
||||||
"links": links,
|
|
||||||
"user_id": user.ExternalID,
|
|
||||||
})
|
|
||||||
|
|
||||||
if status, body, errs := agent.Bytes(); len(errs) > 0 {
|
|
||||||
return errs[0]
|
|
||||||
} else if status != 200 {
|
|
||||||
return fmt.Errorf(string(body))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
@ -3,8 +3,6 @@ package services
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.smartsheep.studio/hydrogen/interactive/pkg/database"
|
"code.smartsheep.studio/hydrogen/interactive/pkg/database"
|
||||||
@ -176,26 +174,6 @@ func NewPost(
|
|||||||
return post, err
|
return post, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if post.ReplyID != nil {
|
|
||||||
var op models.Post
|
|
||||||
if err := database.C.Where(&models.Post{
|
|
||||||
BaseModel: models.BaseModel{ID: *post.ReplyID},
|
|
||||||
}).Preload("Author").First(&op).Error; err == nil {
|
|
||||||
if op.Author.ID != user.ID {
|
|
||||||
postUrl := fmt.Sprintf("https://%s/posts/%d", viper.GetString("domain"), post.ID)
|
|
||||||
err := NotifyAccount(
|
|
||||||
op.Author,
|
|
||||||
fmt.Sprintf("%s replied you", user.Name),
|
|
||||||
fmt.Sprintf("%s replied your post. Check it out!", user.Name),
|
|
||||||
fiber.Map{"label": "Related post", "url": postUrl},
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
log.Error().Err(err).Msg("An error occurred when notifying user...")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return post, nil
|
return post, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export default function PostItem(props: {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="post-item">
|
<div class="post-item max-w-screen">
|
||||||
<Show when={!props.noAuthor}>
|
<Show when={!props.noAuthor}>
|
||||||
<a href={`/accounts/${props.post.author.name}`}>
|
<a href={`/accounts/${props.post.author.name}`}>
|
||||||
<div class="flex bg-base-200">
|
<div class="flex bg-base-200">
|
||||||
|
@ -13,13 +13,4 @@ html, body {
|
|||||||
|
|
||||||
.medium-zoom-overlay {
|
.medium-zoom-overlay {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
|
||||||
|
|
||||||
.scrollbar-hidden {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollbar-hidden::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
width: 0;
|
|
||||||
}
|
}
|
@ -54,7 +54,7 @@ export default function RootLayout(props: any) {
|
|||||||
<Navbar />
|
<Navbar />
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<main class={`${mainContentStyles()} scrollbar-hidden`}>{props.children}</main>
|
<main class={mainContentStyles()}>{props.children}</main>
|
||||||
</Show>
|
</Show>
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
.wrapper {
|
.wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: fit-content(100%);
|
grid-template-columns: 1fr;
|
||||||
column-gap: 20px;
|
column-gap: 20px;
|
||||||
|
|
||||||
max-height: calc(100vh - 64px);
|
max-height: calc(100vh - 64px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
@media (min-width: 768px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
grid-template-columns: 1fr 2fr 1fr;
|
grid-template-columns: 1fr 2fr 1fr;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ export default function DashboardPage(props: any) {
|
|||||||
<div class={`${styles.wrapper} container mx-auto`}>
|
<div class={`${styles.wrapper} container mx-auto`}>
|
||||||
<div id="trending" class="card shadow-xl h-fit"></div>
|
<div id="trending" class="card shadow-xl h-fit"></div>
|
||||||
|
|
||||||
<div id="content max-w-screen" class="card shadow-xl">
|
<div id="content" class="card shadow-xl">
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user