Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Den dev #74

Merged
merged 14 commits into from
Dec 24, 2023
Merged

Den dev #74

merged 14 commits into from
Dec 24, 2023

Conversation

TartuDen
Copy link
Collaborator

No description provided.

@TartuDen
Copy link
Collaborator Author

the work on last commit is still in progress. Adding buttons to edit delete main topic (thread)

Copy link
Owner

@Pomog Pomog left a comment

Choose a reason for hiding this comment

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

m.PostLen
we have AppConfig struct

// Repository handles the repository type, encapsulating the AppConfig and DatabaseInt dependencies.
type Repository struct {
App *config.AppConfig
DB repository.DatabaseInt
}

I an on internal/handler/themeHandler.go now

if len(post.Content) > 1500 { lets aslo store this value in settings, and all value like :1<<20, 2<<20

func AttachFile(w http.ResponseWriter, r *http.Request, post *models.Post, thread *models.Thread) {
	// ADD IMAGE TO STATIC_________________________
	// Get the file from the form data
	file, handler, errFileGet := r.FormFile("image")
	if errFileGet == nil {
		defer file.Close()

		// Validate file size (1 MB limit)
		if handler.Size > 2<<20 {
			setErrorAndRedirect(w, r, "File size should be below 2 MB", "/error-page")
			return
		}

post *models.Post, thread *models.Thread - This is strange

1 mb != 2<<20
// Validate file size (1 MB limit)
if handler.Size > 2<<20 {

internal/handler/staticHelperHendlers.go
// Repository handles the repository type, encapsulating the AppConfig and DatabaseInt dependencies.

too many changes - no coments
I an on internal/handler/staticHelperHendlers.go now

Copy link
Owner

@Pomog Pomog left a comment

Choose a reason for hiding this comment

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

This branch has conflicts that must be resolved
Use the web editor or the to resolve conflicts.
Conflicting files
internal/handler/themeHandler.go
internal/repository/sql.go

Copy link
Owner

@Pomog Pomog left a comment

Choose a reason for hiding this comment

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

internal/handler/t

// Validate file size (1 MB limit)
if handler.Size > 2<<20 {hemeHandler.go

// Create a new file in the "static/post_images" directory
newFilePath := filepath.Join("static/post_images", handler.Filename)

this is image for the theme?

internal/repository/dbrepo/sqllite.go

	if len(post.Content) > 2500 {
		return errors.New("the post is to long, 2500 syblos allowed")

previously it was 1500? why here is 2500?

template/home.page.html
did you manage to format the time?

template/theme.page.html
Image: (Max 20 MB), allowed formats jpeg, png, gif.
20 mb is it true?

@TartuDen
Copy link
Collaborator Author

did you manage to format the time?
i'm not really sure where and how to do it, can you check and give some suggestions?

@Pomog
Copy link
Owner

Pomog commented Dec 24, 2023

image
image
time format example

info.Created = thread.Created.Format("2006-01-02 15:04:05")

@TartuDen
Copy link
Collaborator Author

finished. Description is in commit comment.
issues remained:

  1. I could not make so edit/delete button is visible only for creator of post/topic. Due to the way our template is parsed inside the html. Cannot have 2 variables "userIDCreatedPost" and "loggedUserID", to compare them with {{if eq ... }} statement.
  2. We discussed - when post is created, by restarting the page we duplicate it. EVERY POST request must be redirected" at the end. This work requires like additional at least one day of work. Can be done during next "dop" for forum.

@Pomog Pomog merged commit cf487b0 into main Dec 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants