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

Repository button disappears on 5.1.4 (regression from 5.1.3) #197

Closed
Willy-JL opened this issue Mar 26, 2023 · 4 comments
Closed

Repository button disappears on 5.1.4 (regression from 5.1.3) #197

Willy-JL opened this issue Mar 26, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Willy-JL
Copy link
Contributor

Willy-JL commented Mar 26, 2023

I have an issue on 5.1.4, which is not present on 5.1.3.

On 5.1.3, with the default configuration, the first "View Repository" button is shown when a repo is detected, and remains shown when idle or when not in a file. On 5.1.4 instead I've had many issues with this behavior, like the button disappearing when idle or not in a file, or the link being incorrect and pointing to a rick roll, and if I manually override the rick roll link, it fails to parse the {git_url} and says invalid URL for button 1. I would assume this is due to a logic mistake, where the git repo context is skipped if idle state is detected.

I'm also having another logic issue, which is kind of expected and behaving correctly, but makes little sense. I included file details like filename and line count in the state text (second line) to also show when idle, and set the not in file text correctly.When I go idle on a file, I keep seeing the correct details, and if I'm not in a file that also shows correctly; going idle when not in a file however, will try to use the idle text instead of the not in a file text, which is correct logic wise, but this means that the file information string is used and leaves details empty (in my case I see ( lines) due to missing filename and line count). I see 2 possible solutions: using the "not in file" text when "idle and not in file", or adding an additional config entry for "idle and not in file" state.

@nick22985
Copy link
Collaborator

nick22985 commented Mar 26, 2023

I assume what has happened is the config has changed the defaults for some reason or another. This is fully configurable tho see #183 for full config

Nothing logically should have changed regarding anything to do with the presence the only changes in 5.1.3 and 5.1.4 was adding debug to the buttons.

v5.1.3...v5.1.4

@Willy-JL
Copy link
Contributor Author

Willy-JL commented Mar 26, 2023

Dont know what to tell you. Matter of fact is that the first button is VERY broken on 5.1.4. Maybe the wrong files were pushed to the market place and what is on there does not reflect the source code on here. Either way, on 5.1.4 the first button completely ignores the git repository, while 5.1.3 works flawlessly in that regard. I just tried again to confirm, and used the same hardcoded custom settings just to be sure, issue persists.

@Willy-JL
Copy link
Contributor Author

Willy-JL commented Mar 26, 2023

Yup. Just verified compiling from source, with my fix in 45fa86b all works as expected, while on 5e4bb14 (parent commit) I get the issue with button missing

@nick22985
Copy link
Collaborator

nick22985 commented Mar 27, 2023

What is the state that is left out I don't think we want to return inactive if the state is actually undefined. State should not be undefined either if the state shouldn't be shown due to an exemption or something else that has gone wrong. If state is undefined we are missing a case in the switch statement and that should be fixed.

Also this causes issues in git repos if it is undefined because git doesn't have a inactive state

Once I flush out all the issues with the switching I would like to move this way of doing things to other areas were code has been repeated over and over again. So it is important that we accommodate this and handle the outcome that we are missing. If I can find a clean nice way of doing it.

Can u post the config you have set I do not have a problem with what you are describing / cant recreate it in the live version?

Also steps to reproduce. In git/not in git. idle etc

This is my exact config for buttons

	"vscord.status.buttons": {
		"button1": {
			"enabled": true,
			"preset": "test",
			"active": {
				"label": "Check Out My Github",
				"url": "https://github.com/nick22985",
				"enabled": true
			},
			"idle": {
				"label": "Check Out My Github",
				"url": "https://github.com/nick22985",
				"enabled": true
			},
			"inactive": {
				"label": "Check Out My Github",
				"url": "https://github.com/nick22985",
				"enabled": true
			},
			"git": {
				"enabled": true,
				"idle": {
					"label": " View Repository ",
					"url": "{git_url}",
					"enabled": true
				},
				"active": {
					"label": "View Repository",
					"url": "{git_url}",
					"enabled": true
				},
				"inactive": {
					"label": "View Repository",
					"url": "{git_url}",
					"enabled": true
				}
			}
		},
		"button2": {
			"enabled": true,
			"active": {
				"label": "Check Out My Website",
				"url": "https://nick22985.com",
				"enabled": true
			},
			"idle": {
				"label": "Check Out My Website",
				"url": "https://nick22985.com",
				"enabled": true
			},
			"inactive": {
				"label": "Check Out My Website",
				"url": "https://nick22985.com",
				"enabled": true
			},
			"git": {
				"enabled": true,
				"idle": {
					"label": "Check Out My Github",
					"url": "https://github.com/nick22985",
					"enabled": true
				},
				"active": {
					"label": "Check Out My Github",
					"url": "https://github.com/nick22985",
					"enabled": true
				},
				"inactive": {
					"label": "Check Out My Github",
					"url": "https://github.com/nick22985",
					"enabled": true
				}
			}
		}
	},

In git repo no file
https://gyazo.com/7cf90887f06b145e2b58ec5444beb6a1

In git idle state:
https://gyazo.com/834e60ac5aec5344a310ed58d9ed2dc7

In FIle
https://gyazo.com/c76c805e4913409020f4c2860a890d48

Idle state in file
https://gyazo.com/3a4972dcdbe111a45608dee923c7838b

Idle state not in file (this issue with the :: and no file name has been in vscord for ages. I have seen it a few times makes sense why it is happening with not being in a file)
https://gyazo.com/15482c0880beef6f9357af96c98306ec

Also this shouldn't be undefined. I think it will break the ignore repo / workspace / org checks. As if it is gitExluded it uses the inactive status I am pretty sure. I would have to actually test and look into it tho
https://github.com/leonardssh/vscord/blob/45fa86b5d3168215824608f028908894ec36d4f7/src/activity.ts#LL323C5-L323C6

xhayper added a commit that referenced this issue Mar 27, 2023
@xhayper xhayper added the bug Something isn't working label Mar 28, 2023
@xhayper xhayper closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants