Пример #1
0
      data => {
        const hydratedPost = post.hydrate(data)
        store.dispatch(post.patch(data, hydratedPost))

        snackbar.success(gettext("Post has been reverted to previous state."))
        modal.hide()
      },
Пример #2
0
        data => {
          store.dispatch(thread.replace(data))
          store.dispatch(posts.load(data.post_set))
          store.dispatch(thread.release())

          snackbar.success(gettext("Thread has been moved."))
          modal.hide()
        },
Пример #3
0
    ajax.get(this.props.thread.api.posts.index, {page: this.props.posts.page}).then((data) => {
      store.dispatch(thread.replace(data));
      store.dispatch(posts.load(data.post_set));
      store.dispatch(thread.release());

      snackbar.success(gettext("Thread has been moved."));
      modal.hide();
    }, (rejection) => {
Пример #4
0
  handleSuccess(apiResponse) {
    store.dispatch(post.patch(this.props.post, {
      isDeleted: true
    }));

    modal.hide();

    snackbar.success(gettext("Selected post was split into new thread."));
  }
Пример #5
0
 completeRegistration = (apiResponse) => {
   if (apiResponse.activation === 'active') {
     modal.hide();
     auth.signIn(apiResponse);
   } else {
     this.setState({
       complete: apiResponse
     });
   }
 };
Пример #6
0
 handleError(rejection) {
   if (rejection.status === 400) {
     if (rejection.code === 'inactive_admin') {
       snackbar.info(rejection.detail);
     } else if (rejection.code === 'inactive_user') {
       snackbar.info(rejection.detail);
       this.setState({
         'showActivation': true
       });
     } else if (rejection.code === 'banned') {
       showBannedPage(rejection.detail);
       modal.hide();
     } else {
       snackbar.error(rejection.detail);
     }
   } else if (rejection.status === 403 && rejection.ban) {
     showBannedPage(rejection.ban);
     modal.hide();
   } else {
     snackbar.apiError(rejection);
   }
 }
Пример #7
0
 handleError(rejection) {
   if (rejection.status === 400) {
     this.setState({
       'errors': Object.assign({}, this.state.errors, rejection)
     });
     snackbar.error(gettext("Form contains errors."));
   } else if (rejection.status === 403 && rejection.ban) {
     showBannedPage(rejection.ban);
     modal.hide();
   } else {
     snackbar.apiError(rejection);
   }
 }
Пример #8
0
  handleSuccess(apiResponse) {
    // unfreeze and remove merged threads
    this.props.threads.forEach((thread) => {
      this.props.freezeThread(thread.id);
      this.props.deleteThread(thread);
    });

    // deselect all threads
    store.dispatch(select.none());

    // append merged thread, filter threads
    this.props.addThreads([apiResponse]);
    store.dispatch(filterThreads(this.props.route.category, this.props.categoriesMap));

    // hide modal
    modal.hide();
  }