recover email draft from hung gmail tab

I composed an email draft in gmail. After closing the draft and wanting to inspect it in “Drafts” gmail hangs with a “Loading…” sign.

I opened gmail in another tab and the draft isn’t there, but I can see that the tab where I composed the draft still has some knowledge of it: the counter for the “Drafts” folder is visible and greater by 1 than in the freshly opened tab.

I’ve tried turning the wifi on and off and getting gmail out of its funk by opening/closing messages and trying again, but it always ends up hanging as soon as I pressed “Drafts” or “Sent”, etc.

I’m wondering, could there be a may to recover the draft by using the dev tools on the hung tab? Like crawling the dom and looking for string fragments that the draft contained? Could anyone suggest some code?

8 – Content moderation “current revision” not set on nodes migrated from Drupal 7 where there are both a published and draft revisions

I am working on upgrading a Drupal 7 site to Drupal 8. The upgrade uses a content-only custom migration. The Drupal 7 source site and the Drupal 8 destination do not contain any custom modules other than a Drupal 8 custom module containing the custom migration configuration. Both source and destination site were created using the Standard install profile.

I have created migrations for both the node and node revisions of the Page content type. The page node consists of a media reference field and a paragraph reference field. After running the migration I notice that for migrate nodes which had both a published and draft version in which the draft revision is more recent than the published revision then the current content revision is not set.

Here is the moderation tab of such a node in Drupal 7:

enter image description here

Here is the moderation tab of the same node after migrating it to Drupal 8:

enter image description here

Following is the content_moderation_state_revision table from the destination database. The node in question is id = 3.

enter image description here

Following is the content_moderation_state_field_revision table from the destination database.

enter image description here

Here is the config for the Page node migration:

langcode: en 

status: true 

dependencies: {  } 

id: health_node_standard_page 

label: Standard Page Nodes 

audit: true 

migration_tags: 

  - Drupal 7 

  - Content 

migration_group: health 

deriver: DrupalnodePluginmigrateD7NodeDeriver 

source: 

  plugin: d7_node_extended 

  node_type: page 

process: 

  nid: tnid 

  vid: vid 

  langcode: 

    - 

      plugin: static_map 

      source: language 

      map: 

        und: en 

      bypass: true 

  title: title 

  uid: node_uid 

  status: status 

  created: created 

  changed: changed 

  promote: promote 

  sticky: sticky 

  revision_uid: revision_uid 

  revision_log: log 

  revision_timestamp: timestamp 

  field_h_content_blocks: 

    plugin: sub_process 

    source: field_content_blocks 

    process: 

      paragraphs: 

        plugin: migration_lookup 

        migration: 

          - health_paragraph_content_text 

        source: value 

      target_id: 

        - 

          plugin: extract 

          source: '@paragraphs' 

          index: 

            - 0 

      target_revision_id: 

        - 

          plugin: extract 

          source: '@paragraphs' 

          index: 

            - 1 

  field_h_image_featured: 

    - 

      plugin: sub_process 

      source: field_featured_image 

      process: 

        target_id: 

          - 

            plugin: migration_lookup 

            migration: health_media_image 

            source: fid 

  moderation_state: 

    - 

      plugin: static_map 

      source: moderation_state 

      map: 

        published: published 

        draft: draft 

        needs_review: needs_review 

      default_value: draft 

destination: 

  plugin: entity:node 

  default_bundle: h_standard_page 

migration_dependencies: 

  required: 

    - health_user 

    - health_paragraph_content_text 

    - health_media_image 

Here is the config for the Page node revisions migration:

langcode: en 

status: true 

dependencies: {  } 

id: health_node_revision_standard_page 

label: Node revisions - Standard Page 

audit: true 

migration_tags: 

  - Drupal 7 

  - Content 

migration_group: health 

deriver: DrupalnodePluginmigrateD7NodeDeriver 

source: 

  plugin: d7_node_revision_extended 

process: 

  nid: 

    - 

      plugin: get 

      source: nid 

  vid: 

    - 

      plugin: get 

      source: vid 

  langcode: 

    - 

      plugin: static_map 

      source: language 

      map: 

        und: en 

      bypass: true 

  title: title 

  uid: node_uid 

  status: 

    - 

      plugin: get 

      source: status 

  created: created 

  changed: changed 

  promote: promote 

  sticky: sticky 

  revision_uid: revision_uid 

  revision_log: log 

  revision_timestamp: timestamp 

  moderation_state: 

    - 

      plugin: static_map 

      source: moderation_state 

      map: 

        published: published 

        draft: draft 

        needs_review: needs_review 

      default_value: draft 

