Enhanced PM System

Started by dougiefresh, April 20, 2014, 04:30:16 PM

Previous topic - Next topic

ExSpirit

dougiefresh; I found another bug with the same error  "You are not allowed to access this section" - it happens when you use search and then click one of the links. All of them return that error, so you can't search private messages anymore.

dougiefresh

 :o Wow....  :-[ That sucks....  I'll look into it as well....

dougiefresh

#102
UPDATE: I've been working to rebuild this mod so that it is once again upgradable from one version to another.  A free piece of software called WinMerge has helped greatly in this pursuit.  I've almost got it put back together and you'll see the labor of my work in version 2.2 when it is uploaded.

Have I done anything with the bug reports?  No, this task has taken up the last 2 days....  Sorry to disappoint.  O:)

EDIT: Why am I doing this?  Cause it makes my life easier because I don't to keep track of where my changes are in the install.xml and I'm not as likely to remove some feature like what happened in v2.1 (default subject should be blank, accidentally restored to original code).....  Plus, I can isolate what I changed from version to version, unlike the current mess....

Arantor

Sounds like you need a versioning system to track such changes? Github will work for that kind of thing if you can brave using Git.
Holder of controversial views, all of which my own.


dougiefresh

Nah.  I did the same thing with the Split Forum mod, only it started that way.....  Started with v1.0 as the base, and each versions' changes got put into a file called upgrade_x.x (where x.x is the version number).  Then I included all those files in the package_info.xml file.  Easy-peasy....  :o  ;D

Attached is the package_info.xml, if you wanna look at that crazy mess  ;D

Arantor

At least you're not using <upgrade> tags, that would be serious voodoo (and not recommended)
Holder of controversial views, all of which my own.


dougiefresh

Quote from: Arantor on September 08, 2014, 07:42:19 PM
At least you're not using <upgrade> tags, that would be serious voodoo (and not recommended)
Why are upgrade tags not recommended?  And.... um.... yeah, I am....

Arantor

Because of the maintenance requirement.

<upgrade> lets you upgrade mods between mod versions. You can have a mod at 1.0, then a mod package that will upgrade solely from 1.0 to 1.1, but that means having from-base-SMF-to-mod-1.1 and having from-mod-1.0-to-mod-1.1 instructions in the package.

It's a lot of work to effectively maintain two sets of different but similar instructions. Couldn't recommend it.

This is why I highly recommend something like Github for this; let the tools do the version history and see what's been changed and only keep one master 'current' set of instructions. I couldn't have done SimpleDesk or currently be doing LevGal without this.
Holder of controversial views, all of which my own.


dougiefresh

It's not that bad, if each upgrade file contains only what is necessary to go up one version, aka from v1.0 to v1.1, v1.1 to v1.2, etc.  With the installer, if you install first the base file, then ALL the upgrade files, it's actually quite easy.  Looks like garbage sometimes, but it's easy and it works.  With the uninstaller, you start at the last version and go backwards, so you would go from v1.2 to v1.1, then v1.1 to v1.0, then remove v1.0....  At least that's how I'm doing it...

Now, the upgrade part is a bit more traumatic.  Each version requires the relevant files, so if you were upgrading from v1.0 to v1.4, you would need the upgrade file for v1.1, v1.2,  v1.3, and v1.4.  But upgrading from v1.2 requires only v1.3 and v1.4....

Anyways, it's time for bed.... (again)...

Arantor

Yes, that's why it's traumatic to specify the upgrade since you have to specify what you're upgrading from and to, and people have to remember not to uninstall each time but since almost no mod author does it because of the maintenance headache... yeah.

Couldn't recommend it, even down to the cases where during SD's development we were doing new builds from SVN every 12 hours for the testers.

