Fix automatic subscription
Made through the form of sending a message
This commit is contained in:
parent
3fcf2b1068
commit
38be73b0a7
5 changed files with 50 additions and 11 deletions
|
@ -278,6 +278,14 @@ class Post extends Page
|
|||
$this->user->last_post = $now;
|
||||
$this->c->users->update($this->user);
|
||||
|
||||
if ('1' == $this->c->config->o_topic_subscriptions) { // ????
|
||||
if ($v->subscribe && ! $topic->is_subscribed) {
|
||||
$this->c->subscriptions->subscribe($this->user, $topic);
|
||||
} elseif (! $v->subscribe && $topic->is_subscribed) {
|
||||
$this->c->subscriptions->unsubscribe($this->user, $topic);
|
||||
}
|
||||
}
|
||||
|
||||
if ($merge) {
|
||||
$this->c->search->index($lastPost, 'merge');
|
||||
} else {
|
||||
|
@ -285,15 +293,6 @@ class Post extends Page
|
|||
|
||||
if ($createTopic) {
|
||||
if ('1' == $this->c->config->o_forum_subscriptions) { // ????
|
||||
// автоподписка на свою тему
|
||||
if (
|
||||
'1' == $this->c->config->o_topic_subscriptions
|
||||
&& $this->user->auto_notify
|
||||
&& $this->user->email_confirmed
|
||||
) {
|
||||
$this->c->subscriptions->subscribe($this->user, $topic);
|
||||
}
|
||||
|
||||
$this->c->subscriptions->send($post, $topic);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -134,6 +134,7 @@ trait PostFormTrait
|
|||
'checked' => isset($vars['merge_post']) ? (bool) $vars['merge_post'] : true,
|
||||
];
|
||||
}
|
||||
|
||||
if (
|
||||
$editPost
|
||||
&& ! $model->user->isGuest
|
||||
|
@ -147,6 +148,33 @@ trait PostFormTrait
|
|||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
! $editPost
|
||||
&& '1' == $this->c->config->o_topic_subscriptions
|
||||
&& $this->user->email_confirmed
|
||||
) {
|
||||
$subscribed = ! $editSubject && $model->is_subscribed;
|
||||
|
||||
if ($quickReply) {
|
||||
if (
|
||||
$subscribed
|
||||
|| $this->user->auto_notify
|
||||
) {
|
||||
$form['hidden']['subscribe'] = '1';
|
||||
}
|
||||
} else {
|
||||
$fieldset['subscribe'] = [
|
||||
'type' => 'checkbox',
|
||||
'label' => $subscribed ? __('Stay subscribed') : __('New subscribe'),
|
||||
'value' => '1',
|
||||
'checked' => isset($vars['subscribe'])
|
||||
? (bool) $vars['subscribe']
|
||||
: ($subscribed || $this->user->auto_notify),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
! $quickReply
|
||||
&& '1' == $this->c->config->o_smilies
|
||||
|
@ -158,6 +186,7 @@ trait PostFormTrait
|
|||
'checked' => isset($vars['hide_smilies']) ? (bool) $vars['hide_smilies'] : false,
|
||||
];
|
||||
}
|
||||
|
||||
if ($fieldset) {
|
||||
$form['sets']['sett'] = [
|
||||
'legend' => __('Options'),
|
||||
|
|
|
@ -156,6 +156,16 @@ trait PostValidatorTrait
|
|||
$ruleSubject = 'absent';
|
||||
}
|
||||
|
||||
if (
|
||||
! $editPost
|
||||
&& '1' == $this->c->config->o_topic_subscriptions
|
||||
&& $this->user->email_confirmed
|
||||
) {
|
||||
$ruleSubscribe = 'checkbox';
|
||||
} else {
|
||||
$ruleSubscribe = 'absent';
|
||||
}
|
||||
|
||||
if ('1' == $this->c->config->o_smilies) {
|
||||
$ruleHideSmilies = 'checkbox';
|
||||
} else {
|
||||
|
@ -177,6 +187,7 @@ trait PostValidatorTrait
|
|||
'merge_post' => $ruleMergePost,
|
||||
'hide_smilies' => $ruleHideSmilies,
|
||||
'edit_post' => $ruleEditPost,
|
||||
'subscribe' => $ruleSubscribe,
|
||||
'preview' => 'string',
|
||||
'submit' => 'string|check_timeout',
|
||||
'message' => 'required|string:trim|max:' . $this->c->MAX_POST_SIZE . '|check_message',
|
||||
|
|
|
@ -66,7 +66,7 @@ msgstr "Post new topic"
|
|||
msgid "Hide smilies"
|
||||
msgstr "Never show smilies as icons for this post"
|
||||
|
||||
msgid "Subscribe"
|
||||
msgid "New subscribe"
|
||||
msgstr "Subscribe to this topic"
|
||||
|
||||
msgid "Stay subscribed"
|
||||
|
|
|
@ -66,7 +66,7 @@ msgstr "Публикация новой темы"
|
|||
msgid "Hide smilies"
|
||||
msgstr "Никогда не показывать смайлы в виде картинок в этом сообщении"
|
||||
|
||||
msgid "Subscribe"
|
||||
msgid "New subscribe"
|
||||
msgstr "Подписаться на эту тему"
|
||||
|
||||
msgid "Stay subscribed"
|
||||
|
|
Loading…
Add table
Reference in a new issue