commit
7fcfe6a283
|
@ -178,7 +178,7 @@ class TicketEvent extends React.Component {
|
|||
renderPrivateBadge() {
|
||||
return (
|
||||
<span className="ticket-event__comment-badge-container">
|
||||
<Tooltip content={i18n('PRIVATE_DESCRIPTION')} openOnHover>
|
||||
<Tooltip content={i18n('PRIVATE_RESPONSE_DESCRIPTION')} openOnHover>
|
||||
<span className="ticket-event__comment-badge">{i18n('PRIVATE')}</span>
|
||||
</Tooltip>
|
||||
</span>
|
||||
|
|
|
@ -272,7 +272,7 @@ class TicketViewer extends React.Component {
|
|||
return (
|
||||
<div className="ticket-viewer__response-private">
|
||||
<FormField label={i18n('PRIVATE')} name="private" field="checkbox"/>
|
||||
<InfoTooltip className="ticket-viewer__response-private-info" text={i18n('PRIVATE_DESCRIPTION')} />
|
||||
<InfoTooltip className="ticket-viewer__response-private-info" text={i18n('PRIVATE_RESPONSE_DESCRIPTION')} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ import FormField from 'core-components/form-field';
|
|||
import SubmitButton from 'core-components/submit-button';
|
||||
import IconSelector from 'core-components/icon-selector';
|
||||
import ColorSelector from 'core-components/color-selector';
|
||||
import InfoTooltip from 'core-components/info-tooltip';
|
||||
|
||||
class TopicEditModal extends React.Component {
|
||||
|
||||
|
@ -24,7 +25,7 @@ class TopicEditModal extends React.Component {
|
|||
};
|
||||
|
||||
state = {
|
||||
values: this.props.defaultValues || {title: '', icon: 'address-card', color: '#ff6900'},
|
||||
values: this.props.defaultValues || {title: '', icon: 'address-card', color: '#ff6900', private: false},
|
||||
loading: false
|
||||
};
|
||||
|
||||
|
@ -36,7 +37,9 @@ class TopicEditModal extends React.Component {
|
|||
<FormField name="title" label={i18n('TITLE')} fieldProps={{size: 'large'}} validation="TITLE" required />
|
||||
<FormField name="icon" className="topic-edit-modal__icon" label={i18n('ICON')} decorator={IconSelector} />
|
||||
<FormField name="color" className="topic-edit-modal__color" label={i18n('COLOR')} decorator={ColorSelector} />
|
||||
|
||||
<FormField className="topic-edit-modal__private" label={i18n('PRIVATE')} name="private" field="checkbox"/>
|
||||
<InfoTooltip className="topic-edit-modal__private" text={i18n('PRIVATE_TOPIC_DESCRIPTION')} />
|
||||
|
||||
<SubmitButton className="topic-edit-modal__save-button" type="secondary" size="small">
|
||||
{i18n('SAVE')}
|
||||
</SubmitButton>
|
||||
|
@ -59,7 +62,8 @@ class TopicEditModal extends React.Component {
|
|||
topicId: this.props.topicId,
|
||||
name: this.state.values['title'],
|
||||
icon: this.state.values['icon'],
|
||||
iconColor: this.state.values['color']
|
||||
iconColor: this.state.values['color'],
|
||||
private: this.state.values['private']*1
|
||||
}
|
||||
}).then(() => {
|
||||
this.context.closeModal();
|
||||
|
|
|
@ -16,4 +16,8 @@
|
|||
&__discard-button {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
&__private {
|
||||
display: inline-block;
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ class TopicViewer extends React.Component {
|
|||
iconColor: React.PropTypes.string.isRequired,
|
||||
articles: React.PropTypes.array.isRequired,
|
||||
articlePath: React.PropTypes.string,
|
||||
editable: React.PropTypes.bool
|
||||
editable: React.PropTypes.bool,
|
||||
private: React.PropTypes.bool
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -53,6 +54,8 @@ class TopicViewer extends React.Component {
|
|||
<span className="topic-viewer__title">{this.props.name}</span>
|
||||
{(this.props.editable) ? this.renderEditButton() : null}
|
||||
{(this.props.editable) ? this.renderDeleteButton() : null}
|
||||
{this.props.private*1 ? <Icon className="topic-viewer__private" name='user-secret' color='grey'/> : null}
|
||||
|
||||
</div>
|
||||
<ul className="topic-viewer__list">
|
||||
{this.state.articles.map(this.renderArticleItem.bind(this))}
|
||||
|
@ -127,7 +130,8 @@ class TopicViewer extends React.Component {
|
|||
defaultValues: {
|
||||
title: this.props.name,
|
||||
icon: this.props.icon,
|
||||
iconColor: this.props.iconColor
|
||||
iconColor: this.props.iconColor,
|
||||
private: false
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -148,7 +152,7 @@ class TopicViewer extends React.Component {
|
|||
<ArticleAddModal {...props}/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
getArticleLinkProps(article) {
|
||||
let classes = {
|
||||
'topic-viewer__list-item-button': true,
|
||||
|
@ -265,4 +269,4 @@ class TopicViewer extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default TopicViewer;
|
||||
export default TopicViewer;
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
margin-left: 15px;
|
||||
}
|
||||
|
||||
&__private {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
&__edit-icon {
|
||||
color: $grey;
|
||||
cursor: pointer;
|
||||
|
@ -78,4 +82,4 @@
|
|||
&__add-item {
|
||||
color: $dark-grey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@ class AdminPanelListArticles extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default AdminPanelListArticles;
|
||||
export default AdminPanelListArticles;
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'A configuração do servidor SMTP permite que o aplicativo envie e-mails. Se você não configurá-lo, nenhum e-mail será enviado pela OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Essa ação permite que o usuário faça login e crie tickets.',
|
||||
'DISABLE_USER_DESCRIPTION': 'O usuário será desativado e não poderá fazer login e criar tickets.',
|
||||
'PRIVATE_DESCRIPTION': 'Esta resposta só será vista pelos funcionários',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Esta resposta só será vista pelos funcionários',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Este tópico será visto apenas por membros da equipe',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'E-mail ou senha inválidos',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'SMTP服务器允许应用程序发送邮件。 如果您没有配置,OpenSupports将不会发送任何电子邮件。',
|
||||
'ENABLE_USER_DESCRIPTION': '此操作允许用户登录并创建票证。',
|
||||
'DISABLE_USER_DESCRIPTION': '用户将被禁用,无法登录并创建票证。',
|
||||
'PRIVATE_DESCRIPTION': '只有工作人员才能看到这种回应',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': '只有工作人员才能看到这种回应',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': '只有工作人员才能看到此主题',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': '電子郵件或密碼無效',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'Die Konfiguration des SMTP-Servers ermöglicht es der Software, Mails zu senden. Wenn Sie es nicht konfigurieren, werden keine E-Mails von OpenSupports gesendet.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Mit dieser Aktion kann der Benutzer sich anmelden und Tickets erstellen.',
|
||||
'DISABLE_USER_DESCRIPTION': 'Der Benutzer wird deaktiviert und kann keine Tickets anmelden und erstellen.',
|
||||
'PRIVATE_DESCRIPTION': 'Diese Antwort wird nur von den Mitarbeitern gesehen werden',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Diese Antwort wird nur von den Mitarbeitern gesehen werden',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Dieses Thema wird nur von Mitarbeitern gesehen',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'E-Mail-Adresse oder Passwort ungültig!',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'The configuration of the SMTP server allows the application to send mails. If you do not configure it, no emails will be sent by OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'This action allows the user to sign in and create tickets.',
|
||||
'DISABLE_USER_DESCRIPTION': 'User will be disabled and will not be able to sign in and create tickets.',
|
||||
'PRIVATE_DESCRIPTION': 'This response will only be seen by staff members',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'This response will only be seen by staff members',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'This topic will only be seen by staff members',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'Email or password invalid',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'La configuracion de SMTP permite que la applicacion mande emails. Si no es configurado, ningún mail sera enviado OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Esta acción permite al usuario iniciar sesión y crear tickets..',
|
||||
'DISABLE_USER_DESCRIPTION': 'El usuario estará deshabilitado y no podrá iniciar sesión y crear tickets.',
|
||||
'PRIVATE_DESCRIPTION': 'Esta respuesta solo será vista por los miembros del personal.',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Esta respuesta solo será vista por los miembros del personal.',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Este tema solo será visto por los miembros del personal.',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'Email o contraseña inválida',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'La configuration du serveur SMTP permet à l\'application d\'envoyer des mails. Si vous ne le configurez pas, aucun service d\'email ne sera envoyé par OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Cette action permet à l\'utilisateur de se connecter et de créer des tickets.',
|
||||
'DISABLE_USER_DESCRIPTION': 'L\'utilisateur sera désactivé et ne pourra pas se connecter et créer des tickets.',
|
||||
'PRIVATE_DESCRIPTION': 'Cette réponse ne sera vue que par les membres du personnel',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Cette réponse ne sera vue que par les membres du personnel',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Ce sujet ne sera vu que par les membres du personnel',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'E-mail ou mot de passe invalide',
|
||||
|
|
|
@ -305,7 +305,8 @@
|
|||
'SMTP_SERVER_DESCRIPTION': 'Η διαμόρφωση του διακομιστή SMTP επιτρέπει στην εφαρμογή να στείλει μηνύματα. Αν δεν το ρυθμίσετε, δεν θα σταλούν μηνύματα ηλεκτρονικού ταχυδρομείου από το OpenSupport.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Αυτή η ενέργεια επιτρέπει στο χρήστη να συνδεθεί και να δημιουργήσει εισιτήρια.',
|
||||
'DISABLE_USER_DESCRIPTION': 'Ο χρήστης θα απενεργοποιηθεί και δεν θα μπορέσει να συνδεθεί και να δημιουργήσει εισιτήρια.',
|
||||
'PRIVATE_DESCRIPTION': 'Αυτή η απάντηση θα δει μόνο τα μέλη του προσωπικού',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Αυτή η απάντηση θα δει μόνο τα μέλη του προσωπικού',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Αυτό το θέμα θα προβληθεί μόνο από μέλη του προσωπικού',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'Λάθος ηλεκτρονική διεύθυνση ή κωδικός πρόσβασης',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'एसएमटीपी सर्वर का कॉन्फ़िगरेशन एप्लिकेशन को मेल भेजने की अनुमति देता है। यदि आप इसे कॉन्फ़िगर नहीं करते हैं, तो OpenSupports द्वारा कोई ईमेल नहीं भेजा जाएगा।',
|
||||
'ENABLE_USER_DESCRIPTION': 'यह क्रिया उपयोगकर्ता को साइन इन करने और टिकट बनाने की अनुमति देती है।',
|
||||
'DISABLE_USER_DESCRIPTION': 'उपयोगकर्ता अक्षम कर दिया जाएगा और साइन इन करने और टिकट बनाने में सक्षम नहीं होगा।',
|
||||
'PRIVATE_DESCRIPTION': 'यह प्रतिक्रिया केवल कर्मचारियों के सदस्यों द्वारा देखी जाएगी',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'यह प्रतिक्रिया केवल कर्मचारियों के सदस्यों द्वारा देखी जाएगी',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'यह विषय केवल कर्मचारियों के सदस्यों द्वारा देखा जाएगा',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'ईमेल या पासवर्ड अमान्य',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'La configurazione del server SMTP consente all\'applicazione di inviare messaggi. Se non lo si configura, non verrà inviata alcuna email da OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Questa azione consente all\'utente di accedere e creare ticket.',
|
||||
'DISABLE_USER_DESCRIPTION': 'L\'utente sarà disabilitato e non sarà in grado di accedere e creare biglietti.',
|
||||
'PRIVATE_DESCRIPTION': 'Questa risposta sarà visibile solo ai membri dello staff',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Questa risposta sarà visibile solo ai membri dello staff',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Questo argomento sarà visto solo dai membri dello staff',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'Email o password errate',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'SMTPサーバーの設定により、アプリケーションはメールを送信できます。 これを設定しないと、OpenSupportsから電子メールは送信されません。',
|
||||
'ENABLE_USER_DESCRIPTION': 'これにより、ユーザーはサインインしてチケットを作成できます。',
|
||||
'DISABLE_USER_DESCRIPTION': 'ユーザーは無効になり、ログインしてチケットを作成することはできません。',
|
||||
'PRIVATE_DESCRIPTION': 'スタッフのみがこの回答を見ることができます',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'スタッフのみがこの回答を見ることができます',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'このトピックは、スタッフによってのみ表示されます',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': '電子メールまたはパスワードが無効です',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'De configuratie van de SMTP-server staat het systeem toe om e-mails te verzenden. Als u deze optie niet configureerd, worden er geen e-mails verzonden door OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Met deze actie kan de gebruiker inloggen en tickets maken.',
|
||||
'DISABLE_USER_DESCRIPTION': 'De gebruiker wordt uitgeschakeld en kan zich niet aanmelden en geen tickets maken.',
|
||||
'PRIVATE_DESCRIPTION': 'Dit antwoord is alleen zichtbaar voor personeelsleden',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Dit antwoord is alleen zichtbaar voor personeelsleden',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Dit onderwerp is alleen zichtbaar voor personeelsleden',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'E-mailadres of wachtwoord ongeldig',
|
||||
|
|
|
@ -305,7 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'A configuração do servidor SMTP permite que o aplicativo envie e-mails. Se você não configurá-lo, nenhum e-mail será enviado pela OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Essa ação permite que o usuário faça login e crie tickets.',
|
||||
'DISABLE_USER_DESCRIPTION': 'O usuário será desativado e não poderá fazer login e criar tickets.',
|
||||
'PRIVATE_DESCRIPTION': 'Esta resposta só será vista pelos funcionários',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Esta resposta só será vista pelos funcionários',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Este tópico será visto apenas por membros da equipe',
|
||||
|
||||
//ERRORS
|
||||
'EMAIL_OR_PASSWORD': 'E-mail ou senha inválidos',
|
||||
|
|
|
@ -305,6 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'Конфигурация SMTP-сервера позволяет приложению отправлять письма. Если вы не настроите его, никакие электронные письма не будут отправлены OpenSupports.',
|
||||
'ENABLE_USER_DESCRIPTION': 'Это действие позволяет пользователю входить в систему и создавать билеты.',
|
||||
'DISABLE_USER_DESCRIPTION': 'Пользователь будет отключен и не сможет войти и создать билеты',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Этот ответ будет рассматриваться только сотрудниками',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Эта тема будет видна только сотрудникам',
|
||||
'PRIVATE_DESCRIPTION': 'Этот ответ будет рассматриваться только сотрудниками',
|
||||
|
||||
//ERRORS
|
||||
|
|
|
@ -305,6 +305,8 @@ export default {
|
|||
'SMTP_SERVER_DESCRIPTION': 'SMTP sunucusunun yapılandırması, uygulamanın postalar göndermesine izin verir. Onu yapılandırmazsanız, OpenSupports tarafından hiçbir e-posta gönderilmeyecektir',
|
||||
'ENABLE_USER_DESCRIPTION': 'Bu eylem, kullanıcının giriş yapmasına ve bilet oluşturmasına izin verir.',
|
||||
'DISABLE_USER_DESCRIPTION': 'Kullanıcı devre dışı bırakılacak ve oturum açıp bilet oluşturamayacak.',
|
||||
'PRIVATE_RESPONSE_DESCRIPTION': 'Bu yanıt sadece personel tarafından görülebilir',
|
||||
'PRIVATE_TOPIC_DESCRIPTION': 'Bu konu sadece çalışanlar tarafından görülebilir',
|
||||
'PRIVATE_DESCRIPTION': 'Bu yanıt sadece personel tarafından görülebilir',
|
||||
|
||||
//ERRORS
|
||||
|
|
|
@ -17,6 +17,7 @@ DataValidator::with('CustomValidations', true);
|
|||
* @apiParam {String} name Name of the new topic.
|
||||
* @apiParam {String} icon Icon of the new topic.
|
||||
* @apiParam {String} iconColor Icon's color of the new topic.
|
||||
* @apiParam {Boolean} private Indicates if the topic is not shown to users.
|
||||
*
|
||||
* @apiUse NO_PERMISSION
|
||||
* @apiUse INVALID_NAME
|
||||
|
@ -35,7 +36,7 @@ class AddTopicController extends Controller {
|
|||
'permission' => 'staff_2',
|
||||
'requestData' => [
|
||||
'name' => [
|
||||
'validation' => DataValidator::length(3, 100),
|
||||
'validation' => DataValidator::length(2, 100),
|
||||
'error' => ERRORS::INVALID_NAME
|
||||
]
|
||||
]
|
||||
|
@ -47,7 +48,8 @@ class AddTopicController extends Controller {
|
|||
$topic->setProperties([
|
||||
'name' => Controller::request('name'),
|
||||
'icon' => Controller::request('icon'),
|
||||
'iconColor' => Controller::request('iconColor')
|
||||
'iconColor' => Controller::request('iconColor'),
|
||||
'private' => Controller::request('private') ? 1 : 0
|
||||
]);
|
||||
|
||||
Log::createLog('ADD_TOPIC', $topic->name);
|
||||
|
@ -56,4 +58,4 @@ class AddTopicController extends Controller {
|
|||
'topicId' => $topic->store()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ DataValidator::with('CustomValidations', true);
|
|||
* @apiParam {String} name The new name of the topic. Optional.
|
||||
* @apiParam {String} icon The new icon of the topic. Optional.
|
||||
* @apiParam {String} iconColor The new Icon's color of the topic. Optional.
|
||||
* @apiParam {Boolean} private Indicates if the topic is not shown to users.
|
||||
*
|
||||
* @apiUse NO_PERMISSION
|
||||
* @apiUse INVALID_TOPIC
|
||||
|
@ -56,8 +57,11 @@ class EditTopicController extends Controller {
|
|||
if(Controller::request('icon')) {
|
||||
$topic->icon = Controller::request('icon');
|
||||
}
|
||||
if (Controller::request('private') !== null) {
|
||||
$topic->private = Controller::request('private');
|
||||
}
|
||||
|
||||
$topic->store();
|
||||
Response::respondSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ DataValidator::with('CustomValidations', true);
|
|||
* @apiPermission any or user
|
||||
*
|
||||
* @apiUse NO_PERMISSION
|
||||
*
|
||||
*
|
||||
* @apiSuccess {[Topic](#api-Data_Structures-ObjectTopic)[]} data Array of topics.
|
||||
*/
|
||||
|
||||
|
@ -33,11 +33,15 @@ class GetAllArticlesController extends Controller {
|
|||
public function handler() {
|
||||
$topics = Topic::getAll();
|
||||
$topicsArray = [];
|
||||
|
||||
|
||||
foreach($topics as $topic) {
|
||||
$topicsArray[] = $topic->toArray();
|
||||
if (Controller::isStaffLogged()) {
|
||||
$topicsArray[] = $topic->toArray();
|
||||
} else if (!$topic->private) {
|
||||
$topicsArray[] = $topic->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Response::respondSuccess($topicsArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* @apiParam {String} name Name of the topic.
|
||||
* @apiParam {String} icon Icon of the topic.
|
||||
* @apiParam {String} iconColor Icon's color of the topic.
|
||||
* @apiParam {Boolean} private Indicates if this event is not shown to users.
|
||||
* @apiParam {[Article](#api-Data_Structures-ObjectArticle)[]} articles Articles of the Topic.
|
||||
*/
|
||||
|
||||
|
@ -18,7 +19,8 @@ class Topic extends DataStore {
|
|||
'name',
|
||||
'icon',
|
||||
'iconColor',
|
||||
'ownArticleList'
|
||||
'ownArticleList',
|
||||
'private'
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -34,7 +36,8 @@ class Topic extends DataStore {
|
|||
'name' => $this->name,
|
||||
'icon' => $this->icon,
|
||||
'iconColor' => $this->iconColor,
|
||||
'private' => $this->private,
|
||||
'articles' => $articlesArray
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,26 @@ describe 'Article path' do
|
|||
icon: 'cogs',
|
||||
iconColor: 'red',
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
csrf_token: $csrf_token,
|
||||
private: 0
|
||||
})
|
||||
@topic_id = topic['data']['topicId']
|
||||
|
||||
it 'should create a private topic' do
|
||||
result = request('/article/add-topic', {
|
||||
name: 'Private Topic',
|
||||
icon: 'cogs',
|
||||
iconColor: 'green',
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token,
|
||||
private: 1
|
||||
})
|
||||
row = $database.getRow('topic', 'Private Topic', 'name')
|
||||
|
||||
result['status'].should.equal('success')
|
||||
(row['private']).should.equal('1')
|
||||
end
|
||||
|
||||
it 'should create article' do
|
||||
result = request('/article/add', {
|
||||
title: 'Some article',
|
||||
|
@ -108,13 +124,39 @@ describe 'Article path' do
|
|||
(result['data'][0]['name']).should.equal('Server management')
|
||||
(result['data'][0]['icon']).should.equal('cogs')
|
||||
(result['data'][0]['iconColor']).should.equal('red')
|
||||
(result['data'][1]['name']).should.equal('Software installation')
|
||||
(result['data'][1]['icon']).should.equal('photo')
|
||||
(result['data'][1]['iconColor']).should.equal('blue')
|
||||
(result['data'][0]['private']).should.equal('0')
|
||||
(result['data'][1]['name']).should.equal('Private Topic')
|
||||
(result['data'][1]['icon']).should.equal('cogs')
|
||||
(result['data'][1]['iconColor']).should.equal('green')
|
||||
(result['data'][1]['private']).should.equal('1')
|
||||
(result['data'][2]['name']).should.equal('Software installation')
|
||||
(result['data'][2]['icon']).should.equal('photo')
|
||||
(result['data'][2]['iconColor']).should.equal('blue')
|
||||
(result['data'][2]['private']).should.equal('0')
|
||||
|
||||
(result['data'][0]['articles'][0]['title']).should.equal('Some article')
|
||||
(result['data'][0]['articles'][0]['content']).should.equal('This is an article about server management.')
|
||||
(result['data'][0]['articles'][0]['position']).should.equal('1')
|
||||
|
||||
end
|
||||
it 'should retrieve public departments' do
|
||||
request('/user/logout')
|
||||
Scripts.login('tyrion@opensupports.com', 'tyrionl')
|
||||
|
||||
result = request('/article/get-all', {
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
(result['status']).should.equal('success')
|
||||
|
||||
(result['data'][0]['name']).should.equal('Server management')
|
||||
(result['data'][0]['icon']).should.equal('cogs')
|
||||
(result['data'][0]['iconColor']).should.equal('red')
|
||||
(result['data'][0]['private']).should.equal('0')
|
||||
(result['data'][1]['name']).should.equal('Software installation')
|
||||
(result['data'][1]['icon']).should.equal('photo')
|
||||
(result['data'][1]['iconColor']).should.equal('blue')
|
||||
(result['data'][1]['private']).should.equal('0')
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ describe 'Topic paths' do
|
|||
name: 'Server management',
|
||||
icon: 'cogs',
|
||||
iconColor: 'red',
|
||||
private: 0,
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
|
@ -17,6 +18,7 @@ describe 'Topic paths' do
|
|||
(topic['name']).should.equal('Server management')
|
||||
(topic['icon_color']).should.equal('red')
|
||||
(topic['icon']).should.equal('cogs')
|
||||
(topic['private']).should.equal('0')
|
||||
|
||||
lastLog = $database.getLastRow('log')
|
||||
(lastLog['type']).should.equal('ADD_TOPIC')
|
||||
|
@ -27,6 +29,7 @@ describe 'Topic paths' do
|
|||
topicId: 1,
|
||||
name: 'Installation issues',
|
||||
iconColor: 'blue',
|
||||
private: 1,
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
|
@ -37,6 +40,7 @@ describe 'Topic paths' do
|
|||
(topic['name']).should.equal('Installation issues')
|
||||
(topic['icon_color']).should.equal('blue')
|
||||
(topic['icon']).should.equal('cogs')
|
||||
(topic['private']).should.equal('1')
|
||||
end
|
||||
|
||||
it 'should delete topic correctly' do
|
||||
|
|
Loading…
Reference in New Issue