Skip to main content
Topic: Remove Posts not working (Read 2399 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Remove Posts not working

Seeing this on both a green install of beta2 and a pull from a couple days ago.  One green install of beta two.  Register new member as regular member.

Member posts on the one topic that exists by default after the install.
User views thread.  There is an option to remove their post.  I click it.  It says "Ouch, sorry, you cannot delete posts in this board."

I'm seeing it on my full install too.  The regular members have the following permissions on the board:

Remove Topics: Own
Delete Posts: Own
Modify Posts: Own

Which is enough to allow them to see a remove box, but apparently not enough to actually allow them to remove their own post.

Re: Remove Posts not working

Reply #1

Seems to work here... :-\

Could it be the user is trying to delete the first message of the topic?
In this case it's "normal" a warning appears (though is a bit different from the one you reported).

And just to be sure, the board doesn't have any special profile, right?
Bugs creator.
Features destroyer.
Template killer.

Re: Remove Posts not working

Reply #2

Quote from: emanuele – Seems to work here... :-\

Could it be the user is trying to delete the first message of the topic?
In this case it's "normal" a warning appears (though is a bit different from the one you reported).

And just to be sure, the board doesn't have any special profile, right?

No for the green test board it was the second post in the topic and it was the default board and message.

Re: Remove Posts not working

Reply #3

Code: [Select]
		if ($topic_info['id_member'] == $user_info['id'])
{
if (!allowedTo('delete_own'))
{
if ($topic_info['id_member_started'] == $user_info['id'] && !allowedTo('delete_any'))
isAllowedTo('delete_replies');
elseif (!allowedTo('delete_any'))
isAllowedTo('delete_own');
}
elseif (!allowedTo('delete_any') && ($topic_info['id_member_started'] != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $topic_info['poster_time'] + $modSettings['edit_disable_time'] * 60 < time())
fatal_lang_error('modify_post_time_passed', false);
}
elseif ($topic_info['id_member_started'] == $user_info['id'] && !allowedTo('delete_any'))
isAllowedTo('delete_replies');
else
isAllowedTo('delete_any');

That's the code from RemoveTopic.controller.php function action_deletemsg() which is what's getting called when I click on remove.  I see $topic_info['id_member'] as the id that started the topic and $user_info['id'] as the user attempting to remove a message. 

So it never checks the delete_own.  What is topic_info['id_member'] supposed to be?

Re: Remove Posts not working

Reply #4

Maybe not important, but if I look at the links of the remove buttons I see "topic.XXX.YYY".  YYY is just set to the number of the reply on the top of the page.  It doesn't change with each message.  So if YYY is supposed to be reply number it's not incrementing correctly.

Re: Remove Posts not working

Reply #5

Oh yes, you are right... :-[

I was thinking to use determineRemovableMessages, but then I noticed another bug: in action_quickmod2, apparently edit_disable_time is not respected.

Now is a bit late for me, but this should be checked as well.
Bugs creator.
Features destroyer.
Template killer.

 

Re: Remove Posts not working

Reply #6

To fix this I decided to fix another one... lol
This is the first part:
https://github.com/emanuele45/Dialogo/commit/ab548a89889422708012d00e658c02f8505e2056
and this is the second:
https://github.com/emanuele45/Dialogo/commit/28cf1685be420ffd68c4f904383b352133ff9061
The second is the actual fix, but without the first doesn't work.
Bugs creator.
Features destroyer.
Template killer.