destination: 

  plugin: entity_revision:node 

  default_bundle: h_standard_page 

migration_dependencies: 

  required: 

    - health_node_standard_page 

Both migrations make use of a custom “Source” which extends the “d7_node” and “d7_node_revision” source plugins accordingly. These extended source plugins get the moderation state info of the relevant node or node revision.

/**
 * Extended version of core Drupal 7 node source from database.
 *
 * @MigrateSource(
 *   id = "d7_node_extended",
 *   source_module = "node"
 * )
 */
class D7NodeExtended extends Node {

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // Make the node's moderation state available to migration.
    $database = $this->getDatabase();
    $vid = $row->getSourceProperty('vid');
    $query = $database
      ->select('workbench_moderation_node_history', 'wm')
      ->fields('wm', ('state'))
      ->condition('wm.vid', $vid)
      ->orderBy('wm.stamp', 'DESC')
      ->range(0, 1);
    $value = $query
      ->execute()
      ->fetchField();
    if ($value) {
      $row->setSourceProperty('moderation_state', $value);
    }

    return parent::prepareRow($row);
  }
}
/**
 * Extended version of core Drupal 7 node source from database.
 *
 * @MigrateSource(
 *   id = "d7_node_revision_extended",
 *   source_module = "node"
 * )
 */
class D7NodeRevisionExtended extends NodeRevision {

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // Make the node revision's moderation state available to migration.
    $database = $this->getDatabase();
    $vid = $row->getSourceProperty('vid');
    $query = $database
      ->select('workbench_moderation_node_history', 'wm')
      ->fields('wm', ('state'))
      ->condition('wm.vid', $vid)
      ->orderBy('wm.stamp', 'DESC')
      ->range(0, 1);
    $value = $query
      ->execute()
      ->fetchField();
    if ($value) {
      $row->setSourceProperty('moderation_state', $value);
    }

    return parent::prepareRow($row);
  }
}

twitter – WordPress Rest API – Draft, then Publish

and thanks in advance for the help,

I’ve been using the WordPress REST API, in combination with an automated tweeting tool, to post onto my site and have the post automatically shared to Twitter. The only complaint I have is that the link previews on Twitter do not include my post’s featured image.

After a bit of digging, I realized that this was because WP could not register the image before the plugin posts to twitter, and therefore has no image to show in the link preview. I cannot delay the tweets, so my only choice is to store the post, and then tweet it out ~30 seconds later. I’ve played around with the ‘date’ field but even setting it to the future doesn’t work.

Is there any way I can first set the post status to draft, then set it to publish 30 seconds later?

Class Design question concerning adding a new “DRAFT” state to an object

We have some entities in our code:

-“View” and View has some attributes and also contains one or many “SubViews”

-And each “SubView” has some attributes and contains one or more “Tweet” entities.

So far so good. User edits Views/SubViews/Tweet (adding/removing tweets from subviews, adding/removing subviews fro views etc) in our UI and as everything is linked it updates fine. At the moment the user after editing, can decide to make her changes “Live” Or just discard them, there is no option to save and come later.

So now we want to introduce a “Draft” system. So user can edit a View/SubView/Tweet in a draft state (This is to be persisted) and eventually decide to make it “Live”. On making it “Live” the draft doesn’t die. User can continue to work on the draft and make it live again. So they both live side-by-side and have to be linked.

I’m not sure how to go about introducing this is code as the “Live” is just implicit in code/db atm. Some options I could think:

  1. Add a flag to each class with Live/Draft state indication. This will mean that I need to keep them in synch between the entities that are linked together
  2. Add another “Manager” like class that holds the objects related to Draft/Live versions of the views and manages the relationship between them. Using only the current types. The Manager is the only one that knows what is draft and what is live object
  3. Add a completely new type “DraftView”->”DraftSubView”->”DraftTweet” and manage the relationship between Draft and Live entities

At the DB level I’m thinking of just adding another column to the table to say Live/Draft.

More likely, there is a better way to do this and there are patterns to help with this, so i’m hoping I can get some opinions on my suggestions or better ways to do this. Hopefully I could make the question clear.

Thanks,

nonce – Draft preview and customize permission problems on multisite main site

So I’ve been stuck on this problem for quite a while now and it feels like I’ve tried everything. I would love for some support here.

Setup

  • A WordPress multisite with Bedrock structure
  • PHP 7.3.17 (local) and PHP 7.2.24 (live)
  • Apache
  • Themes: Custom “mother theme” and child themes for each site.

Problem

The first site among the multisites seem to have some kind of structural problem. The other sites works just fine.