But if you have a path that works for you, don't let my general meh strike you :P I'm only relaying what I found when working with the realms of the 'megamod' category (by which, anything that's going to hit 10k lines of code at some point in its life time)
Holder of controversial views, all of which my own.


dougiefresh

Uploaded v2.2 - September 9th, 2014
o Mod now upgradable from version 2.0 to version 2.1 to version 2.2!
o "Quote to All" feature implemented, requested by SilverWings.
o Fixed a bug where no Search button was shown while searching when no labels were defined, reported by Jeff B.
o More bug fixes where the PM display mode not being set to conversation correctly, reported by SilverWings.
o Fixed a bug that marks PMs as read even though user hasn't opened the PM yet, reported by ExSpirit
o Re-Added code that v2.1 removed by mistake which removes default subject from PMs (noticed during rebuild)
o Fixed a template bug in the Core theme's PersonalMessage.template.php.

Hopefully, this solves all of the reported bugs.....  Please note that this mod cannot upgrade from v1.x series, as there is an uninstall issue with the fully upgradable mod version that I can't nail down.....

@Arantor: I can understand not using the upgrade capability when you're cranking out updates every 12 hours.....  That'd be a nightmare and a half to use the upgrade capability with that situation....

Arantor

It's a nightmare and a half even when you're doing one major release a year, to be honest.
Holder of controversial views, all of which my own.


Jeff B

3.    Execute Modification    ./Themes/core/PersonalMessage.template.php    Test failed
      1.    Replace    ./Themes/core/PersonalMessage.template.php    Test failed

ExSpirit

#113
I have tested this bug now:

QuoteIf I am in my inbox and before I click on some conversation if other person sends another new message in that conversation and after that I click on link to open conversation (without refreshing page) I get error "You are not allowed to access this section", so I have to go back to inbox and click the link again. The problem is that when new message arrives in conversation, pmid changes in URL, so old one no longer works.

... and now new error is shown when I click conversation link: "The database value you're trying to insert does not exist: id_pm_head".

dougiefresh

#114
Just figured out the code I wrote is wrong.... Ugh....  Updated avatar, too....

EDIT: Just figured out the stock code for the PM stuff is also WRONG.....  Maybe the stock code is okay....

SilverWings

dougiefresh, how's it going? Any update about those big problems in v2.2?

uid_0

Quote from: dougiefresh on September 09, 2014, 04:04:00 PM
o Fixed a template bug in the Core theme's PersonalMessage.template.php.
Doesn't look like this was fully corrected. With SMF 2.0.8 and EPS 2.2 I am seeing the same error as Jeff B.

Execute Modification    ./Themes/core/PersonalMessage.template.php    Test failed
        Replace    ./Themes/core/PersonalMessage.template.php    Test failed

The string of code you're searching for does not actually appear in the current (at least as of SMF 2.0.7/2.0.8 ) Core theme template.
echo '
if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))

uid_0

Even in install.xml of your package you do not add that exact string.


<operation>
<search position="replace"><![CDATA[echo '
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a></li>
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $quote_button, '</a></li>';]]></search>
<add><![CDATA[if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a></li>
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $quote_button, '</a></li>';

elseif ($context['folder'] == 'unread' && !isset($message['is_unread']))
{
if (empty($modSettings['eps_deny_unsend']))
echo '
<li class="unsend_button"><a href="', $scripturl, '?action=pm;sa=unsend;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '" onclick="return confirm(\'', addslashes($txt['unsend_message']), '?\');">', $txt['unsend_item'], '</a></li>';
if (empty($modSettings['eps_deny_edit']) && empty($context['can_edit_msg']))
echo '
<li class="edit_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';edit">', $txt['pm_edit'], '</a></li>';
}]]></add>
</operation>


Notice an unrelated typo in this block  "Were than more than"  => "Were there more than"
// EPS: Were than more than one recipient you can reply to? (Only shown when not in conversation mode.)
if ($message['number_recipients'] > 1 && $context['display_mode'] != 2)
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all">', $reply_all_button, '</a></li>';

if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a></li>
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $quote_button, '</a></li>';

elseif ($context['folder'] == 'unread' && !isset($message['is_unread']))
{
if (empty($modSettings['eps_deny_unsend']))
echo '
<li class="unsend_button"><a href="', $scripturl, '?action=pm;sa=unsend;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '" onclick="return confirm(\'', addslashes($txt['unsend_message']), '?\');">', $txt['unsend_item'], '</a></li>';
if (empty($modSettings['eps_deny_edit']) && empty($context['can_edit_msg']))
echo '
<li class="edit_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';edit">', $txt['pm_edit'], '</a></li>';
}
}


