I noticed a bug when editing points transactions that were created by the Userpoints Node and Comments module. Basically, if you edit and save the transaction, the existing description field appears to be deleted and the operation field is displayed as the 'Reason' instead. Furthermore, the operation field itself is being truncated when this happens: It is reduced from "userpoints_nc_node_insert" to "userpoints_nc_node_i". The text will still correctly link to the node that caused the points award, but the text that is displayed changes as described above.

I'm not sure if this is a problem with Userpoints module itself or the Userpoints Node and Comments module....

Thoughts?

--Ben

Comments

berdir’s picture

I noticed the problem too, however that it automatically got truncated seems to be your browser. In my case, it simply said that the text was too long for that field. Looks like the UI enforces a shorter operation than the API.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new893 bytes

Fix is simple, but we might want to think if we want to increase the limit of some of these columns while we are on it. We must however check if this doesn't influence anything else...

For example, operation and entity type are limited to 32 characters (privatemsg_message is 18) and reference is limited to 128 characters.

Edit: Oh, I forgot to mention that the missing description is a because of the truncated operation column, because it doesn't correspond to the defined operation by userpoints_nc.module anymore. So this will be fixed too.

BenK’s picture

Adding a note to add the following to this patch since it involves schema changes:

a) In the database, it looks like the "expired" field has an incorrect comment. It says "User ID" currently, but it looks like that field is meant to indicate if the transaction is expired or not.

b) Should we change the field name in the database from Approver ID to Moderator ID? And change the field comment? Or would this cause a problem elsewhere?

--Ben

BenK’s picture

Status: Needs review » Needs work

The patch in #2 worked great. The operation is no longer truncated and the description isn't disappearing from the 'Reason' anymore. Should we maybe go from 32 characters to 48 character limit if this doesn't negatively impact anything else?

The reason is because other UP related modules could supply fairly long operation fields (like UP-NC did). So it might be safer to have a longer limit if a module, for instance, as a long machine name.

Also, do you want to address comment #3 schema stuff in this thread or somewhere else?

Finally, I noticed that the description supplied by UP-NC is not actually displayed in the description field on the edit screen (the description field just appears blank). Shouldn't the description be appearing there and editable? If you enter a description manually, it will save it, but the 'Reason' column won't be updated. I'm not sure if we necessarily want that 'Reason' column to be editable, but we might. I thought I'd mention it.

--Ben

BenK’s picture

One of the last few issues remaining before a 7.x-alpha1 release...

BenK’s picture

At http://drupal.org/node/871096 (Userpoints Node and Comments module), Berdir suggested that truncation length should be a setting in Userpoints.module instead of UP-NC. So should we deal with this on this thread?

Here is an updated label and description for this setting in userpoints.module:

Label: Truncation length for 'Reason' field
Description: Choose the truncation length in characters for the 'Reason' field on !points transactions.

--Ben

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.12 KB

Ok, getting back to this.

#3 a) Updated the descriptions

b) I think we should leave that for now. Only updated the description.

#4) Increased to 48 characters, entity_type to 128, that is consistent with how field.module is doing it. I think the description stuff has been resolved elsewhere.

#6) Let's do that in a separate issue.

Status: Needs review » Needs work

The last submitted patch, truncated_operation2.patch, failed testing.

BenK’s picture

Status: Needs work » Reviewed & tested by the community

I tried the latest patch and everything works great. The database schema looks good and truncation is no longer occurring.

I'm not sure why the test bot failed, however.

So I'm marking this as RTBC, but we may want to change status back if there is a relevant reason why the test bot is failing.

--Ben

berdir’s picture

Status: Reviewed & tested by the community » Fixed

Test bot is playing strange, our Tests passed, Rules Scheduler has nothing to do with us.

Commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.