When previewing drafts on posts and pages the user (including superadmin) gets a message: Sorry, you are not allowed to preview drafts. I’ve tracked it down to _show_post_preview() in wp-includes/revision.php and it seems like the nonce check fails.

A similar problem occurs when customizing the site. When trying to save changes you get: You need a higher level of permission. Sorry, you are not allowed to customize this site. This error is thrown in wp-admin/js/customize-controls.js in function cheatin() which seem to be used when the nonce is off.

What I’ve tried (no luck)

  • Deactivating all plugins
  • Switching to one of the other child themes that works on their sites
  • Clear WordPress cache
  • Clear browser cache
  • Creating the nonce by myself in the preview_post_link filter.
  • Double, triple check .htaccess and wp-config.php (in Bedrock: config/application.php)

My .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - (L)

# add a trailing slash to /wp-admin
RewriteRule ^((_0-9a-zA-Z-)+/)?wp-admin$ $1wp-admin/ (R=301,L)

RewriteCond %{REQUEST_FILENAME} -f (OR)
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - (L)
RewriteRule ^((_0-9a-zA-Z-)+/)?(wp-(content|admin|includes).*) wp/$2 (L)
RewriteRule ^((_0-9a-zA-Z-)+/)?(.*.php)$ wp/$2 (L)
RewriteRule . index.php (L)

Cookies – Can half of Webform submissions be saved as a draft for non-logged in users so they can refer back later?

We have a customer who wants to create a customer service portal.
1. The portal uses web forms to collect data.
2. Users should be able to fill out the web form without logging in.
3. Unauthenticated users who do not want to log in should be able to return to and fill out a form that they paused halfway through.

Are your current module sets helpful for this functionality?

Database – Draft calculation chart with tables

In general, ER diagrams can be used when designing the dependency between tables, and there are various tools for drawing them. For the chain of calculations with simple variables, there is the concept of the calculation graph.

Is there an industry-standard design technique or a tool that can be used to visualize calculations with different columns in different tables? The operations include standard table operations: lookup, pivot, totals, etc. Or is the ER diagram the best way to deal with it?

Design – draft for the application

problem

I am working on an application for my personal use. Basically, I need a 24-hour cloud application that is informed about the new articles on the website links provided and that retrieves information about headings or certain content from these articles. The information is processed and compiled and then published in my web app. As soon as this happens, I should receive a notification (web or SMS) on my phone. Now I can personally approve these posts in the web app. If you approve them, you must send them to my Google Docs (or similar platform) and save them. The post should die after my interaction.

My approach

I did some research and divided it into sub-problems.

  1. In order to get the content, I have to scrap these websites on the Internet. However, I don't know how my application would know if a new article would be published. I think an RSS feed can help, but I'm not sure.

  2. For a 24-hour app, I thought I could deploy a Python script on a cloud platform like Heroku. But would like to know if there is a better option that can integrate everything into my web app.

  3. I can easily receive a notification on my phone about my web application provided on the Internet.

  4. I can use the Google App script to save it in the Google Docs section. But I need to know if that can be easily integrated into everything else since I haven't used it before.

More info

Since this is for my personal use, I want it to be done as cheaply as possible. The whole problem mentioned above is essentially to retrieve, process and save the desired content from a website on my Google Sheet. I wanted to know all possible ways and limitations before I start working on it. Any help or suggestion on how to do it is greatly appreciated.

Can anyone deny that Trump acted ethically when evading the draft?

Millions of us used loopholes to avoid drafts. Bill Clinton went further than most others: "In the fall of 1969, Clinton entered the draft, but was given a high number (311) and was never called on to serve. Clinton, however, made every effort to bypass the draft before entering came up with the draft.

Initially, Bill Clinton received postponement for training in Georgetown and Oxford (where he helped organize anti-war demonstrations). Second, Clinton attempted to bypass the draft for four years by enrolling the Army Reserve Officer Training Corps (ROTC), but never joined. Clinton had signed up for the ROTC in the hope of avoiding military service for four years, but wanted a future in politics, had a change of heart, and joined the draft.

In December 1969, safe from the design with its high lottery number, Clinton changed his mind about joining the ROTC program and wrote a letter to the director of the ROTC program exposing the extent of his rejection of the war. The letter was leaked to ABC News by the Pentagon in early 1992 and fueled criticism of Clinton's character candidates.

Later in the 1992 campaign, it became known that Clinton's uncle had attempted to get Bill Clinton a contract as a Navy Reserve during the Vietnam War. Clinton said he didn't know about this on September 3, 1992, but admitted a day later that a former design member had informed him about his uncle's attempt a few months ago.