Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved global PAGE_* to Profile class #5500

Merged

Conversation

Quix0r
Copy link

@Quix0r Quix0r commented Jul 25, 2018

This PR is similar to #5490 and moves all PAGE_* (global namespace) to Friendica\Model\Profile class. There is also one addon (forumdirectory) that needs change (already done, PR will depend on this).

@annando
Copy link
Collaborator

annando commented Jul 25, 2018

I don't think that "profile" is the correct class. It belongs to the user. Additionally I prefer if you would move the "ACCOUNT_TYPE_" constants as well, since they belong to these "PAGE_" constants.

@Quix0r
Copy link
Author

Quix0r commented Jul 25, 2018

@MrPetovan told me to do so.

@annando
Copy link
Collaborator

annando commented Jul 25, 2018

A user can have multiple profiles. But these types are assigned to the user table, not the profile table.

Update: Possibly the Contact class is even better, since we use this constant in combination with the contact table as well.

@MrPetovan
Copy link
Collaborator

My mistake, I saw that page-flags were queried in a profile table query, but I didn't realize it was coming from the user table. It should then be in the Friendica\Model\User class, I'm sorry about that.

Copy link
Collaborator

@MrPetovan MrPetovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constants should be in Model\User instead, I'm sorry about that.

@Quix0r
Copy link
Author

Quix0r commented Jul 26, 2018

It is okay. Will do it tomorrow.

@annando
Copy link
Collaborator

annando commented Jul 26, 2018

Or it is Model\Contact since we use it as well for contacts?

@MrPetovan
Copy link
Collaborator

Do we use it the same exact way? Does it count for non-Friendica contacts?

@annando
Copy link
Collaborator

annando commented Jul 26, 2018

It is used in the same way. It is in contact-type - the user field is account-type.

I'm unsure if DFRN would be ideal? But when we possibly switch to AP, we surely would transmit this over there as well.

@MrPetovan
Copy link
Collaborator

I think there should be a distinction between both, and we should have a copy of the constants in Model\User and in Model\Contact to avoid confusion.

@annando
Copy link
Collaborator

annando commented Jul 26, 2018

I think this duplication would confuse even more, since we fill the user constant on the sender side and use it with the contact constant on the receiver side.

@MrPetovan
Copy link
Collaborator

In this case I would put it in Model\Contact.

@Quix0r
Copy link
Author

Quix0r commented Jul 26, 2018

One hour ago was the last comment, then I presume that Friendica\Model\Contact is final?

@annando
Copy link
Collaborator

annando commented Jul 26, 2018

I'm fine with it. But please also add this second group of constants I mentioned, since they are some kind of subgroup.

@Quix0r Quix0r force-pushed the rewrites/page-constants-moved-profile branch from 3deddd6 to 0097f85 Compare July 27, 2018 00:03
@Quix0r
Copy link
Author

Quix0r commented Jul 27, 2018

Done as requested and rebased branch against develop.

* This will only be assigned to contacts, not to user accounts
* @{
*/
define('ACCOUNT_TYPE_PERSON', 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong syntax.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over-heat problem detected. ;-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

- moved PAGE_* to Friendica\Model\Profile class
- moved all PAGE_* constants to Friendica\Model\Contact class
- fixed all references of both classes
- moved ACCOUNT_TYPE_* constants from boot.php to Contact::ACCOUNT_TYPE_*
@Quix0r Quix0r force-pushed the rewrites/page-constants-moved-profile branch from 0097f85 to c03828d Compare July 27, 2018 21:34
@Quix0r
Copy link
Author

Quix0r commented Jul 27, 2018

Oh, again. :-( TemperatureOutOfBoundsException

@MrPetovan MrPetovan added this to the 2018.08 milestone Jul 27, 2018
@MrPetovan MrPetovan merged commit 4a22710 into friendica:develop Jul 27, 2018
@Quix0r Quix0r deleted the rewrites/page-constants-moved-profile branch July 28, 2018 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants