aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Item.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-07-10 11:34:10 +0200
committerMario Vavti <mario@mariovavti.com>2016-07-10 11:34:10 +0200
commite11219888ddb2dbf66a3f6e0042278b43f72d66a (patch)
tree798ee0f36f84057c7536c596ac13628ebbc160d9 /Zotlabs/Module/Item.php
parent0b2ad9deca89e7e267aeea114889f49ea93ed81d (diff)
parente2574cf069dc29b1e8ca6bd64ee78b262206cef4 (diff)
downloadvolse-hubzilla-e11219888ddb2dbf66a3f6e0042278b43f72d66a.tar.gz
volse-hubzilla-e11219888ddb2dbf66a3f6e0042278b43f72d66a.tar.bz2
volse-hubzilla-e11219888ddb2dbf66a3f6e0042278b43f72d66a.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'Zotlabs/Module/Item.php')
-rw-r--r--Zotlabs/Module/Item.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 369dd3948..58d39da83 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -93,7 +93,7 @@ class Item extends \Zotlabs\Web\Controller {
$origin = (($api_source && array_key_exists('origin',$_REQUEST)) ? intval($_REQUEST['origin']) : 1);
- // To represent message-ids on other networks - this will create an item_id record
+ // To represent message-ids on other networks - this will create an iconfig record
$namespace = (($api_source && array_key_exists('namespace',$_REQUEST)) ? strip_tags($_REQUEST['namespace']) : '');
$remote_id = (($api_source && array_key_exists('remote_id',$_REQUEST)) ? strip_tags($_REQUEST['remote_id']) : '');
@@ -535,7 +535,7 @@ class Item extends \Zotlabs\Web\Controller {
}
/**
- * fix naked links by passing through a callback to see if this is a red site
+ * fix naked links by passing through a callback to see if this is a hubzilla site
* (already known to us) which will get a zrl, otherwise link with url, add bookmark tag to both.
* First protect any url inside certain bbcode tags so we don't double link it.
*/
@@ -834,21 +834,23 @@ class Item extends \Zotlabs\Web\Controller {
if($orig_post)
$datarray['edit'] = true;
+ // suppress duplicates, *unless* you're editing an existing post. This could get picked up
+ // as a duplicate if you're editing it very soon after posting it initially and you edited
+ // some attribute besides the content, such as title or categories.
+
if(feature_enabled($profile_uid,'suppress_duplicates') && (! $orig_post)) {
- $z = q("select created from item where uid = %d and body = '%s'",
+ $z = q("select created from item where uid = %d and created > %s - INTERVAL %s and body = '%s' limit 1",
intval($profile_uid),
+ db_utcnow(),
+ db_quoteinterval('2 MINUTE'),
dbesc($body)
);
if($z) {
- foreach($z as $zz) {
- if($zz['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) {
- $datarray['cancel'] = 1;
- notice( t('Duplicate post suppressed.') . EOL);
- logger('Duplicate post. Faking plugin cancel.');
- }
- }
+ $datarray['cancel'] = 1;
+ notice( t('Duplicate post suppressed.') . EOL);
+ logger('Duplicate post. Faking plugin cancel.');
}
}