<operation>
<search position="replace"><![CDATA[echo '
<li class="reply_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $txt['reply'], '</a></li>
<li class="quote_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $txt['quote'], '</a></li>';]]></search>
<add><![CDATA[
if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))
echo '
<li class="reply_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $txt['reply'], '</a></li>
<li class="quote_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $txt['quote'], '</a></li>';

elseif ($context['folder'] == 'unread' && !isset($message['is_unread']))
{
if (empty($modSettings['eps_deny_unsend']))
echo '
<li class="unsend_button"><a href="', $scripturl, '?action=pm;sa=unsend;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '" onclick="return confirm(\'', addslashes($txt['unsend_message']), '?\');">', $txt['unsend_item'], '</a></li>';
if (empty($modSettings['eps_deny_edit']) && empty($context['can_edit_msg']))
echo '
<li class="edit_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';edit">', $txt['pm_edit'], '</a></li>';
}
]]></add>
</operation>


Again, an unrelated typo, but not the bug you thought existed around the "is_unread" context. "Is there than more than"  => "Is there more than"
// EPS: Is there than more than one recipient you can reply to?
if ($message['number_recipients'] > 1 && $context['display_mode'] != 2)
echo '
<li class="reply_all_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all">', $txt['reply_to_all'], '</a></li>';


if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))
echo '
<li class="reply_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $txt['reply'], '</a></li>
<li class="quote_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $txt['quote'], '</a></li>';

elseif ($context['folder'] == 'unread' && !isset($message['is_unread']))
{
if (empty($modSettings['eps_deny_unsend']))
echo '
<li class="unsend_button"><a href="', $scripturl, '?action=pm;sa=unsend;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '" onclick="return confirm(\'', addslashes($txt['unsend_message']), '?\');">', $txt['unsend_item'], '</a></li>';
if (empty($modSettings['eps_deny_edit']) && empty($context['can_edit_msg']))
echo '
<li class="edit_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';edit">', $txt['pm_edit'], '</a></li>';
}

}

dougiefresh

#118
@Everybody: I forgot to add the upgrade_v2.2.xml to the uninstall section of the mod, so as a result, it will not uninstall correctly.  It will be corrected in the v2.3 mod, and you can upgrade from v2.2 to v2.3.

Quote from: SilverWings on September 13, 2014, 05:17:17 AM
dougiefresh, how's it going? Any update about those big problems in v2.2?
I've been trying to survive the horrible outside temperatures at work lately and haven't had the energy to fix this particular bug....  Today is my first day off since the release of v2.2....

Quote from: uid_0 on September 13, 2014, 07:08:53 PM
Execute Modification    ./Themes/core/PersonalMessage.template.php    Test failed
        Replace    ./Themes/core/PersonalMessage.template.php    Test failed

The string of code you're searching for does not actually appear in the current (at least as of SMF 2.0.7/2.0.8 ) Core theme template.
echo '
if ($context['folder'] != 'unread' || ($context['folder'] == 'unread' && isset($message['is_unread'])))

That's because in the WIP mod (the one that can be upgraded from v1.0 to v2.2 in one easy step), there is a major typo that results in an error when trying to use the Core theme.  I assumed it was in the mod when I just dumped the upgrade file into the v2.1 and altered the package_info.xml file to use the upgrade file.  I've since altered the upgrade file to ignore that operation if it doesn't exist.

Quote from: uid_0 on September 14, 2014, 03:34:32 AM
Notice an unrelated typo in this block  "Were than more than"  => "Were there more than"

Again, an unrelated typo, but not the bug you thought existed around the "is_unread" context. "Is there than more than"  => "Is there more than"
I'm not going to fix typo errors within the comments, and I'm pretty sure that most of those typos exist in the original source code....

dougiefresh

Uploaded v2.3 - September 14th, 2014
o Mod upgradable from v2.x to v2.3.
o Fixed bugs that prevented latest message from being shown if more has been added to the conversation.
o Fixed install bug so that v2.2 operation in core/PersonalMessage.template.php is now ignored if doesn't exist.
o Fixed uninstaller from v2.2 because it doesn't include reversing the upgrade_2.2.xml instructions.

NOTE: Do not attempt to uninstall v2.2, as the uninstaller doesn't include reversal of the operations in upgrade_v2.2.xml.  You may upgrade from v2.2 to v2.3 by using the v2.3 mod.

Advertisement: