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

Add Write Form Feature #40

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Add Write Form Feature #40

wants to merge 4 commits into from

Conversation

Xialtal
Copy link
Collaborator

@Xialtal Xialtal commented Mar 23, 2025

No description provided.

switch type {
case .simple(let content, _):
state.textContent = content
return .send(._formResponse(.success([
Copy link
Owner

Choose a reason for hiding this comment

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

Что тут происходит конкретно

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Смотреть нужно с момента в TopicFeature:

case .reply(let authorId, let authorName):
     state.writeForm = WriteFormFeature.State(formFor: .post(
          topicId: state.topicId,
          content: .simple("[SNAPBACK]\(authorId)[/SNAPBACK] [B]\(authorName)[/B], ", [])
      ))

Тут мы передаем в content: snapback для ответа пользователю на его пост, и далее в выделенном тобой участке кода мы записываем как раз таки его ("[SNAPBACK]\(authorId)[/SNAPBACK] [B]\(authorName)[/B], ") в state.textContent, который используется для хранения данных в поле для ответа.
Короче сделано это, чтобы наш снапбэк или любое другое содержимое (в будущем например цитата) не терялось, а было уже по умолчанию в поле ввода текста.

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